add two more fields for procedure description what et and for_who

This commit is contained in:
Lisa Durand 2023-05-22 15:36:48 +02:00
parent 174b0edaa1
commit 4a51a9a351
12 changed files with 104 additions and 78 deletions

View file

@ -31,23 +31,6 @@ $procedure-description-line-height: 22px;
font-size: 12px;
}
.procedure-title {
font-size: 26px;
margin: 0 0 20px 0;
text-align: center;
@media (min-width: $procedure-context-breakpoint) {
margin: 50px 0 32px;
font-size: 30px;
text-align: left;
}
}
.procedure-configuration {
font-size: 20px;
margin-bottom: 32px;
}
.procedure-configuration--auto-archive {
cursor: pointer;
@ -104,7 +87,6 @@ $procedure-description-line-height: 22px;
.procedure-logos {
display: flex;
justify-content: space-around;
align-items: center;
margin-bottom: 20px;
@ -116,16 +98,8 @@ $procedure-description-line-height: 22px;
max-width: 100%;
max-height: 50px;
// Fix Chrome flexbox issue
// See https://github.com/philipwalton/flexbugs/issues/225
width: 100%;
height: 100%;
min-width: 0;
object-fit: contain;
@media (min-width: $procedure-context-breakpoint) {
max-width: 500px;
max-height: 130px;
max-height: 90px;
}
}
}

View file

@ -457,6 +457,8 @@ module Administrateurs
editable_params = [
:libelle,
:description,
:description_for_who,
:description_what,
:organisation,
:direction,
:lien_site_web,

View file

@ -92,10 +92,12 @@ module Users
def identite
@dossier = dossier
@user = current_user
@hide_description = true
end
def update_identite
@dossier = dossier
@hide_description = true
if @dossier.individual.update(individual_params)
@dossier.update!(autorisation_donnees: true, identity_updated_at: Time.zone.now)
@ -110,10 +112,12 @@ module Users
def siret
@dossier = dossier
@hide_description = true
end
def update_siret
@dossier = dossier
@hide_description = true
# We use the user as the holder model object for the siret value
# (so that we can restore it on the form in case of error).

View file

@ -11,7 +11,11 @@ function syncInputToElement(fromSelector, toSelector) {
function syncFormToPreview() {
syncInputToElement('#procedure_libelle', '.procedure-title');
syncInputToElement('#procedure_description', '.procedure-description-body');
syncInputToElement('#procedure_description_what', '.js_description_what p');
syncInputToElement('#procedure_description_for_who', '.js_description_for_who p');
}
delegate('input', '.procedure-form #procedure_libelle', syncFormToPreview);
delegate('input', '.procedure-form #procedure_description', syncFormToPreview);
delegate('input', '.procedure-form #procedure_description_what', syncFormToPreview);
delegate('input', '.procedure-form #procedure_description_for_who', syncFormToPreview);

View file

@ -16,6 +16,8 @@
# closed_at :datetime
# declarative_with_state :string
# description :string
# description_for_who :string
# description_what :string
# dossiers_count_computed_at :datetime
# duree_conservation_dossiers_dans_ds :integer
# duree_conservation_etendue_par_ds :boolean default(FALSE), not null
@ -280,7 +282,8 @@ class Procedure < ApplicationRecord
}
validates :libelle, presence: true, allow_blank: false, allow_nil: false
validates :description, presence: true, allow_blank: false, allow_nil: false
validates :description, presence: true, allow_blank: false, allow_nil: false, if: -> { description_what.nil? && description_for_who.nil?}
validates :description_what, :description_for_who, presence: true, allow_blank: false, allow_nil: false, if: -> { description.nil?}
validates :administrateurs, presence: true
validates :lien_site_web, presence: true, if: :publiee?
validates :draft_types_de_champ_public,

View file

@ -6,12 +6,17 @@
= f.label :libelle do
Titre de la démarche
%span.mandatory *
= f.text_field :libelle, class: 'form-control', placeholder: 'Titre', required: true
= f.text_field :libelle, class: 'form-control', placeholder: 'Titre'
= f.label :description do
Description
= f.label :description_what do
Quel est lobjet de la démarche ?
%span.mandatory *
= f.text_area :description, rows: '6', placeholder: 'Description de la démarche, destinataires, etc. ', class: 'form-control', required: true
= f.text_area :description_what, rows: '6', placeholder: 'Décrivez en quelques lignes le contexte, la finalité etc.', class: 'form-control'
= f.label :description_for_who do
À qui sadresse la démarche ?
%span.mandatory *
= f.text_area :description_for_who, rows: '6', placeholder: 'Décrivez en quelques lignes les destinataires finaux de la démarche, les critères déligibilité sil y en a, les pré-requis, etc.', class: 'form-control'
%h3.header-subsection Logo de la démarche
= render Attachment::EditComponent.new(attached_file: @procedure.logo, view_as: :link)

View file

@ -2,13 +2,14 @@
.commencer.form
- if !user_signed_in?
%h2.huge-title= t('views.commencer.show.start_procedure')
= render partial: 'shared/france_connect_login', locals: { url: commencer_france_connect_path(path: @procedure.path, prefill_token: @prefilled_dossier&.prefill_token) }
= link_to commencer_sign_up_path(path: @procedure.path, prefill_token: @prefilled_dossier&.prefill_token), class: 'fr-btn fr-btn--lg fr-my-2w' do
= t('views.shared.account.create')
%span.optional-on-small-screens.fr-ml-1v
#{APPLICATION_NAME}
= link_to t('views.shared.account.already_user'), commencer_sign_in_path(path: @procedure.path, prefill_token: @prefilled_dossier&.prefill_token), class: 'fr-btn fr-btn--secondary fr-btn--lg fr-my-2w'
= render Dsfr::CalloutComponent.new(title: t("views.commencer.show.start_procedure")) do |c|
- c.body do
= render partial: 'shared/france_connect_login', locals: { url: commencer_france_connect_path(path: @procedure.path, prefill_token: @prefilled_dossier&.prefill_token) }
= link_to commencer_sign_up_path(path: @procedure.path, prefill_token: @prefilled_dossier&.prefill_token), class: 'fr-btn fr-mb-2w fr-mr-2w' do
= t('views.shared.account.create')
%span.optional-on-small-screens.fr-ml-1v
#{APPLICATION_NAME}
= link_to t('views.shared.account.already_user'), commencer_sign_in_path(path: @procedure.path, prefill_token: @prefilled_dossier&.prefill_token), class: 'fr-btn fr-btn--secondary fr-mb-2w'
- else
- revision = @revision.draft? ? @revision : @procedure.revisions.where.not(id: @procedure.draft_revision_id)
@ -17,37 +18,42 @@
- not_drafts = dossiers.merge(Dossier.state_not_brouillon)
- if @prefilled_dossier
%h2.huge-title= t('views.commencer.show.prefilled_draft')
%p= t('views.commencer.show.prefilled_draft_detail_html', time_ago: time_ago_in_words(@prefilled_dossier.created_at), procedure: @procedure.libelle)
= link_to t('views.commencer.show.go_to_prefilled_file'), url_for_dossier(@prefilled_dossier), class: 'fr-btn fr-btn--lg fr-my-2w'
= render Dsfr::CalloutComponent.new(title: t("views.commencer.show.prefilled_draft")) do |c|
- c.body do
%p= t('views.commencer.show.prefilled_draft_detail_html', time_ago: time_ago_in_words(@prefilled_dossier.created_at), procedure: @procedure.libelle)
= link_to t('views.commencer.show.go_to_prefilled_file'), url_for_dossier(@prefilled_dossier), class: 'fr-btn fr-mb-2w'
- elsif dossiers.empty?
= link_to t('views.commencer.show.start_procedure'), url_for_new_dossier(@revision), class: 'fr-btn fr-btn--lg fr-my-2w'
= link_to t('views.commencer.show.start_procedure'), url_for_new_dossier(@revision), class: 'fr-btn fr-mb-2w'
- elsif drafts.size == 1 && not_drafts.empty?
- dossier = drafts.first
%h2.huge-title= t('views.commencer.show.already_draft')
%p
= t('views.commencer.show.already_draft_detail_html', time_ago: time_ago_in_words(dossier.created_at), procedure: dossier.procedure.libelle)
= link_to t('views.commencer.show.continue_file'), url_for_dossier(dossier), class: 'fr-btn fr-btn--lg fr-my-2w'
= link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: 'fr-btn fr-btn--lg fr-btn--secondary fr-my-2w'
= render Dsfr::CalloutComponent.new(title: t("views.commencer.show.already_draft")) do |c|
- c.body do
%p
= t('views.commencer.show.already_draft_detail_html', time_ago: time_ago_in_words(dossier.created_at), procedure: dossier.procedure.libelle)
= link_to t('views.commencer.show.continue_file'), url_for_dossier(dossier), class: 'fr-btn fr-mb-2w'
= link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: 'fr-btn fr-btn--secondary fr-mb-2w'
- elsif not_drafts.size == 1
- dossier = not_drafts.first
%h2.huge-title= t('views.commencer.show.already_not_draft')
%p
= t('views.commencer.show.already_not_draft_detail_html', time_ago: time_ago_in_words(dossier.depose_at), procedure: dossier.procedure.libelle)
= link_to t('views.commencer.show.show_my_submitted_file'), url_for_dossier(dossier), class: 'fr-btn fr-btn--lg fr-my-2w'
= link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: 'fr-btn fr-btn--lg fr-btn--secondary fr-my-2w'
= render Dsfr::CalloutComponent.new(title: t("views.commencer.show.already_not_draft")) do |c|
- c.body do
%p
= t('views.commencer.show.already_not_draft_detail_html', time_ago: time_ago_in_words(dossier.depose_at), procedure: dossier.procedure.libelle)
= link_to t('views.commencer.show.show_my_submitted_file'), url_for_dossier(dossier), class: 'fr-btn fr-mb-2w'
= link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: 'fr-btn fr-btn--secondary fr-mb-2w'
- else
%h2.huge-title= t('views.commencer.show.existing_dossiers')
= link_to t('views.commencer.show.show_dossiers'), dossiers_path, class: "fr-btn fr-btn--lg fr-my-2w"
= link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: "fr-btn fr-btn--lg fr-btn--secondary fr-my-2w"
= render Dsfr::CalloutComponent.new(title: t("views.commencer.show.existing_dossiers")) do |c|
- c.body do
= link_to t('views.commencer.show.show_dossiers'), dossiers_path, class: "fr-btn fr-mb-2w"
= link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: "fr-btn fr-btn--secondary fr-mb-2w"
- if @procedure.feature_enabled?(:dossier_pdf_vide)
%hr
%p= t('views.commencer.show.want_empty_pdf', service: @procedure&.service&.nom, adresse: @procedure&.service&.adresse)
%br
= link_to t('views.commencer.show.download_empty_pdf'), commencer_dossier_vide_for_revision_path(@revision), class: "fr-btn fr-btn--lg fr-btn--secondary fr-my-2w"
= link_to t('views.commencer.show.download_empty_pdf'), commencer_dossier_vide_for_revision_path(@revision), class: "fr-btn fr-btn--secondary fr-mb-2w"

View file

@ -1,17 +1,14 @@
- procedure = @procedure || @dossier&.procedure || nil
- content_for :content do
.two-columns.procedure-context
.columns-container
.column.procedure-preview
- if procedure
= render partial: 'shared/procedure_description', locals: { procedure: procedure }
- else
= render partial: 'layouts/commencer/no_procedure'
.column.procedure-context-content
= yield
.fr-container.fr-mt-5w
.fr-grid-row
.fr-col-12.fr-col-md-8.fr-col-offset-md-2
.procedure-preview.fr-mb-5w
- if procedure
= render partial: 'shared/procedure_description', locals: { procedure: procedure }
- else
= render partial: 'layouts/commencer/no_procedure'
- content_for :footer do
- if procedure

View file

@ -3,25 +3,46 @@
- if procedure.service.present?
- procedure_logo_alt = "#{procedure.service.nom} #{procedure.service.organisme}"
= image_tag procedure.logo_url, alt: procedure_logo_alt
- if procedure.euro_flag
= image_tag("flag_of_europe.svg", id: 'euro_flag', class: (!procedure.euro_flag ? "hidden" : ""))
%h1.procedure-title
%h1.procedure-title.fr-h2
= procedure.libelle
- if procedure.persisted? && procedure.estimated_duration_visible?
%p.procedure-configuration.procedure-configuration--fill-duration
%span.icon.clock
= t('shared.procedure_description.estimated_fill_duration', estimated_minutes: estimated_fill_duration_minutes(procedure))
%p
%small
%span.fr-icon-timer-line
= t('shared.procedure_description.estimated_fill_duration', estimated_minutes: estimated_fill_duration_minutes(procedure))
= yield
- if procedure.auto_archive_on
%details.procedure-configuration.procedure-configuration--auto-archive
%details.procedure-configuration--auto-archive
%summary
%span.icon.edit
%span.procedure-auto-archive-title Date limite : #{procedure_auto_archive_date(procedure)}
%p Vous pouvez déposer vos dossiers jusquau #{procedure_auto_archive_datetime(procedure)}.
.procedure-description
.procedure-description-body.read-more-enabled.read-more-collapsed{ tabindex: "0", role: "region", "aria-label": t('views.users.dossiers.identite.description') }
= h render SimpleFormatComponent.new(procedure.description, allow_a: true)
= button_tag "Afficher la description complète", class: 'button read-more-button'
- if !@hide_description
- if procedure.description.present?
.procedure-description
.procedure-description-body.read-more-enabled.read-more-collapsed{ tabindex: "0", role: "region", "aria-label": t('views.users.dossiers.identite.description') }
= h render SimpleFormatComponent.new(procedure.description, allow_a: true)
= button_tag "Afficher la description complète", class: 'button read-more-button'
- else
.fr-accordions-group
%section.fr-accordion
%h3.fr-accordion__title
%button.fr-accordion__btn{"aria-controls" => "accordion-114", "aria-expanded" => "true"} Quel est lobjet de cette démarche ?
#accordion-114.fr-collapse.js_description_what
= h render SimpleFormatComponent.new(procedure.description_what, allow_a: true)
%section.fr-accordion
%h3.fr-accordion__title
%button.fr-accordion__btn{"aria-controls" => "accordion-115", "aria-expanded" => "false"} À qui sadresse la démarche ?
#accordion-115.fr-collapse.js_description_for_who
= h render SimpleFormatComponent.new(procedure.description_for_who, allow_a: true)

View file

@ -8,6 +8,8 @@ en:
procedure:
path: Public link
organisation: Service
description_for_who: For who
description_what: Procedure subject
duree_conservation_dossiers_dans_ds: Duration files will be kept
max_duree_conservation_dossiers_dans_ds: Max duration allowed to keep files
aasm_state:

View file

@ -8,10 +8,12 @@ fr:
procedure:
path: Lien public
organisation: Organisme
description_for_who: À qui sadresse la démarche
description_what: Objet de la démarche
duree_conservation_dossiers_dans_ds: Durée de conservation des dossiers sur demarches-simplifiees.fr (choisi par un usager)
max_duree_conservation_dossiers_dans_ds: Durée de conservation des dossiers maximum (autorisé par un super admin de DS)
id: Id
libelle: Libelle
libelle: Titre de la démarche
published_at: 'Date de publication'
aasm_state: 'Statut'
admin_count: 'Nb administrateurs'

View file

@ -0,0 +1,6 @@
class AddTwoFieldsForDescriptionToProcedure < ActiveRecord::Migration[7.0]
def change
add_column :procedures, :description_what, :string
add_column :procedures, :description_for_who, :string
end
end