From a148fecb3892c54cae7dc408c1c86c2545d68eec Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Thu, 2 Feb 2023 12:11:18 +0100 Subject: [PATCH] layout for PAB --- .../stylesheets/admin/appstack/style.sass | 4 + .../stylesheets/admin/commons/style.sass | 7 +- .../admin/application/a11y/_status.html.erb | 11 ++- .../admin/communication/blocks/_list.html.erb | 2 +- .../communication/websites/_sidebar.html.erb | 98 +++++++++---------- 5 files changed, 66 insertions(+), 56 deletions(-) diff --git a/app/assets/stylesheets/admin/appstack/style.sass b/app/assets/stylesheets/admin/appstack/style.sass index 21d18f7cc..4c310a33d 100644 --- a/app/assets/stylesheets/admin/appstack/style.sass +++ b/app/assets/stylesheets/admin/appstack/style.sass @@ -76,6 +76,10 @@ p .sidebar-item.active > .sidebar-link color: white +.website__sidebar + .list-group-item.active + color: $primary + #topbar padding-left: $grid-gutter-width padding-right: $grid-gutter-width diff --git a/app/assets/stylesheets/admin/commons/style.sass b/app/assets/stylesheets/admin/commons/style.sass index 6792bc315..7b0183f49 100644 --- a/app/assets/stylesheets/admin/commons/style.sass +++ b/app/assets/stylesheets/admin/commons/style.sass @@ -4,4 +4,9 @@ &:last-of-type // Buttons opacity: 1 .handle - cursor: move \ No newline at end of file + cursor: move + +.a11y + &__status + &__icon + vertical-align: sub \ No newline at end of file diff --git a/app/views/admin/application/a11y/_status.html.erb b/app/views/admin/application/a11y/_status.html.erb index 0f06d6502..20ae8394f 100644 --- a/app/views/admin/application/a11y/_status.html.erb +++ b/app/views/admin/application/a11y/_status.html.erb @@ -1,4 +1,7 @@ -<p class="m-0"> - <i class="lead fas fa-universal-access <%= about.accessible? ? 'text-success' : 'text-danger'%>"></i> - <%= t "accessibility.status.#{about.accessible?}" %> -</p> +<% +$color = about.accessible? ? 'text-success' : 'text-danger' +%> +<span class="small a11y__status"> + <i class="a11y__status__icon lead fas fa-universal-access <%= $color %>"></i> + <%= t "accessibility.status.#{about.accessible?}" %> +</span> diff --git a/app/views/admin/communication/blocks/_list.html.erb b/app/views/admin/communication/blocks/_list.html.erb index aa96b020f..e31d2ba01 100644 --- a/app/views/admin/communication/blocks/_list.html.erb +++ b/app/views/admin/communication/blocks/_list.html.erb @@ -17,12 +17,12 @@ action += link_to t('add'), <td> <%= block.to_s.truncate(50) %><br> <span class="small"><%= block.template_kind_i18n %></span> + <%= render 'admin/application/a11y/status', about: block %> </td> <td class="p-0"> <%= image_tag "communication/blocks/templates/#{block.template_kind}.jpg", height: "100px", alt: '', style:"max-height: 75px" %> </td> - <td><%= render 'admin/application/a11y/status', about: block %></td> <td> <div class="btn-group"> <%= duplicate_link block %> diff --git a/app/views/admin/communication/websites/_sidebar.html.erb b/app/views/admin/communication/websites/_sidebar.html.erb index cc2b8e98a..0698c734b 100644 --- a/app/views/admin/communication/websites/_sidebar.html.erb +++ b/app/views/admin/communication/websites/_sidebar.html.erb @@ -1,58 +1,56 @@ -<div class="row mt-2"> +<div class="row mt-2 website__sidebar"> <div class="col-lg-3 col-xl-2"> - <div class="card"> - <div class="list-group list-group-flush" role="tablist"> - <% - navigation = [ - { - title: Communication::Website.model_name.human, - path: admin_communication_website_path(id: @website, website_id: nil), - icon: Icon::COMMUNICATION_WEBSITE_HOME, - ability: can?(:read, @website) - }, - { - title: Communication::Website::Post.model_name.human(count: 2), - path: admin_communication_website_posts_path(website_id: @website), - icon: Icon::COMMUNICATION_WEBSITE_POST, - ability: can?(:read, Communication::Website::Post) - }, - { - title: t('admin.communication.website.pages.structure'), - path: admin_communication_website_pages_path(website_id: @website), - icon: Icon::COMMUNICATION_WEBSITE_PAGES, - ability: can?(:read, Communication::Website::Page) - }, - { - title: Communication::Website::Menu.model_name.human(count: 2), - path: admin_communication_website_menus_path(website_id: @website), - icon: Icon::COMMUNICATION_WEBSITE_MENUS, - ability: can?(:read, Communication::Website::Category) - } - ] - - navigation << { - title: t('communication.website.analytics'), - path: analytics_admin_communication_website_path(@website.id, website_id: nil), - icon: Icon::COMMUNICATION_WEBSITE_ANALYTICS, + <div class="list-group list-group-flush" role="tablist"> + <% + navigation = [ + { + title: Communication::Website.model_name.human, + path: admin_communication_website_path(id: @website, website_id: nil), + icon: Icon::COMMUNICATION_WEBSITE_HOME, ability: can?(:read, @website) - } if @website.plausible_url.present? + }, + { + title: Communication::Website::Post.model_name.human(count: 2), + path: admin_communication_website_posts_path(website_id: @website), + icon: Icon::COMMUNICATION_WEBSITE_POST, + ability: can?(:read, Communication::Website::Post) + }, + { + title: t('admin.communication.website.pages.structure'), + path: admin_communication_website_pages_path(website_id: @website), + icon: Icon::COMMUNICATION_WEBSITE_PAGES, + ability: can?(:read, Communication::Website::Page) + }, + { + title: Communication::Website::Menu.model_name.human(count: 2), + path: admin_communication_website_menus_path(website_id: @website), + icon: Icon::COMMUNICATION_WEBSITE_MENUS, + ability: can?(:read, Communication::Website::Category) + } + ] + + navigation << { + title: t('communication.website.analytics'), + path: analytics_admin_communication_website_path(@website.id, website_id: nil), + icon: Icon::COMMUNICATION_WEBSITE_ANALYTICS, + ability: can?(:read, @website) + } if @website.plausible_url.present? - navigation.each_with_index do |object, index| - next unless object[:ability] - active = index.zero? ? object[:path] == request.path - : object[:path].in?(request.path) - %> - <a class="list-group-item list-group-item-action<%= ' active' if active %>" href="<%= object[:path] %>"> - <%= object[:title].html_safe %> - <span class="float-end"> - <i class="fas fa-<%= object[:icon] %>"></i> - </span> - </a> - <% end %> - </div> + navigation.each_with_index do |object, index| + next unless object[:ability] + active = index.zero? ? object[:path] == request.path + : object[:path].in?(request.path) + %> + <a class="list-group-item bg-transparent px-0 list-group-item-action<%= ' active' if active %>" href="<%= object[:path] %>"> + <%= object[:title].html_safe %> + <span class="float-end"> + <i class="fas fa-<%= object[:icon] %>"></i> + </span> + </a> + <% end %> </div> </div> - <div class="col-lg-9 col-xl-10 offset-xxl-1 col-xxl-9"> + <div class="col-lg-9 col-xl-10"> <%= yield %> </div> </div> -- GitLab