Skip to content

Commit

Permalink
Add job listing share icons (#7102)
Browse files Browse the repository at this point in the history
  • Loading branch information
starswan authored Sep 26, 2024
1 parent 2805710 commit eab1375
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ $govuk-assets-path: "/";
@import 'layouts/pages/list-school-job';
@import 'layouts/posts/index';
@import 'layouts/publishers/jobseeker_profiles/index';
@import 'layouts/publishers/vacancies/summary';
@import 'layouts/subscriptions/new';
@import 'layouts/support_users/feedbacks';
@import 'layouts/updates/index';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.publishers_vacancies_summary {
.copy-button {
margin-top: 28px;
vertical-align: bottom;
}
}
7 changes: 7 additions & 0 deletions app/views/publishers/vacancies/base/_facebook_link.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
a target="_blank" rel="noopener noreferrer external" class="govuk-link govuk-link--no-underline" href="https://www.facebook.com/sharer/sharer.php?u=#{url_encode(target_url)}"
span.govuk-link-image
svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" focusable="false" width="24" height="24"
path fill="currentColor" d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"
= text
span class="govuk-visually-hidden"
= t("app.opens_in_new_tab", link_text: nil)
7 changes: 7 additions & 0 deletions app/views/publishers/vacancies/base/_twitter_x_link.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
a target="_blank" rel="noopener noreferrer external" class="govuk-link govuk-link--no-underline" href="https://www.x.com/share?url=#{url_encode(target_url)}"
span.govuk-link-image
svg viewBox="0 0 1200 1227" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" width="24" height="24"
path fill="currentColor" d="M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z"
= text
span class="govuk-visually-hidden"
= t("app.opens_in_new_tab", link_text: nil)
23 changes: 23 additions & 0 deletions app/views/publishers/vacancies/summary.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,29 @@
p.govuk-body = t(".date_posted", date: @vacancy.publish_on.to_formatted_s)

h2.govuk-heading-m = t(".next_steps")

- if @vacancy.publish_on.today?
h3.govuk-heading-s = t(".share_your_job_listing")
p.govuk-body = t(".the_below_url_will_change")

.govuk-grid-row data-controller="clipboard" data-clipboard-success-content-value=t(".job_url_copied")
.govuk-grid-column-three-quarters
= form_with(url: nil) do |f|
= f.govuk_text_field :job_url,
value: job_url(@vacancy.slug),
label: { text: t(".share_page_url") },
disabled: true,
data: { clipboard_target: "source" }
.govuk-grid-column-one-quarter
button[data-action="clipboard#copy"
data-clipboard-target="button"
class="js-action govuk-button govuk-button--secondary copy-button"]
= t(".button_copy")

ul.govuk-list.govuk-list-spaced
li = render "facebook_link", target_url: job_url(@vacancy.slug), text: t(".facebook_share")
li = render "twitter_x_link", target_url: job_url(@vacancy.slug), text: t(".x_share")

p = t(".you_can")

ul.govuk-list.govuk-list--bullet
Expand Down
9 changes: 8 additions & 1 deletion config/locales/publishers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ en:
hint_intro: "To offer Skilled Worker visa sponsorship, this role must:"
hint_bullet_1: meet the minimum salary requirements
hint_bullet_2: be included on the list of eligible roles
hint_salary_text: Different salary rules apply for support roles in schools.
hint_salary_text: Different salary rules apply for support roles in schools.
learn_more_link_text: Learn more about Skilled Worker visa requirements for teaching jobs (opens in new tab).
eligibility_link_text: Find out about eligible support roles and salary requirements (opens in new tab).
live:
Expand Down Expand Up @@ -658,6 +658,13 @@ en:
preview_listing: preview the job listing
view_listing: view the job listing
you_can: "You can:"
share_your_job_listing: Share your job listing
the_below_url_will_change: If you edit the job title in your listing, the below URL will change and you may need to reshare the link
share_page_url: Share page URL
button_copy: Copy URL
facebook_share: Share on Facebook
x_share: Share on X (formerly known as Twitter)
job_url_copied: URL Copied
statistics:
show:
application_data: Application data
Expand Down
35 changes: 35 additions & 0 deletions spec/system/publishers/publishers_can_copy_and_promote_job_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
require "rails_helper"

RSpec.describe "Publishers can copy and promote job" do
let(:publisher) { create(:publisher) }
let(:organisation) { create(:school) }
let(:vacancy) { create(:vacancy, :draft, organisations: [organisation], publisher: publisher, publish_on: publish_on) }
let(:share_page_content) { I18n.t("publishers.vacancies.summary.share_page_url") }

before do
login_publisher(publisher: publisher, organisation: organisation)
visit organisation_job_review_path(vacancy.id)
end

after do
logout
end

context "when the vacancy is published today" do
let(:publish_on) { Date.current }

it "shows the share link" do
click_on I18n.t("publishers.vacancies.show.heading_component.action.publish")
expect(page).to have_content(share_page_content)
end
end

context "when the vacancy is published tomorrow" do
let(:publish_on) { Date.tomorrow }

it "doesnt show the share link" do
click_on I18n.t("publishers.vacancies.show.heading_component.action.scheduled_complete_draft")
expect(page).not_to have_content(share_page_content)
end
end
end

0 comments on commit eab1375

Please sign in to comment.