Skip to content

Commit

Permalink
chore(announces): main navigation across announces
Browse files Browse the repository at this point in the history
  • Loading branch information
colinux committed Nov 6, 2023
1 parent 48a1149 commit 25c1334
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 19 deletions.
4 changes: 4 additions & 0 deletions app/controllers/super_admins/release_notes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ class SuperAdmins::ReleaseNotesController < ApplicationController
before_action :authenticate_super_admin!
before_action :set_note, only: [:edit, :update, :destroy]

def nav_bar_profile
:superadmin
end

def index
@release_notes = ReleaseNote
.order(released_on: :desc, id: :asc)
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/_account_dropdown.haml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
%span.fr-icon-refresh-line.fr-icon--sm
= t('go_gestionnaire', scope: [:layouts])

- if super_admin_signed_in?
- if super_admin_signed_in? && nav_bar_profile != :superadmin
%li
= link_to manager_root_path, class: "fr-nav__link" do
%span.fr-icon-shield-line.fr-icon--sm
Expand Down
4 changes: 4 additions & 0 deletions app/views/layouts/_header.haml
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,8 @@
- if current_user.expert && current_expert.avis_summary[:total] > 0
= render partial: 'layouts/header/avis_tab', locals: { current_expert: current_expert }

- if content_for?(:navigation_principale)
.fr-container
= yield(:navigation_principale)

= yield(:notice_info)
17 changes: 17 additions & 0 deletions app/views/super_admins/release_notes/_main_navigation.html.haml
Original file line number Diff line number Diff line change
@@ -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"

2 changes: 2 additions & 0 deletions app/views/super_admins/release_notes/edit.html.haml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
= render "main_navigation", action: :edit

.fr-container.fr-my-5w
.fr-grid-row.fr-grid-row--center
.fr-col-lg-10
Expand Down
43 changes: 25 additions & 18 deletions app/views/super_admins/release_notes/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
= render "main_navigation", action: :index

.fr-container.fr-my-5w
.fr-grid-row.fr-grid-row--center
.fr-col-lg-10
%h1.fr-h2 Liste des annonces

= link_to("Créer une annonce", new_super_admins_release_note_path, class: "fr-btn")
%h1.fr-h2 Liste des annonces

%table.fr-table
%thead
%th Annoncé le
%th Publié?
%th Actions
%tbody
- @release_notes.each do |note|
%tr
%td= l(note.released_on) if note.released_on
%td
- if note.published?
%span.fr-badge.fr-badge--success.fr-badge--no-icon Publié
- else
%span.fr-badge.fr-badge--warning.fr-badge--no-icon Brouillon
%td
= link_to 'Modifier', edit_super_admins_release_note_path(note), class: 'fr-btn fr-btn--secondary'
-# 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
.fr-table
%table
%thead
%th Annoncé le
%th Publié?
%th Notes
%th Actions
%tbody
- @release_notes.each do |note|
%tr
%td= l(note.released_on) if note.released_on
%td
- if note.published?
%span.fr-badge.fr-badge--success.fr-badge--no-icon Publié
- else
%span.fr-badge.fr-badge--warning.fr-badge--no-icon Brouillon
%td= note.body.to_plain_text.truncate_words(12)
%td
= link_to 'Modifier', edit_super_admins_release_note_path(note), class: 'fr-btn fr-btn--secondary'
2 changes: 2 additions & 0 deletions app/views/super_admins/release_notes/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
= render "main_navigation", action: :new

.fr-container.fr-my-5w
.fr-grid-row.fr-grid-row--center
.fr-col-lg-10
Expand Down
1 change: 1 addition & 0 deletions config/locales/views/layouts/_account_dropdown.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ en:
instructeur: instructor
administrateur: admin
gestionnaire: admins group manager
superadmin: super-admin
expert: expert
user: user
guest: guest
1 change: 1 addition & 0 deletions config/locales/views/layouts/_account_dropdown.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ fr:
instructeur: instructeur
administrateur: administrateur
gestionnaire: gestionnaire
superadmin: super-admin
expert: expert
user: usager
guest: invité

0 comments on commit 25c1334

Please sign in to comment.