Skip to content

Commit

Permalink
Merge pull request #2506 from alphagov/add-slug-to-publisher
Browse files Browse the repository at this point in the history
Add slug text for editions listed on publications table
  • Loading branch information
syed-ali-tw authored Jan 21, 2025
2 parents 8d85c12 + 62017f3 commit aba8e6a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/views/root/_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
[
{
text:
sanitize("<p class='title govuk-body'><a href='editions/#{publication._id}' class='govuk-link govuk-!-font-weight-bold'>#{publication.title}</a></p>") +
sanitize("<p class='title govuk-body govuk-!-margin-bottom-0'><a href='editions/#{publication._id}' class='govuk-link govuk-!-font-weight-bold'>#{publication.title}</a></p>") +
sanitize("<p class='govuk-body'>/#{publication.slug}</p>") +
(render "govuk_publishing_components/components/details", {
title: "More details",
} do
Expand Down
2 changes: 1 addition & 1 deletion test/functional/root_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class RootControllerTest < ActionController::TestCase

assert_response :ok
assert_select "p.publications-table__heading", "1 document(s)"
assert_select "p.title", "What to do in the event of a zombie apocalypse"
assert_select "p.title", /What to do in the event of a zombie apocalypse/
end

should "ignore unrecognised filter states" do
Expand Down
10 changes: 10 additions & 0 deletions test/integration/root_overview_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,14 @@ class RootOverviewTest < IntegrationTest
assert page.has_content?("Draft guide")
assert page.has_no_content?("Popular links edition")
end

should "show slug for editions on publications table" do
alice = FactoryBot.create(:user, :govuk_editor, name: "Alice", uid: "alice")
edition = FactoryBot.create(:edition, title: "Guides and Gals", assigned_to: alice)

visit "/"
row = find_all(".govuk-table__row")

assert row[1].text.include?("/#{edition.slug}")
end
end

0 comments on commit aba8e6a

Please sign in to comment.