diff --git a/app/components/tab_navigation_component.html.erb b/app/components/tab_navigation_component.html.erb deleted file mode 100644 index 871cd4cbf..000000000 --- a/app/components/tab_navigation_component.html.erb +++ /dev/null @@ -1,15 +0,0 @@ - diff --git a/app/components/tab_navigation_component.rb b/app/components/tab_navigation_component.rb deleted file mode 100644 index 06c879389..000000000 --- a/app/components/tab_navigation_component.rb +++ /dev/null @@ -1,14 +0,0 @@ -class TabNavigationComponent < ViewComponent::Base - attr_reader :items - - def initialize(items:) - @items = items - super - end - - def strip_query(url) - url = Addressable::URI.parse(url) - url.query_values = nil - url.to_s - end -end diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index 3ba167453..94405eadf 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -1,8 +1,14 @@ class OrganisationsController < ApplicationController - before_action :authenticate_user! - before_action :find_resource + before_action :authenticate_user!, except: [:index] + before_action :find_resource, except: [:index] before_action :authenticate_scope! + def index + if !current_user.support? + redirect_to user_path(current_user) + end + end + def show redirect_to details_organisation_path(@organisation) end @@ -41,10 +47,11 @@ private end def authenticate_scope! - render_not_found if current_user.organisation != @organisation + render_not_found if current_user.organisation != @organisation && !current_user.support? end def find_resource + return if current_user.support? @organisation = Organisation.find(params[:id]) end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0c44b679b..5f600b71f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -5,6 +5,12 @@ class UsersController < ApplicationController before_action :find_resource, except: %i[new create] before_action :authenticate_scope!, except: %i[new] + def index + if !current_user.support? + redirect_to user_path(@user) + end + end + def update if @user.update(user_params) if @user == current_user diff --git a/app/frontend/styles/_primary-navigation.scss b/app/frontend/styles/_primary-navigation.scss new file mode 100644 index 000000000..bdadaa107 --- /dev/null +++ b/app/frontend/styles/_primary-navigation.scss @@ -0,0 +1,69 @@ +.app-primary-navigation { + @include govuk-font(19, $weight: bold); + background-color: govuk-colour("light-grey"); + border-bottom: 1px solid $govuk-border-colour; + } + + .govuk-phase-banner + .app-primary-navigation { + margin-top: -1px; + } + + .app-primary-navigation__list { + @include govuk-clearfix; + left: govuk-spacing(-3); + list-style: none; + margin: 0; + padding: 0; + position: relative; + right: govuk-spacing(-3); + width: calc(100% + #{govuk-spacing(6)}); + } + + .app-primary-navigation__item { + box-sizing: border-box; + display: block; + float: left; + line-height: 50px; + height: 50px; + padding: 0 govuk-spacing(3); + position: relative; + } + + .app-primary-navigation__item--current { + border-bottom: $govuk-border-width-narrow solid $govuk-link-colour; + + &:hover { + border-bottom-color: $govuk-link-hover-colour; + } + + &:active { + border-bottom-color: $govuk-link-active-colour; + } + } + + .app-primary-navigation__item--align-right { + @include govuk-media-query($from: tablet) { + float: right; + } + } + + .app-primary-navigation__link { + @include govuk-link-common; + @include govuk-link-style-no-visited-state; + @include govuk-link-style-no-underline; + @include govuk-typography-weight-bold; + + // Extend the touch area of the link to the list + &:after { + bottom: 0; + content: ""; + left: 0; + position: absolute; + right: 0; + top: 0; + } + } + + .app-primary-navigation__item--current .app-primary-navigation__link:hover { + text-decoration: none; + } \ No newline at end of file diff --git a/app/frontend/styles/_tab-navigation.scss b/app/frontend/styles/_tab-navigation.scss deleted file mode 100644 index 0b5ebb6db..000000000 --- a/app/frontend/styles/_tab-navigation.scss +++ /dev/null @@ -1,76 +0,0 @@ -.app-tab-navigation { - @include govuk-font(19, $weight: bold); - @include govuk-responsive-margin(6, "bottom"); -} - -.app-tab-navigation__list { - @include govuk-clearfix; - left: govuk-spacing(-3); - list-style: none; - margin: 0; - padding: 0; - position: relative; - right: govuk-spacing(-3); - width: calc(100% + #{govuk-spacing(6)}); - - @include govuk-media-query($from: tablet) { - box-shadow: inset 0 -1px 0 $govuk-border-colour; - } -} - -.app-tab-navigation__item { - box-sizing: border-box; - display: block; - line-height: 40px; - height: 40px; - padding: 0 govuk-spacing(3); - - @include govuk-media-query($from: tablet) { - box-shadow: none; - display: block; - float: left; - line-height: 50px; - height: 50px; - padding: 0 govuk-spacing(3); - position: relative; - } -} - -.app-tab-navigation__item--current { - @include govuk-media-query($until: tablet) { - border-left: 4px solid $govuk-link-colour; - padding-left: 11px; - } - - @include govuk-media-query($from: tablet) { - border-bottom: 4px solid $govuk-link-colour; - padding-left: govuk-spacing(3); - } -} - -.app-tab-navigation__link { - @include govuk-link-common; - @include govuk-link-style-no-visited-state; - @include govuk-link-style-no-underline; - @include govuk-typography-weight-bold; - - &:not(:focus):hover { - color: $govuk-link-colour; - } - - // Extend the touch area of the link to the list - &:after { - bottom: 0; - content: ""; - left: 0; - position: absolute; - right: 0; - top: 0; - } -} - -.app-tab-navigation__item--current .app-tab-navigation__link { - &:hover { - text-decoration: none; - } -} diff --git a/app/frontend/styles/application.scss b/app/frontend/styles/application.scss index 0d172f26f..8dd6fc1a3 100644 --- a/app/frontend/styles/application.scss +++ b/app/frontend/styles/application.scss @@ -23,12 +23,12 @@ $govuk-new-link-styles: true; @import "input"; @import "related-navigation"; @import "section-skip-link"; -@import "tab-navigation"; @import "table-group"; @import "task-list"; @import "template"; @import "pagination"; @import "panel"; +@import "primary-navigation"; // App utilities .app-\!-colour-muted { @@ -53,3 +53,11 @@ $govuk-new-link-styles: true; width: 100%; } } + +.govuk-header__logo { + width: 80%; +} + +.govuk-header__content { + width: 20%; +} diff --git a/app/views/layouts/_primary_navigation.html.erb b/app/views/layouts/_primary_navigation.html.erb new file mode 100644 index 000000000..0fd8529bd --- /dev/null +++ b/app/views/layouts/_primary_navigation.html.erb @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 701c42b95..f2c40fe13 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -66,7 +66,26 @@ <%= content_for(:breadcrumbs) %> <%= content_for(:before_content) %> + + + <% if !current_user.nil? %> + <% if current_user.support? %> + <% items = [ + { name: t("Organisations"), url: "/organisations" }, + { name: t("Users"), url: "/users" }, + { name: t("Logs"), url: case_logs_path }, + ] %> + <% else %> + <% items = [ + { name: t("Logs"), url: case_logs_path }, + { name: t("Users"), url: users_organisation_path(current_user.organisation) }, + { name: t("About your organisation"), url: "/organisations/#{current_user.organisation.id}" }, + ] %> + <% end %> + <%= render partial: "layouts/primary_navigation", locals: {items: items} %> + <% end %> +