split form and avis answers in 2 views for experts and add sidemenu

This commit is contained in:
Lisa Durand 2023-03-14 16:50:25 +01:00
parent 603d66e020
commit c51e6aa2e6
7 changed files with 81 additions and 44 deletions

View file

@ -6,7 +6,7 @@ module Experts
before_action :authenticate_expert!, except: [:sign_up, :update_expert]
before_action :check_if_avis_revoked, except: [:index, :procedure]
before_action :redirect_if_no_sign_up_needed, only: [:sign_up, :update_expert]
before_action :set_avis_and_dossier, only: [:show, :instruction, :messagerie, :create_commentaire, :delete_commentaire, :update, :telecharger_pjs]
before_action :set_avis_and_dossier, only: [:show, :instruction, :avis_list, :messagerie, :create_commentaire, :delete_commentaire, :update, :telecharger_pjs]
A_DONNER_STATUS = 'a-donner'
DONNES_STATUS = 'donnes'
@ -56,6 +56,9 @@ module Experts
@new_avis = Avis.new
end
def avis_list
end
def create_avis
@procedure = Procedure.find(params[:procedure_id])
@new_avis = create_avis_from_params(avis.dossier, current_expert, avis.confidentiel)

View file

@ -30,6 +30,7 @@
@import '@gouvfr/dsfr/dist/component/header/header.css';
@import '@gouvfr/dsfr/dist/component/footer/footer.css';
@import '@gouvfr/dsfr/dist/component/search/search.css';
@import '@gouvfr/dsfr/dist/component/sidemenu/sidemenu.css';
@import '@gouvfr/dsfr/dist/component/translate/translate.css';
@import '@gouvfr/dsfr/dist/component/pagination/pagination.css';
@import '@gouvfr/dsfr/dist/component/skiplink/skiplink.css';

View file

@ -18,5 +18,5 @@
%nav.tabs
%ul
= dynamic_tab_item('Demande', expert_avis_path(avis.procedure, avis))
= dynamic_tab_item('Avis', instruction_expert_avis_path(avis.procedure, avis), notification: avis.answer.blank?)
= dynamic_tab_item('Avis', [instruction_expert_avis_path(avis.procedure, avis), avis_list_expert_avis_path(avis.procedure, avis)], notification: avis.answer.blank?)
= dynamic_tab_item('Messagerie', messagerie_expert_avis_path(avis.procedure, avis))

View file

@ -0,0 +1,17 @@
%nav.fr-sidemenu{"aria-labelledby" => "fr-sidemenu-title"}
.fr-sidemenu__inner
%button.fr-sidemenu__btn{"aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: ""} Dans cette rubrique
#fr-sidemenu-wrapper.fr-collapse
%ul.fr-sidemenu__list
- current_page = current_page?(instruction_expert_avis_path(@avis.procedure, @avis))
%li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"}
%a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil, href: instruction_expert_avis_path(@avis.procedure, @avis), target: "_self"} Donner votre avis
- current_page = current_page?(avis_list_expert_avis_path(@avis.procedure, @avis))
- if @dossier.avis_for_expert(current_expert).present?
%li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"}
%a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: avis_list_expert_avis_path(@avis.procedure, @avis), target: "_self"} Voir les avis
-# - if !@dossier.termine?
-# %li.fr-sidemenu__item
-# %a.fr-sidemenu__link{href: "#", target: "_self"} Demander un nouvel avis

View file

@ -0,0 +1,11 @@
- content_for(:title, "Avis · Dossier nº #{@dossier.id} (#{@dossier.owner_name})")
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }
.container
.fr-grid-row
.fr-col.fr-col-12.fr-col-md-3
= render partial: 'sidemenu'
.fr-col
- if @dossier.avis_for_expert(current_expert).present?
= render partial: 'experts/avis/shared/list', locals: { avis: @dossier.avis_for_expert(current_expert), avis_seen_at: nil }

View file

@ -3,6 +3,10 @@
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }
.container
.fr-grid-row
.fr-col.fr-col-12.fr-col-md-3
= render partial: 'sidemenu'
.fr-col
%section.give-avis
%h1.tab-title Donner votre avis
%h2.claimant
@ -50,8 +54,8 @@
.send-wrapper
= f.submit 'Envoyer votre avis', class: 'fr-btn'
- if !@dossier.termine?
= render partial: "experts/avis/shared/form", locals: { url: avis_expert_avis_path(@avis.procedure, @avis), linked_dossiers: @dossier.linked_dossiers_for(current_expert), must_be_confidentiel: @avis.confidentiel?, avis: @new_avis }
-# - if !@dossier.termine?
-# = render partial: "experts/avis/shared/form", locals: { url: avis_expert_avis_path(@avis.procedure, @avis), linked_dossiers: @dossier.linked_dossiers_for(current_expert), must_be_confidentiel: @avis.confidentiel?, avis: @new_avis }
- if @dossier.avis_for_expert(current_expert).present?
= render partial: 'experts/avis/shared/list', locals: { avis: @dossier.avis_for_expert(current_expert), avis_seen_at: nil }
-# - if @dossier.avis_for_expert(current_expert).present?
-# = render partial: 'experts/avis/shared/list', locals: { avis: @dossier.avis_for_expert(current_expert), avis_seen_at: nil }

View file

@ -355,6 +355,7 @@ Rails.application.routes.draw do
get '', action: 'procedure', on: :collection, as: :procedure
member do
get 'instruction'
get 'avis_list'
get 'messagerie'
post 'commentaire' => 'avis#create_commentaire'
post 'avis' => 'avis#create_avis'