create component for sidemenu and add locales for raw text
This commit is contained in:
parent
4a2982dc37
commit
a01564adcd
13 changed files with 126 additions and 76 deletions
15
app/components/dsfr/sidemenu_component.rb
Normal file
15
app/components/dsfr/sidemenu_component.rb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
class Dsfr::SidemenuComponent < ApplicationComponent
|
||||||
|
renders_many :links, "LinkComponent"
|
||||||
|
|
||||||
|
class LinkComponent < ApplicationComponent
|
||||||
|
attr_reader :name, :url
|
||||||
|
def initialize(name:, url:)
|
||||||
|
@name = name
|
||||||
|
@url = url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def active?(url)
|
||||||
|
current_page?(url)
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
fr:
|
||||||
|
btn_collapse_text: In this section
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
fr:
|
||||||
|
btn_collapse_text: Dans cette rubrique
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
%nav.fr-sidemenu{ "aria-labelledby" => "fr-sidemenu-title" }
|
||||||
|
.fr-sidemenu__inner
|
||||||
|
%button.fr-sidemenu__btn{ "aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: "" }= t('.btn_collapse_text')
|
||||||
|
#fr-sidemenu-wrapper.fr-collapse
|
||||||
|
%ul.fr-sidemenu__list
|
||||||
|
- links.each do |link|
|
||||||
|
%li{ class: "fr-sidemenu__item fr-sidemenu__item#{active?(link.url) ? '--active' : ''}" }
|
||||||
|
= link_to link.name, link.url, class: 'fr-sidemenu__link', 'aria-current': active?(link.url) ? 'page' : nil, target: "_self"
|
|
@ -1,21 +1,2 @@
|
||||||
%nav.fr-sidemenu{ "aria-labelledby" => "fr-sidemenu-title" }
|
= render(Dsfr::SidemenuComponent.new) do |component|
|
||||||
.fr-sidemenu__inner
|
- component.with_links([{ name: t('helpers.sidemenu.give_avis'), url: instruction_expert_avis_path(@avis.procedure, @avis) }, { name: t('helpers.sidemenu.see_avis'), url: avis_list_expert_avis_path(@avis.procedure, @avis) }, { name: t('helpers.sidemenu.ask_new_avis'), url: avis_new_expert_avis_path(@avis.procedure, @avis) }])
|
||||||
%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
|
|
||||||
- url = instruction_expert_avis_path(@avis.procedure, @avis)
|
|
||||||
- current_page = current_page?(url)
|
|
||||||
%li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" }
|
|
||||||
%a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil, href: url, target: "_self" } Donner votre avis
|
|
||||||
|
|
||||||
- if @dossier.avis_for_expert(current_expert).present?
|
|
||||||
- url = avis_list_expert_avis_path(@avis.procedure, @avis)
|
|
||||||
- current_page = current_page?(url)
|
|
||||||
%li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" }
|
|
||||||
%a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil,href: url, target: "_self" } Voir les avis
|
|
||||||
|
|
||||||
- if !@dossier.termine?
|
|
||||||
- url = avis_new_expert_avis_path(@avis.procedure, @avis)
|
|
||||||
- current_page = current_page?(url)
|
|
||||||
%li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" }
|
|
||||||
%a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil,href: url, target: "_self" } Demander un nouvel avis
|
|
||||||
|
|
|
@ -9,3 +9,9 @@
|
||||||
.fr-col
|
.fr-col
|
||||||
- if @dossier.avis_for_expert(current_expert).present?
|
- 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 }
|
= render partial: 'experts/avis/shared/list', locals: { avis: @dossier.avis_for_expert(current_expert), avis_seen_at: nil }
|
||||||
|
|
||||||
|
- else
|
||||||
|
%h2.empty-text
|
||||||
|
= t('helpers.information_text.empty_text')
|
||||||
|
%p.empty-text-details
|
||||||
|
= t('helpers.information_text.empty_text_detail')
|
||||||
|
|
|
@ -9,3 +9,8 @@
|
||||||
.fr-col
|
.fr-col
|
||||||
- if !@dossier.termine?
|
- 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 }
|
= 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 }
|
||||||
|
- else
|
||||||
|
%h2.empty-text
|
||||||
|
= t('helpers.information_text.no_new_avis_text')
|
||||||
|
%p.empty-text-details
|
||||||
|
= t('helpers.information_text.no_new_avis_text_detail')
|
||||||
|
|
|
@ -7,49 +7,55 @@
|
||||||
.fr-col.fr-col-12.fr-col-md-3
|
.fr-col.fr-col-12.fr-col-md-3
|
||||||
= render partial: 'sidemenu'
|
= render partial: 'sidemenu'
|
||||||
.fr-col
|
.fr-col
|
||||||
%section.give-avis
|
- if !@dossier.termine?
|
||||||
%h1.tab-title Donner votre avis
|
%section.give-avis
|
||||||
%h2.claimant
|
%h1.tab-title Donner votre avis
|
||||||
Demandeur :
|
%h2.claimant
|
||||||
%span.email.font-weight-normal= safe_claimant_email(@avis.claimant)
|
Demandeur :
|
||||||
%span.date.font-weight-normal Demande d’avis envoyée le #{l(@avis.created_at, format: '%d/%m/%y')}
|
%span.email.font-weight-normal= safe_claimant_email(@avis.claimant)
|
||||||
%p.introduction= @avis.introduction
|
%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?
|
- if @avis.introduction_file.attached?
|
||||||
= render Attachment::ShowComponent.new(attachment: @avis.introduction_file.attachment)
|
= render Attachment::ShowComponent.new(attachment: @avis.introduction_file.attachment)
|
||||||
%br/
|
%br/
|
||||||
= render Attachment::DeleteFormComponent.new
|
= 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|
|
= 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
|
- if @avis.question_label
|
||||||
.fr-form-group
|
.fr-form-group
|
||||||
%fieldset.fr-fieldset.fr-fieldset--inline
|
%fieldset.fr-fieldset.fr-fieldset--inline
|
||||||
%legend#radio-inline-legend.fr-fieldset__legend.fr-text--regular
|
%legend#radio-inline-legend.fr-fieldset__legend.fr-text--regular
|
||||||
= @avis.question_label
|
= @avis.question_label
|
||||||
.fr-fieldset__content
|
.fr-fieldset__content
|
||||||
.fr-radio-group
|
.fr-radio-group
|
||||||
= f.radio_button :question_answer, true
|
= f.radio_button :question_answer, true
|
||||||
= f.label :question_answer, 'oui', value: true, class: 'fr-label'
|
= f.label :question_answer, 'oui', value: true, class: 'fr-label'
|
||||||
|
|
||||||
.fr-radio-group
|
.fr-radio-group
|
||||||
= f.radio_button :question_answer, false
|
= f.radio_button :question_answer, false
|
||||||
= f.label :question_answer, 'non', value: false, class: 'fr-label'
|
= f.label :question_answer, 'non', value: false, class: 'fr-label'
|
||||||
|
|
||||||
.fr-select-group
|
.fr-select-group
|
||||||
= f.text_area :answer, rows: 3, class: 'fr-input', placeholder: 'Votre avis', required: true
|
= 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
|
.flex.justify-between.align-baseline
|
||||||
%p.confidentiel.flex
|
%p.confidentiel.flex
|
||||||
- if @avis.confidentiel?
|
- if @avis.confidentiel?
|
||||||
%span.icon.lock
|
%span.icon.lock
|
||||||
%span
|
%span
|
||||||
Cet avis est confidentiel et n’est pas affiché aux autres experts consultés
|
Cet avis est confidentiel et n’est pas affiché aux autres experts consultés
|
||||||
- else
|
- else
|
||||||
%span
|
%span
|
||||||
Cet avis est partagé avec les autres experts
|
Cet avis est partagé avec les autres experts
|
||||||
.send-wrapper
|
.send-wrapper
|
||||||
= f.submit 'Envoyer votre avis', class: 'fr-btn'
|
= f.submit 'Envoyer votre avis', class: 'fr-btn'
|
||||||
|
- else
|
||||||
|
%h2.empty-text
|
||||||
|
= t('helpers.information_text.no_new_avis_text')
|
||||||
|
%p.empty-text-details
|
||||||
|
= t('helpers.information_text.no_new_avis_text_detail')
|
||||||
|
|
|
@ -1,14 +1,2 @@
|
||||||
%nav.fr-sidemenu{ "aria-labelledby" => "fr-sidemenu-title" }
|
= render(Dsfr::SidemenuComponent.new) do |component|
|
||||||
.fr-sidemenu__inner
|
- component.with_links([{ name: t('helpers.sidemenu.see_avis'), url: avis_instructeur_dossier_path(@dossier.procedure, @dossier) }, { name: t('helpers.sidemenu.ask_avis'), url: avis_new_instructeur_dossier_path(@dossier.procedure, @dossier) }])
|
||||||
%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
|
|
||||||
- url = avis_instructeur_dossier_path(@dossier.procedure, @dossier)
|
|
||||||
- current_page = current_page?(url)
|
|
||||||
%li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" }
|
|
||||||
%a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil,href: url, target: "_self" } Voir les avis
|
|
||||||
|
|
||||||
- url = avis_new_instructeur_dossier_path(@dossier.procedure, @dossier)
|
|
||||||
- current_page = current_page?(url)
|
|
||||||
%li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" }
|
|
||||||
%a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil, href: url, target: "_self" } Demander un avis
|
|
||||||
|
|
|
@ -11,5 +11,7 @@
|
||||||
= render partial: 'instructeurs/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at }
|
= render partial: 'instructeurs/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at }
|
||||||
|
|
||||||
- else
|
- else
|
||||||
%h2.empty-text Aucun avis.
|
%h2.empty-text
|
||||||
%p.empty-text-details Aucun avis n’a été demandé sur ce dossier.
|
= t('helpers.information_text.empty_text')
|
||||||
|
%p.empty-text-details
|
||||||
|
= t('helpers.information_text.empty_text_detail')
|
||||||
|
|
|
@ -11,4 +11,12 @@
|
||||||
- if @dossier.procedure.allow_expert_review
|
- if @dossier.procedure.allow_expert_review
|
||||||
= render partial: "instructeurs/avis/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, @dossier), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: false, avis: @avis }
|
= render partial: "instructeurs/avis/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, @dossier), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: false, avis: @avis }
|
||||||
- else
|
- else
|
||||||
%p Cette démarche n’autorise pas la demande d’avis à un expert. Veuillez contacter votre administrateur
|
%h2.empty-text
|
||||||
|
= t('helpers.information_text.unauthorized_avis_text')
|
||||||
|
%p.empty-text-details
|
||||||
|
= t('helpers.information_text.unauthorized_avis_text_detail')
|
||||||
|
- else
|
||||||
|
%h2.empty-text
|
||||||
|
= t('helpers.information_text.no_new_avis_text')
|
||||||
|
%p.empty-text-details
|
||||||
|
= t('helpers.information_text.no_new_avis_text_detail')
|
||||||
|
|
|
@ -26,3 +26,15 @@ en:
|
||||||
confirmation:
|
confirmation:
|
||||||
revoke: "Would you like to revoke the opinion request to %{email} ?"
|
revoke: "Would you like to revoke the opinion request to %{email} ?"
|
||||||
remind: "Would you like to remind %{email} ?"
|
remind: "Would you like to remind %{email} ?"
|
||||||
|
sidemenu:
|
||||||
|
give_avis: Give your opinion
|
||||||
|
see_avis: Read opinions
|
||||||
|
ask_avis: Ask for an opinion
|
||||||
|
ask_new_avis: Ask for a new opinion
|
||||||
|
information_text:
|
||||||
|
no_new_avis_text: The file has been proceed
|
||||||
|
no_new_avis_text_detail: Opinion requests are closed
|
||||||
|
unauthorized_avis_text: This procedure does not allowed expert opinions
|
||||||
|
unauthorized_avis_text_detail: Would you please contact your administrator
|
||||||
|
empty_text: No opinion.
|
||||||
|
empty_text_detail: No opinion available on this file
|
||||||
|
|
|
@ -26,3 +26,15 @@ fr:
|
||||||
confirmation:
|
confirmation:
|
||||||
revoke: "Souhaitez-vous révoquer la demande d’avis à %{email} ?"
|
revoke: "Souhaitez-vous révoquer la demande d’avis à %{email} ?"
|
||||||
remind: "Souhaitez-vous relancer %{email} ?"
|
remind: "Souhaitez-vous relancer %{email} ?"
|
||||||
|
sidemenu:
|
||||||
|
give_avis: Donner votre avis
|
||||||
|
see_avis: Voir les avis
|
||||||
|
ask_avis: Demander un avis
|
||||||
|
ask_new_avis: Demander un nouvel avis
|
||||||
|
information_text:
|
||||||
|
no_new_avis_text: Le dossier a été traité
|
||||||
|
no_new_avis_text_detail: Les demandes d'avis ne sont plus autorisées
|
||||||
|
unauthorized_avis_text: Cette démarche n’autorise pas la demande d’avis à un expert.
|
||||||
|
unauthorized_avis_text_detail: Veuillez contacter votre administrateur
|
||||||
|
empty_text: Aucun avis.
|
||||||
|
empty_text_detail: Aucun avis n’est disponible sur ce dossier.
|
||||||
|
|
Loading…
Reference in a new issue