split form and avis answers in 2 views for experts and add sidemenu
This commit is contained in:
parent
603d66e020
commit
c51e6aa2e6
7 changed files with 81 additions and 44 deletions
|
@ -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)
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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))
|
||||
|
|
17
app/views/experts/avis/_sidemenu.html.haml
Normal file
17
app/views/experts/avis/_sidemenu.html.haml
Normal 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
|
11
app/views/experts/avis/avis_list.html.haml
Normal file
11
app/views/experts/avis/avis_list.html.haml
Normal 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 }
|
|
@ -3,55 +3,59 @@
|
|||
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }
|
||||
|
||||
.container
|
||||
%section.give-avis
|
||||
%h1.tab-title Donner votre avis
|
||||
%h2.claimant
|
||||
Demandeur :
|
||||
%span.email.font-weight-normal= safe_claimant_email(@avis.claimant)
|
||||
%span.date.font-weight-normal Demande d’avis envoyée le #{l(@avis.created_at, format: '%d/%m/%y')}
|
||||
%p.introduction= @avis.introduction
|
||||
.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
|
||||
Demandeur :
|
||||
%span.email.font-weight-normal= safe_claimant_email(@avis.claimant)
|
||||
%span.date.font-weight-normal Demande d’avis envoyée le #{l(@avis.created_at, format: '%d/%m/%y')}
|
||||
%p.introduction= @avis.introduction
|
||||
|
||||
- if @avis.introduction_file.attached?
|
||||
= render Attachment::ShowComponent.new(attachment: @avis.introduction_file.attachment)
|
||||
%br/
|
||||
= render Attachment::DeleteFormComponent.new
|
||||
= form_for @avis, url: expert_avis_path(@avis.procedure, @avis), html: { data: { controller: 'persisted-form', persisted_form_key_value: dom_id(@avis) }, multipart: true } do |f|
|
||||
- if @avis.introduction_file.attached?
|
||||
= render Attachment::ShowComponent.new(attachment: @avis.introduction_file.attachment)
|
||||
%br/
|
||||
= render Attachment::DeleteFormComponent.new
|
||||
= form_for @avis, url: expert_avis_path(@avis.procedure, @avis), html: { data: { controller: 'persisted-form', persisted_form_key_value: dom_id(@avis) }, multipart: true } do |f|
|
||||
|
||||
- if @avis.question_label
|
||||
.fr-form-group
|
||||
%fieldset.fr-fieldset.fr-fieldset--inline
|
||||
%legend#radio-inline-legend.fr-fieldset__legend.fr-text--regular
|
||||
= @avis.question_label
|
||||
.fr-fieldset__content
|
||||
.fr-radio-group
|
||||
= f.radio_button :question_answer, true
|
||||
= f.label :question_answer, 'oui', value: true, class: 'fr-label'
|
||||
- if @avis.question_label
|
||||
.fr-form-group
|
||||
%fieldset.fr-fieldset.fr-fieldset--inline
|
||||
%legend#radio-inline-legend.fr-fieldset__legend.fr-text--regular
|
||||
= @avis.question_label
|
||||
.fr-fieldset__content
|
||||
.fr-radio-group
|
||||
= f.radio_button :question_answer, true
|
||||
= f.label :question_answer, 'oui', value: true, class: 'fr-label'
|
||||
|
||||
.fr-radio-group
|
||||
= f.radio_button :question_answer, false
|
||||
= f.label :question_answer, 'non', value: false, class: 'fr-label'
|
||||
.fr-radio-group
|
||||
= f.radio_button :question_answer, false
|
||||
= f.label :question_answer, 'non', value: false, class: 'fr-label'
|
||||
|
||||
.fr-select-group
|
||||
= f.text_area :answer, rows: 3, class: 'fr-input', placeholder: 'Votre avis', required: true
|
||||
.fr-select-group
|
||||
= f.text_area :answer, rows: 3, class: 'fr-input', placeholder: 'Votre avis', required: true
|
||||
|
||||
|
||||
|
||||
= render Attachment::EditComponent.new(attached_file: @avis.piece_justificative_file, view_as: :download)
|
||||
= render Attachment::EditComponent.new(attached_file: @avis.piece_justificative_file, view_as: :download)
|
||||
|
||||
.flex.justify-between.align-baseline
|
||||
%p.confidentiel.flex
|
||||
- if @avis.confidentiel?
|
||||
%span.icon.lock
|
||||
%span
|
||||
Cet avis est confidentiel et n’est pas affiché aux autres experts consultés
|
||||
- else
|
||||
%span
|
||||
Cet avis est partagé avec les autres experts
|
||||
.send-wrapper
|
||||
= f.submit 'Envoyer votre avis', class: 'fr-btn'
|
||||
.flex.justify-between.align-baseline
|
||||
%p.confidentiel.flex
|
||||
- if @avis.confidentiel?
|
||||
%span.icon.lock
|
||||
%span
|
||||
Cet avis est confidentiel et n’est pas affiché aux autres experts consultés
|
||||
- else
|
||||
%span
|
||||
Cet avis est partagé avec les autres experts
|
||||
.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 }
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue