-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(TransitionsRules): add custom message and refine ui
- Loading branch information
Showing
16 changed files
with
99 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 35 additions & 24 deletions
59
app/components/conditions/transitions_rules_component/transitions_rules_component.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,41 @@ | ||
%div{ id: dom_id(@revision, :transitions_rules) } | ||
= form_tag admin_procedure_transitions_rules_path(@revision.procedure_id), method: :patch, data: { turbo: true, controller: 'autosave' }, class: 'form width-100' do | ||
- if @condition.present? | ||
.conditionnel.fr-mt-3w.width-100 | ||
%table.condition-table.mt-2{ class: class_names('element-warning' => pending_changes?) } | ||
%thead | ||
%tr | ||
%th.far-left | ||
%th.target Champ Cible | ||
%th.operator Opérateur | ||
%th.value Valeur | ||
%th.delete-column | ||
%tbody | ||
- rows.each.with_index do |(targeted_champ, operator_name, value), row_index| | ||
%tr | ||
%td.far-left= far_left_tag(row_index) | ||
%td.target= left_operand_tag(targeted_champ, row_index) | ||
%td.operator= operator_tag(operator_name, targeted_champ, row_index) | ||
%td.value= right_operand_tag(targeted_champ, value, row_index, operator_name) | ||
%td.delete-column= delete_condition_tag(row_index) | ||
%div{ class: class_names('element-warning' => pending_changes?, 'fr-p-3w': pending_changes?) } | ||
%h2.fr-h2 | ||
Gestion des critères d'eligibilité | ||
|
||
= render Procedure::PendingRepublishComponent.new(procedure: @revision.procedure, render_if: pending_changes?) | ||
%p.fr-mt-3w= add_condition_tag | ||
= form_tag admin_procedure_transitions_rules_path(@revision.procedure_id), method: :patch, data: { turbo: true, controller: 'autosave' }, class: 'form width-100' do | ||
- if @condition.present? | ||
.conditionnel.fr-mt-3w.width-100 | ||
%table.condition-table.mt-2 | ||
%thead | ||
%tr | ||
%th.far-left | ||
%th.target Champ Cible | ||
%th.operator Opérateur | ||
%th.value Valeur | ||
%th.delete-column | ||
%tbody | ||
- rows.each.with_index do |(targeted_champ, operator_name, value), row_index| | ||
%tr | ||
%td.far-left= far_left_tag(row_index) | ||
%td.target= left_operand_tag(targeted_champ, row_index) | ||
%td.operator= operator_tag(operator_name, targeted_champ, row_index) | ||
%td.value= right_operand_tag(targeted_champ, value, row_index, operator_name) | ||
%td.delete-column= delete_condition_tag(row_index) | ||
%tfoot | ||
%tr | ||
%td{ colspan: 5 }= add_condition_tag | ||
|
||
- else | ||
= tag.button "Activer l'éligibilité des dossiers", formaction: add_condition_path, formvalidate: true, class: 'fr-btn fr-btn--primary' | ||
|
||
- else | ||
= tag.button "Activer l'éligibilité des dossiers", formaction: add_condition_path, formvalidate: true, class: 'fr-btn fr-btn--primary' | ||
- if @condition.present? | ||
%h2.fr-h2.fr-mt-3w Message d'inéligibilité | ||
= form_for(@revision, url: change_message_admin_procedure_transitions_rules_path(@revision.procedure_id)) do |f| | ||
= render Dsfr::InputComponent.new(form: f, attribute: :dossier_ineligble_message, input_type: :text_area, opts: {rows: 5}) | ||
%p.fr-mb-0= f.submit "Modifier le message d'inéligibilité", class: 'fr-btn' | ||
|
||
= render Procedure::PendingRepublishComponent.new(procedure: @revision.procedure, render_if: pending_changes?) | ||
- if @condition.present? | ||
= button_to 'Désactiver l’éligibilité des dossiers', delete_all_admin_procedure_transitions_rules_path(@revision.procedure), method: :delete, class: 'fr-btn' | ||
%h2.fr-h2.fr-mt-3w Désactivation des critères d'eligibilité | ||
= button_to 'Désactiver l’éligibilité des dossiers', delete_all_admin_procedure_transitions_rules_path(@revision.procedure), method: :delete, class: 'fr-btn fr-btn--tertiary' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
app/components/procedure/pending_republish_component/pending_republish_component.fr.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
--- | ||
fr: | ||
pending_republish_html: | | ||
Cette modification ne sera appliquée qu'à la prochaine publication. Vous pouvez vérifier puis publier les modifications sur l'écran de <a href="%{href}">gestion de la démarche</a> | ||
Ces modifications ne seront appliquées qu'à la prochaine publication. Vous pouvez vérifier puis publier les modifications sur l'écran de <a href="%{href}">gestion de la démarche</a> |
2 changes: 1 addition & 1 deletion
2
app/components/procedure/pending_republish_component/pending_republish_component.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
= render Dsfr::AlertComponent.new(state: :warning, extra_class_names: 'fr-mt-3w') do |c| | ||
= render Dsfr::AlertComponent.new(state: :warning) do |c| | ||
- c.with_body do | ||
= t('.pending_republish_html', href: admin_procedure_path(@procedure.id)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
fr: | ||
activerecord: | ||
attributes: | ||
procedure_revision: | ||
dossier_ineligble_message: Message d'inéligibilité | ||
hints: | ||
dossier_ineligble_message: "Ce message sera affiché à l'usager si son dossier ne correspond pas à vos critères d'éligibilité" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
db/migrate/20240514075727_add_dossier_ineligble_message_to_procedure_revisions.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddDossierIneligbleMessageToProcedureRevisions < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :procedure_revisions, :dossier_ineligble_message, :text | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters