diff --git a/Gemfile.lock b/Gemfile.lock index 2d6e554b8..71a0b2365 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -239,10 +239,10 @@ GEM sentry-rails (~> 5.3) sentry-ruby (~> 5.3) statsd-ruby (~> 1.5) - govuk_personalisation (0.16.0) + govuk_personalisation (1.0.0) plek (>= 1.9.0) rails (>= 6, < 8) - govuk_publishing_components (41.1.1) + govuk_publishing_components (43.3.0) govuk_app_config govuk_personalisation (>= 0.7.0) kramdown @@ -688,7 +688,7 @@ GEM rexml (3.3.6) strscan rinku (2.0.6) - rouge (4.3.0) + rouge (4.4.0) rubocop (1.64.1) json (~> 2.3) language_server-protocol (>= 3.17.0) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 0a6375e47..d403b16d5 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -1,6 +1,7 @@ $govuk-page-width: 1140px; // GOVUK Design System +@import "govuk/base"; @import 'govuk_publishing_components/govuk_frontend_support'; @import 'govuk_publishing_components/component_support'; @import 'govuk_publishing_components/components/button'; @@ -23,6 +24,7 @@ $govuk-page-width: 1140px; @import 'govuk_publishing_components/components/notice'; @import 'govuk_publishing_components/components/previous-and-next-navigation'; @import 'govuk_publishing_components/components/search'; +@import 'govuk_publishing_components/components/secondary-navigation'; @import 'govuk_publishing_components/components/select'; @import 'govuk_publishing_components/components/skip-link'; @import 'govuk_publishing_components/components/success-alert'; diff --git a/app/controllers/editions_controller.rb b/app/controllers/editions_controller.rb index 9dca5cede..ddbb55dd5 100644 --- a/app/controllers/editions_controller.rb +++ b/app/controllers/editions_controller.rb @@ -16,6 +16,26 @@ def show render action: "show" end + def metadata + render action: "show" + end + + def history + render action: "show" + end + + def admin + render action: "show" + end + + def linking + render action: "show" + end + + def unpublish + render action: "show" + end + protected def setup_view_paths diff --git a/app/helpers/tabbed_nav_helper.rb b/app/helpers/tabbed_nav_helper.rb new file mode 100644 index 000000000..e733afd7d --- /dev/null +++ b/app/helpers/tabbed_nav_helper.rb @@ -0,0 +1,32 @@ +module TabbedNavHelper + def edition_nav_items(edition) + nav_items = [] + items = %w[edit tagging metadata history admin related_external_links unpublish] + + items.each do |item| + nav_items << standard_nav_items(item, edition) + end + + nav_items.flatten + end + + def standard_nav_items(item, edition) + url = item.eql?("edit") ? url_for([:edition, { id: edition.id }]) : url_for([:edition, { action: item, id: edition.id }]) + + label = Edition::Tab[item].title + href = url + current = request.path == url + + edit_nav_item(label, href, current) + end + + def edit_nav_item(label, href, current) + [ + { + label:, + href:, + current:, + }, + ] + end +end diff --git a/app/views/editions/_secondary_navigation.html.erb b/app/views/editions/_secondary_navigation.html.erb new file mode 100644 index 000000000..0a456c29a --- /dev/null +++ b/app/views/editions/_secondary_navigation.html.erb @@ -0,0 +1,4 @@ +<%= render "govuk_publishing_components/components/secondary_navigation", { + aria_label: "Document navigation", + items: edition_nav_items(@edition), +} %> diff --git a/app/views/editions/show.html.erb b/app/views/editions/show.html.erb index e395fcdd9..2f0c0fedb 100644 --- a/app/views/editions/show.html.erb +++ b/app/views/editions/show.html.erb @@ -22,4 +22,8 @@ ], } %> + +