Merge pull request #8963 from tchak/fix-revision-changes-delete-champs-message

ETQ administrateur, je veux être averti si des données seront supprimées sur les dossiers lors de la publication d’une nouvelle révision
This commit is contained in:
Paul Chavard 2023-04-26 15:12:31 +00:00 committed by GitHub
commit 6394996e7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 20 deletions

View file

@ -3,6 +3,7 @@ class Procedure::RevisionChangesComponent < ApplicationComponent
@changes = changes
@previous_revision = previous_revision
@public_move_changes, @private_move_changes = changes.filter { _1.op == :move }.partition { !_1.private? }
@delete_champ_warning = !total_dossiers.zero? && !@changes.all?(&:can_rebase?)
end
private

View file

@ -4,6 +4,9 @@ fr:
breaking_change:
one: Un dossier en cours de traitement nest pas compatible avec ce changement.
other: "%{count} dossiers en cours de traitement ne sont pas compatible avec ce changement."
delete_champ_html:
one: "Un dossier en cours de traitement porte ce champ. Les données associées à ce champ seront supprimées."
other: "%{count} dossiers en cours de traitement portent ce champ. Les <strong>données</strong> associées avec ce champ seront <strong>supprimées</strong>."
add_option: "ajoutés : %{items}"
remove_option: "supprimés : %{items}"
public:

View file

@ -12,11 +12,14 @@
- else
= t(".#{prefix}.add", label: change.label)
- if !total_dossiers.zero? && !change.can_rebase?
%strong
= t('.breaking_change', count: total_dossiers)
.fr-alert.fr-alert--warning.fr-mt-1v
%p= t('.breaking_change', count: total_dossiers)
- when :remove
- list.with_item do
= t(".#{prefix}.remove", label: change.label)
- if @delete_champ_warning
.fr-alert.fr-alert--warning.fr-mt-1v
%p= t('.delete_champ_html', count: total_dossiers)
- when :update
- case change.attribute
- when :libelle
@ -26,8 +29,8 @@
- list.with_item do
= t(".#{prefix}.update_type_champ", label: change.label, to: t("activerecord.attributes.type_de_champ.type_champs.#{change.to}"))
- if !total_dossiers.zero? && !change.can_rebase?
%strong
= t('.breaking_change', count: total_dossiers)
.fr-alert.fr-alert--warning.fr-mt-1v
%p= t('.breaking_change', count: total_dossiers)
- when :description
- list.with_item do
- if change.to.blank?
@ -45,14 +48,14 @@
- list.with_item do
= t(".public.enable_mandatory", label: change.label)
- if !total_dossiers.zero? && !change.can_rebase?
%strong
= t('.breaking_change', count: total_dossiers)
.fr-alert.fr-alert--warning.fr-mt-1v
%p= t('.breaking_change', count: total_dossiers)
- else
- list.with_item do
= t(".public.disable_mandatory", label: change.label)
- if !total_dossiers.zero? && !change.can_rebase?
%strong
= t('.breaking_change', count: total_dossiers)
.fr-alert.fr-alert--warning.fr-mt-1v
%p= t('.breaking_change', count: total_dossiers)
- when :piece_justificative_template
- list.with_item do
= t(".#{prefix}.update_piece_justificative_template", label: change.label)
@ -69,21 +72,21 @@
- list.with_item do
= t('.remove_option', items: removed.map{ |term| "« #{term.strip} »" }.join(", "))
- if !total_dossiers.zero? && !change.can_rebase?
%strong
= t('.breaking_change', count: total_dossiers)
.fr-alert.fr-alert--warning.fr-mt-1v
%p= t('.breaking_change', count: total_dossiers)
- when :drop_down_other
- if change.from == false
- list.with_item do
= t(".#{prefix}.enable_drop_down_other", label: change.label)
- if !total_dossiers.zero? && !change.can_rebase?
%strong
= t('.breaking_change', count: total_dossiers)
.fr-alert.fr-alert--warning.fr-mt-1v
%p= t('.breaking_change', count: total_dossiers)
- else
- list.with_item do
= t(".#{prefix}.disable_drop_down_other", label: change.label)
- if !total_dossiers.zero? && !change.can_rebase?
%strong
= t('.breaking_change', count: total_dossiers)
.fr-alert.fr-alert--warning.fr-mt-1v
%p= t('.breaking_change', count: total_dossiers)
- when :carte_layers
- added = change.to.sort - change.from.sort
- removed = change.from.sort - change.to.sort
@ -114,20 +117,20 @@
- list.with_item do
= t(".#{prefix}.add_condition", label: change.label, to: change.to)
- if !total_dossiers.zero? && !change.can_rebase?
%strong
= t('.breaking_change', count: total_dossiers)
.fr-alert.fr-alert--warning.fr-mt-1v
%p= t('.breaking_change', count: total_dossiers)
- elsif change.to.nil?
- list.with_item do
= t(".#{prefix}.remove_condition", label: change.label)
- if !total_dossiers.zero? && !change.can_rebase?
%strong
= t('.breaking_change', count: total_dossiers)
.fr-alert.fr-alert--warning.fr-mt-1v
%p= t('.breaking_change', count: total_dossiers)
- else
- list.with_item do
= t(".#{prefix}.update_condition", label: change.label, to: change.to)
- if !total_dossiers.zero? && !change.can_rebase?
%strong
= t('.breaking_change', count: total_dossiers)
.fr-alert.fr-alert--warning.fr-mt-1v
%p= t('.breaking_change', count: total_dossiers)
- if @public_move_changes.present?
- list.with_item do