Display Jobs Banner if User searches jobs or job (#8259)
* Display Jobs Banner if User Searches jobs or job * Add period to end of sentence Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com> * reword site config description Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com> * Change SiteConfig display field name to display_jobs_banner * dont forget the specs Co-authored-by: Andy Zhao <17884966+Zhao-Andy@users.noreply.github.com> Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
This commit is contained in:
parent
eea508697a
commit
97fecd6703
5 changed files with 54 additions and 3 deletions
|
|
@ -45,7 +45,8 @@ class Internal::ConfigsController < Internal::ApplicationController
|
|||
rate_limit_params |
|
||||
mascot_params |
|
||||
image_params |
|
||||
onboarding_params
|
||||
onboarding_params |
|
||||
job_params
|
||||
|
||||
params.require(:site_config).permit(
|
||||
allowed_params,
|
||||
|
|
@ -139,4 +140,11 @@ class Internal::ConfigsController < Internal::ApplicationController
|
|||
suggested_users
|
||||
]
|
||||
end
|
||||
|
||||
def job_params
|
||||
%i[
|
||||
jobs_url
|
||||
display_jobs_banner
|
||||
]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -44,6 +44,10 @@ class SiteConfig < RailsSettings::Base
|
|||
field :periodic_email_digest_max, type: :integer, default: 0
|
||||
field :periodic_email_digest_min, type: :integer, default: 2
|
||||
|
||||
# Jobs
|
||||
field :jobs_url, type: :string, default: "https://jobs.dev.to/"
|
||||
field :display_jobs_banner, type: :boolean, default: false
|
||||
|
||||
# Google Analytics Reporting API v4
|
||||
# <https://developers.google.com/analytics/devguides/reporting/core/v4>
|
||||
field :ga_view_id, type: :string, default: ""
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
data-articles-since="<%= Timeframer.new(params[:timeframe]).datetime&.iso8601 %>">
|
||||
<%= render "articles/search/sidebar" %>
|
||||
<div class="articles-list" id="articles-list">
|
||||
<% if (params[:q].downcase == "job" || params[:q].downcase == "jobs") && SiteConfig.display_jobs_banner %>
|
||||
<div class="crayons-notice crayons-notice--info mb-3 fs-base">Interested in joining our team? Explore our <a href=<%= SiteConfig.jobs_url %>>open roles</a>.</div>
|
||||
<% end %>
|
||||
<div class="substories" id="substories">
|
||||
<div class="query-results-nothing">
|
||||
<div class="query-results-loader"></div>
|
||||
|
|
|
|||
|
|
@ -245,6 +245,31 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3">
|
||||
<%= render partial: "card_header",
|
||||
locals: {
|
||||
header: "Jobs",
|
||||
state: "collapse",
|
||||
target: "jobsBodyContainer",
|
||||
expanded: "false"
|
||||
} %>
|
||||
<div id="jobsBodyContainer" class="card-body collapse hide" aria-labelledby="jobsBodyContainer">
|
||||
<div class="form-group">
|
||||
<%= f.label :jobs_url %>
|
||||
<%= f.text_field :jobs_url,
|
||||
class: "form-control",
|
||||
value: SiteConfig.jobs_url,
|
||||
placeholder: "Jobs URL" %>
|
||||
<div class="alert alert-info">URL of the website where open positions are posted.</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.label :display_jobs_banner %>
|
||||
<%= f.check_box :display_jobs_banner, checked: SiteConfig.display_jobs_banner %>
|
||||
<div class="alert alert-info">Display a jobs banner that points users to the <%= community_name %> jobs page when they type "job" or "jobs" in the search box</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3">
|
||||
<%= render partial: "card_header",
|
||||
locals: {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ RSpec.describe "/internal/config", type: :request do
|
|||
|
||||
describe "API tokens" do
|
||||
it "updates the health_check_token" do
|
||||
token = "#{rand(20)}"
|
||||
token = rand(20).to_s
|
||||
post "/internal/config", params: { site_config: { health_check_token: token }, confirmation: confirmation_message }
|
||||
expect(SiteConfig.health_check_token).to eq token
|
||||
end
|
||||
|
|
@ -128,6 +128,18 @@ RSpec.describe "/internal/config", type: :request do
|
|||
end
|
||||
end
|
||||
|
||||
describe "Jobs" do
|
||||
it "updates jobs_url" do
|
||||
post "/internal/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 "/internal/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_view_id" do
|
||||
post "/internal/config", params: { site_config: { ga_view_id: "abc" }, confirmation: confirmation_message }
|
||||
|
|
@ -376,7 +388,6 @@ RSpec.describe "/internal/config", type: :request do
|
|||
expect(SiteConfig.sidebar_tags).to eq(%w[hey haha hoho bobofofo])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
# rubocop:enable RSpec/NestedGroups
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue