diff --git a/app/controllers/admin/base_controller.rb b/app/controllers/admin/base_controller.rb index 39fcd09a4835..90d8ab1e69ba 100644 --- a/app/controllers/admin/base_controller.rb +++ b/app/controllers/admin/base_controller.rb @@ -53,6 +53,11 @@ def render_design_system(design_system_view, legacy_view) end end + def show_new_header? + current_user.can_preview_design_system? + end + helper_method :show_new_header? + private def new_design_system? diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index 28ffc2227f58..5fe74929d0e2 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -21,7 +21,11 @@ <% end %> <% content_for :navbar do %> + <% if show_new_header? %> <%= render "shared/header", admin_template: true %> + <% else %> + <%= render "shared/legacy_header", admin_template: true %> + <% end %> <% if t('admin.whats_new.show_banner') %>
"> diff --git a/app/views/layouts/design_system.html.erb b/app/views/layouts/design_system.html.erb index 0705bc97580f..96596e2aae67 100644 --- a/app/views/layouts/design_system.html.erb +++ b/app/views/layouts/design_system.html.erb @@ -28,7 +28,11 @@
diff --git a/app/views/shared/_header.html.erb b/app/views/shared/_header.html.erb index 84ca8de99671..a7efb77b4509 100644 --- a/app/views/shared/_header.html.erb +++ b/app/views/shared/_header.html.erb @@ -9,47 +9,43 @@ navbar-default navbar-inverse navbar-static-top - <% if !t('admin.whats_new.show_banner') && admin_template %>add-bottom-margin<% end %> - <% if environment_style %>environment-indicator<% end %>" role="banner"> - + <% if !t('admin.whats_new.show_banner') && admin_template %>add-bottom-margin + <% end %> + <% if environment %>environment-indicator + <% end %>" role="banner"> + <%= render "govuk_publishing_components/components/layout_header", { + product_name: "Whitehall Publisher", + environment: environment, + navigation_items: [ + { + text: "Dashboard", + href: admin_root_path, + }, + { + text: "View website", + href: Whitehall.public_root, + }, + { + text: "Switch app", + href: Plek.external_url_for("signon"), + }, + *( + if user_signed_in? + [{ + text: current_user.name, + href: admin_user_path(current_user), + }, + { + text: "Logout", + href: "/auth/gds/sign_out", + }] + end), + { + text: "All users", + href: admin_users_path, + }, + ], + } %>