chore(announces): main navigation across announces

This commit is contained in:
Colin Darie 2023-10-30 15:37:04 +01:00
parent e49436aa5d
commit 178458215c
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
9 changed files with 57 additions and 19 deletions

View file

@ -2,6 +2,10 @@ class SuperAdmins::ReleaseNotesController < ApplicationController
before_action :authenticate_super_admin! before_action :authenticate_super_admin!
before_action :set_note, only: [:edit, :update, :destroy] before_action :set_note, only: [:edit, :update, :destroy]
def nav_bar_profile
:superadmin
end
def index def index
@release_notes = ReleaseNote @release_notes = ReleaseNote
.order(released_on: :desc, id: :asc) .order(released_on: :desc, id: :asc)

View file

@ -36,7 +36,7 @@
%span.fr-icon-refresh-line.fr-icon--sm %span.fr-icon-refresh-line.fr-icon--sm
= t('go_gestionnaire', scope: [:layouts]) = t('go_gestionnaire', scope: [:layouts])
- if super_admin_signed_in? - if super_admin_signed_in? && nav_bar_profile != :superadmin
%li %li
= link_to manager_root_path, class: "fr-nav__link" do = link_to manager_root_path, class: "fr-nav__link" do
%span.fr-icon-shield-line.fr-icon--sm %span.fr-icon-shield-line.fr-icon--sm

View file

@ -99,4 +99,8 @@
- if current_user.expert && current_expert.avis_summary[:total] > 0 - if current_user.expert && current_expert.avis_summary[:total] > 0
= render partial: 'layouts/header/avis_tab', locals: { current_expert: current_expert } = render partial: 'layouts/header/avis_tab', locals: { current_expert: current_expert }
- if content_for?(:navigation_principale)
.fr-container
= yield(:navigation_principale)
= yield(:notice_info) = yield(:notice_info)

View file

@ -0,0 +1,17 @@
- content_for(:navigation_principale) do
.fr-container
%nav.fr-nav#header-navigation{ role: "navigation", aria: { label: 'Menu principal annonces' } }
%ul.fr-nav__list
%li.fr-nav__item
= link_to "Toutes les annonces", super_admins_release_notes_path, class: "fr-nav__link", target: "_self", aria: { current: action == :index ? "page" : nil }
%li.fr-nav__item
= link_to("Nouvelle annonce", new_super_admins_release_note_path(date: @release_note&.released_on), class: "fr-nav__link", target: "_self", aria: { current: action == :new ? "page" : nil })
- if action == :edit
%li.fr-nav__item
= link_to "Annonce", '', class: "fr-nav__link", target: "_self", aria: { current: "page" }
%li.fr-nav__item
= link_to "Annonces publiées", release_notes_path, class: "fr-nav__link", target: "_self"

View file

@ -1,3 +1,5 @@
= render "main_navigation", action: :edit
.fr-container.fr-my-5w .fr-container.fr-my-5w
.fr-grid-row.fr-grid-row--center .fr-grid-row.fr-grid-row--center
.fr-col-lg-10 .fr-col-lg-10

View file

@ -1,14 +1,21 @@
= render "main_navigation", action: :index
.fr-container.fr-my-5w .fr-container.fr-my-5w
.fr-grid-row.fr-grid-row--center .fr-grid-row.fr-grid-row--center
.fr-col-lg-10 .fr-col-lg-10
%h1.fr-h2 Liste des annonces %h1.fr-h2 Liste des annonces
= link_to("Créer une annonce", new_super_admins_release_note_path, class: "fr-btn") -# haml-lint:disable ApplicationNameLinter
= link_to "Releases sur GitHub", "https://github.com/demarches-simplifiees/demarches-simplifiees.fr/releases", **external_link_attributes
-# haml-lint:enable ApplicationNameLinter
%table.fr-table .fr-table
%table
%thead %thead
%th Annoncé le %th Annoncé le
%th Publié? %th Publié ?
%th Notes
%th Actions %th Actions
%tbody %tbody
- @release_notes.each do |note| - @release_notes.each do |note|
@ -19,6 +26,6 @@
%span.fr-badge.fr-badge--success.fr-badge--no-icon Publié %span.fr-badge.fr-badge--success.fr-badge--no-icon Publié
- else - else
%span.fr-badge.fr-badge--warning.fr-badge--no-icon Brouillon %span.fr-badge.fr-badge--warning.fr-badge--no-icon Brouillon
%td= note.body.to_plain_text.truncate_words(12)
%td %td
= link_to 'Modifier', edit_super_admins_release_note_path(note), class: 'fr-btn fr-btn--secondary' = link_to 'Modifier', edit_super_admins_release_note_path(note), class: 'fr-btn fr-btn--secondary'

View file

@ -1,3 +1,5 @@
= render "main_navigation", action: :new
.fr-container.fr-my-5w .fr-container.fr-my-5w
.fr-grid-row.fr-grid-row--center .fr-grid-row.fr-grid-row--center
.fr-col-lg-10 .fr-col-lg-10

View file

@ -16,6 +16,7 @@ en:
instructeur: instructor instructeur: instructor
administrateur: admin administrateur: admin
gestionnaire: admins group manager gestionnaire: admins group manager
superadmin: super-admin
expert: expert expert: expert
user: user user: user
guest: guest guest: guest

View file

@ -16,6 +16,7 @@ fr:
instructeur: instructeur instructeur: instructeur
administrateur: administrateur administrateur: administrateur
gestionnaire: gestionnaire gestionnaire: gestionnaire
superadmin: super-admin
expert: expert expert: expert
user: usager user: usager
guest: invité guest: invité