amelioration(attestation.et.mail): desactive les tags sur les champs conditionnés et informe l'usager que ca arrivera
This commit is contained in:
parent
ef389eab41
commit
dd74834689
6 changed files with 39 additions and 9 deletions
|
@ -269,12 +269,12 @@ module TagsSubstitutionConcern
|
|||
end
|
||||
|
||||
def champ_public_tags(dossier: nil)
|
||||
types_de_champ = (dossier || procedure.active_revision).types_de_champ_public
|
||||
types_de_champ = (dossier || procedure.active_revision).types_de_champ_public.not_condition
|
||||
types_de_champ_tags(types_de_champ, Dossier::SOUMIS)
|
||||
end
|
||||
|
||||
def champ_private_tags(dossier: nil)
|
||||
types_de_champ = (dossier || procedure.active_revision).types_de_champ_private
|
||||
types_de_champ = (dossier || procedure.active_revision).types_de_champ_private.not_condition
|
||||
types_de_champ_tags(types_de_champ, Dossier::INSTRUCTION_COMMENCEE)
|
||||
end
|
||||
|
||||
|
|
|
@ -164,6 +164,7 @@ class TypeDeChamp < ApplicationRecord
|
|||
scope :private_only, -> { where(private: true) }
|
||||
scope :repetition, -> { where(type_champ: type_champs.fetch(:repetition)) }
|
||||
scope :not_repetition, -> { where.not(type_champ: type_champs.fetch(:repetition)) }
|
||||
scope :not_condition, -> { where(condition: nil) }
|
||||
scope :fillable, -> { where.not(type_champ: [type_champs.fetch(:header_section), type_champs.fetch(:explication)]) }
|
||||
|
||||
scope :dubious, -> {
|
||||
|
|
|
@ -2,10 +2,15 @@
|
|||
|
||||
= render Dsfr::InputComponent.new(form: f, attribute: :body, input_type: :text_area, opts: { rows: '6', placeholder: 'Description de la démarche, destinataires, etc. '})
|
||||
|
||||
#tags-table
|
||||
%h2.add-tag-title
|
||||
#tags-table.clearfix.fr-mt-3w
|
||||
%h2.fr-h3
|
||||
Insérer une balise
|
||||
%p.notice
|
||||
|
||||
= render Dsfr::AlertComponent.new(state: :info, title: "Balises sur le conditionnel", heading_level: 'h3') do |c|
|
||||
- c.body do
|
||||
Les balises pour les champs conditionnés ne sont pour le moment pas supportées.
|
||||
|
||||
%p.notice.fr-mt-3w
|
||||
Copiez-collez les balises ci-dessous pour afficher automatiquement l’information souhaitée.
|
||||
.head
|
||||
.tag Balise
|
||||
|
|
|
@ -2,11 +2,18 @@
|
|||
|
||||
= render Dsfr::InputComponent.new(form: f, attribute: :rich_body, input_type: :rich_text_area, opts: { class: 'fr-mb-4vh'})
|
||||
|
||||
#tags-table{ 'data-controller': 'trix' }
|
||||
%h2.add-tag-title
|
||||
|
||||
#tags-table.clearfix.fr-mt-3w{ 'data-controller': 'trix' }
|
||||
%h2.fr-h3
|
||||
Insérer une balise
|
||||
%p.notice
|
||||
|
||||
= render Dsfr::AlertComponent.new(state: :info, title: "Balises sur le conditionnel", heading_level: 'h3') do |c|
|
||||
- c.body do
|
||||
Les balises pour les champs conditionnés ne sont pour le moment pas supportées.
|
||||
|
||||
%p.notice.fr-mt-3w
|
||||
Copiez-collez les balises ci-dessous pour afficher automatiquement l’information souhaitée.
|
||||
|
||||
.head
|
||||
.tag Balise
|
||||
.description Description
|
||||
|
|
|
@ -115,7 +115,7 @@ describe Administrateurs::AttestationTemplatesController, type: :controller do
|
|||
expect(procedure.attestation_template.logo.download).to eq(logo2.read)
|
||||
expect(procedure.attestation_template.signature.download).to eq(signature2.read)
|
||||
expect(response).to redirect_to edit_admin_procedure_attestation_template_path(procedure)
|
||||
expect(flash.notice).to eq("Le model de l’attestation a bien été enregistrée")
|
||||
expect(flash.notice).to eq("Le modèle de l’attestation a bien été enregistré")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -465,6 +465,23 @@ describe TagsSubstitutionConcern, type: :model do
|
|||
|
||||
it { is_expected.to include(include({ libelle: 'public' })) }
|
||||
end
|
||||
|
||||
context 'when generating document for dossier having conditional' do
|
||||
include Logic
|
||||
let(:state) { Dossier.states.fetch(:en_construction) }
|
||||
let(:stable_id) { 1234 }
|
||||
let(:condition) { ds_eq(champ_value(stable_id), constant(true)) }
|
||||
|
||||
let(:types_de_champ_public) do
|
||||
[
|
||||
{ type: :text, libelle: 'public' },
|
||||
{ type: :text, libelle: 'conditional', condition: condition }
|
||||
]
|
||||
end
|
||||
|
||||
it { is_expected.to include(include({ libelle: 'public' })) }
|
||||
it { is_expected.not_to include(include({ libelle: 'conditional' })) }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'used_tags_for' do
|
||||
|
|
Loading…
Reference in a new issue