Refactor:Remove jobs_url and Dispaly Banner (#13479)
This commit is contained in:
parent
996f6e980f
commit
73973d3941
8 changed files with 1 additions and 112 deletions
|
|
@ -174,11 +174,7 @@ class SearchController < ApplicationController
|
|||
feed_content_search
|
||||
end
|
||||
|
||||
render json: {
|
||||
result: result,
|
||||
display_jobs_banner: SiteConfig.display_jobs_banner,
|
||||
jobs_url: SiteConfig.jobs_url
|
||||
}
|
||||
render json: { result: result }
|
||||
end
|
||||
|
||||
def reactions
|
||||
|
|
|
|||
|
|
@ -45,11 +45,6 @@ module Constants
|
|||
default_font: {
|
||||
description: "Determines the default Base Reading Font (registered users can change this in their UX settings)"
|
||||
},
|
||||
display_jobs_banner: {
|
||||
description: "Display a jobs banner that points users to the jobs page when they type 'job'" \
|
||||
"or 'jobs' in the search box",
|
||||
placeholder: ""
|
||||
},
|
||||
email_addresses: {
|
||||
description: "Email address",
|
||||
placeholder: ""
|
||||
|
|
@ -91,10 +86,6 @@ module Constants
|
|||
description: "Minimum score needed for a post to show up on the unauthenticated home page.",
|
||||
placeholder: "0"
|
||||
},
|
||||
jobs_url: {
|
||||
description: "URL of the website where open positions are posted",
|
||||
placeholder: "Jobs URL"
|
||||
},
|
||||
logo_png: {
|
||||
description: "Used as a fallback to the SVG. Recommended minimum of 512x512px for PWA support",
|
||||
placeholder: IMAGE_PLACEHOLDER
|
||||
|
|
|
|||
|
|
@ -76,10 +76,6 @@ class SiteConfig < RailsSettings::Base
|
|||
# Email digest frequency
|
||||
field :periodic_email_digest, type: :integer, default: 2
|
||||
|
||||
# Jobs
|
||||
field :jobs_url, type: :string
|
||||
field :display_jobs_banner, type: :boolean, default: false
|
||||
|
||||
# Google Analytics Tracking ID, e.g. UA-71991000-1
|
||||
field :ga_tracking_id, type: :string, default: ApplicationConfig["GA_TRACKING_ID"]
|
||||
|
||||
|
|
|
|||
|
|
@ -665,39 +665,6 @@
|
|||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= form_for(SiteConfig.new, url: admin_config_path) do |f| %>
|
||||
<div class="card mt-3">
|
||||
<%= render partial: "admin/shared/card_header",
|
||||
locals: {
|
||||
header: "Jobs",
|
||||
state: "collapse",
|
||||
target: "jobsBodyContainer",
|
||||
expanded: false
|
||||
} %>
|
||||
<div id="jobsBodyContainer" class="card-body collapse hide" aria-labelledby="jobsBodyContainer">
|
||||
<fieldset class="grid gap-4">
|
||||
<div class="crayons-field">
|
||||
<%= admin_config_label :jobs_url, "Jobs URL" %>
|
||||
<%= admin_config_description Constants::SiteConfig::DETAILS[:jobs_url][:description] %>
|
||||
<%= f.text_field :jobs_url,
|
||||
class: "crayons-textfield",
|
||||
value: SiteConfig.jobs_url,
|
||||
placeholder: Constants::SiteConfig::DETAILS[:jobs_url][:placeholder] %>
|
||||
</div>
|
||||
<div class="crayons-field crayons-field--checkbox">
|
||||
<%= f.check_box :display_jobs_banner, checked: SiteConfig.display_jobs_banner, class: "crayons-checkbox" %>
|
||||
<div class="mt-0">
|
||||
<%= admin_config_label :display_jobs_banner %>
|
||||
<%= admin_config_description Constants::SiteConfig::DETAILS[:display_jobs_banner][:description] %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "form_submission", f: f %>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= form_for(SiteConfig.new, url: admin_config_path) do |f| %>
|
||||
<div class="card mt-3">
|
||||
<%= render partial: "admin/shared/card_header",
|
||||
|
|
|
|||
|
|
@ -167,10 +167,6 @@
|
|||
})
|
||||
.then(response => response.json())
|
||||
.then((content) => {
|
||||
if (searchHash["search_fields"] && content.jobs_url) {
|
||||
addOptionalBanner(searchHash["search_fields"], content.display_jobs_banner, content.jobs_url);
|
||||
}
|
||||
|
||||
var resultDivs = []
|
||||
content.result.forEach(function (story, i) {
|
||||
resultDivs.push(buildArticleHTML(story));
|
||||
|
|
|
|||
|
|
@ -311,20 +311,6 @@ RSpec.describe "/admin/config", type: :request do
|
|||
end
|
||||
end
|
||||
|
||||
describe "Jobs" do
|
||||
it "updates jobs_url" do
|
||||
post "/admin/config", params: { site_config: { jobs_url: "www.jobs.com" },
|
||||
confirmation: confirmation_message }
|
||||
expect(SiteConfig.jobs_url).to eq("www.jobs.com")
|
||||
end
|
||||
|
||||
it "updates display_jobs_banner" do
|
||||
post "/admin/config", params: { site_config: { display_jobs_banner: true },
|
||||
confirmation: confirmation_message }
|
||||
expect(SiteConfig.display_jobs_banner).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
describe "Google Analytics Reporting API v4" do
|
||||
it "updates ga_tracking_id" do
|
||||
post "/admin/config", params: { site_config: { ga_tracking_id: "abc" }, confirmation: confirmation_message }
|
||||
|
|
|
|||
|
|
@ -262,8 +262,6 @@ RSpec.describe "Search", type: :request, proper_status: true do
|
|||
get search_feed_content_path(class_name: "Article")
|
||||
|
||||
expect(response.parsed_body["result"]).to be_present
|
||||
expect(response.parsed_body["display_jobs_banner"]).to eq(SiteConfig.display_jobs_banner)
|
||||
expect(response.parsed_body["jobs_url"]).to eq(SiteConfig.jobs_url)
|
||||
end
|
||||
|
||||
it "parses published_at correctly", :aggregate_failures do
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe "Display Jobs Banner spec", type: :system, js: true, stub_elasticsearch: true do
|
||||
before do
|
||||
allow(SiteConfig).to receive(:jobs_url).and_return("www.very_cool_jobs_website.com")
|
||||
end
|
||||
|
||||
context "when SiteConfig.display_jobs_banner is false" do
|
||||
it "does not show jobs banner" do
|
||||
allow(SiteConfig).to receive(:display_jobs_banner).and_return(false)
|
||||
visit "/search?q=jobs"
|
||||
|
||||
expect(page).not_to have_content("Interested in joining our team?")
|
||||
end
|
||||
end
|
||||
|
||||
context "when SiteConfig.display_jobs_banner is true" do
|
||||
before { allow(SiteConfig).to receive(:display_jobs_banner).and_return(true) }
|
||||
|
||||
it "displays job banner for job search" do
|
||||
visit "/search?q=jobs"
|
||||
|
||||
expect(page).to have_content("Interested in joining our team?")
|
||||
expect(find_link("open roles")["href"]).to include(SiteConfig.jobs_url)
|
||||
end
|
||||
|
||||
it "does not display jobs banner for other searches" do
|
||||
visit "/search?q=ruby"
|
||||
|
||||
expect(page).not_to have_content("Interested in joining our team?")
|
||||
end
|
||||
|
||||
it "does not show jobs banner when there's no jobs_url set" do
|
||||
allow(SiteConfig).to receive(:jobs_url).and_return(nil)
|
||||
|
||||
visit "/search?q=jobs"
|
||||
|
||||
expect(page).not_to have_content("Interested in joining our team?")
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue