feat(procedure_revision.compate): track and show diff for TypeDeChamp.explication between draft and published revisions
This commit is contained in:
parent
f7feca5fd1
commit
e43c2f1407
6 changed files with 25 additions and 11 deletions
|
@ -9,4 +9,4 @@
|
|||
.fr-collapse{ id: dom_id(@champ, :explanation) }
|
||||
= render SimpleFormatComponent.new(@champ.collapsible_explanation_text, allow_a: true)
|
||||
- if notice_explicative.attached?
|
||||
= render Dsfr::DownloadComponent.new(attachment: notice_explicative, virus_not_analyzed: !notice_explicative.virus_scanner.started?, new_tab: true)
|
||||
= render Dsfr::DownloadComponent.new(attachment: notice_explicative, virus_not_analyzed: !notice_explicative.virus_scanner.started?, new_tab: true)
|
||||
|
|
|
@ -24,6 +24,7 @@ fr:
|
|||
update_drop_down_secondary_description: La description secondaire du champ « %{label} » a été modifiée. La nouvelle description est « %{to} ».
|
||||
update_type_champ: Le type du champ « %{label} » a été modifié. Il est maintenant de type « %{to} ».
|
||||
update_piece_justificative_template: Le modèle de pièce justificative du champ « %{label} » a été modifié.
|
||||
update_notice_explicative: La notice explicative du champ « %{label} » a été modifiée.
|
||||
update_drop_down_options: "Les options de sélection du champ « %{label} » ont été modifiées :"
|
||||
update_drop_down_options_alert: "Le champ « %{label} » est utilisé pour le routage des dossiers. Veuillez mettre à jour la configuration des groupes d'instructeurs après avoir publié les modifications."
|
||||
enable_mandatory: Le champ « %{label} » est maintenant obligatoire.
|
||||
|
@ -59,6 +60,7 @@ fr:
|
|||
update_drop_down_secondary_description: La description secondaire de l’annotation « %{label} » a été modifiée. La nouvelle description est « %{to} ».
|
||||
update_type_champ: Le type de l’annotation privée « %{label} » a été modifié. Elle est maintenant de type « %{to} ».
|
||||
update_piece_justificative_template: Le modèle de pièce justificative de l’annotation privée « %{label} » a été modifié.
|
||||
update_notice_explicative: La notice explicative l’annotation privée « %{label} » a été modifiée.
|
||||
update_drop_down_options: "Les options de sélection de l’annotation privée « %{label} » ont été modifiées :"
|
||||
update_carte_layers: "Les référentiels cartographiques de l’annotation privée « %{label} » ont été modifiés :"
|
||||
enable_drop_down_other: L’annotation privée « %{label} » comporte maintenant un choix « Autre ».
|
||||
|
|
|
@ -59,6 +59,9 @@
|
|||
- when :piece_justificative_template
|
||||
- list.with_item do
|
||||
= t(".#{prefix}.update_piece_justificative_template", label: change.label)
|
||||
- when :notice_explicative
|
||||
- list.with_item do
|
||||
= t(".#{prefix}.update_notice_explicative", label: change.label)
|
||||
- when :drop_down_options
|
||||
- added = change.to.sort - change.from.sort
|
||||
- removed = change.from.sort - change.to.sort
|
||||
|
|
|
@ -46,7 +46,7 @@ module Administrateurs
|
|||
|
||||
def notice_explicative
|
||||
type_de_champ = draft.find_and_ensure_exclusive_use(params[:stable_id])
|
||||
byebug
|
||||
|
||||
if type_de_champ.notice_explicative.attach(params[:blob_signed_id])
|
||||
@coordinate = draft.coordinate_for(type_de_champ)
|
||||
@morphed = [champ_component_from(@coordinate)]
|
||||
|
|
|
@ -363,11 +363,18 @@ class ProcedureRevision < ApplicationRecord
|
|||
to_type_de_champ.carte_optional_layers)
|
||||
end
|
||||
elsif to_type_de_champ.piece_justificative?
|
||||
if from_type_de_champ.piece_justificative_template_checksum != to_type_de_champ.piece_justificative_template_checksum
|
||||
if from_type_de_champ.checksum_for_attachment(:piece_justificative_template) != to_type_de_champ.checksum_for_attachment(:piece_justificative_template)
|
||||
changes << ProcedureRevisionChange::UpdateChamp.new(from_type_de_champ,
|
||||
:piece_justificative_template,
|
||||
from_type_de_champ.piece_justificative_template_filename,
|
||||
to_type_de_champ.piece_justificative_template_filename)
|
||||
from_type_de_champ.filename_for_attachement(:piece_justificative_template),
|
||||
to_type_de_champ.filename_for_attachement(:piece_justificative_template))
|
||||
end
|
||||
elsif to_type_de_champ.explication?
|
||||
if from_type_de_champ.checksum_for_attachment(:notice_explicative) != to_type_de_champ.checksum_for_attachment(:notice_explicative)
|
||||
changes << ProcedureRevisionChange::UpdateChamp.new(from_type_de_champ,
|
||||
:notice_explicative,
|
||||
from_type_de_champ.filename_for_attachement(:notice_explicative),
|
||||
to_type_de_champ.filename_for_attachement(:notice_explicative))
|
||||
end
|
||||
elsif to_type_de_champ.textarea?
|
||||
if from_type_de_champ.character_limit != to_type_de_champ.character_limit
|
||||
|
|
|
@ -461,15 +461,17 @@ class TypeDeChamp < ApplicationRecord
|
|||
"TypesDeChamp::#{type_champ.classify}TypeDeChamp"
|
||||
end
|
||||
|
||||
def piece_justificative_template_filename
|
||||
if piece_justificative_template.attached?
|
||||
piece_justificative_template.filename
|
||||
def filename_for_attachement(attachment_sym)
|
||||
attachment = send(attachment_sym)
|
||||
if attachment.attached?
|
||||
attachment.filename
|
||||
end
|
||||
end
|
||||
|
||||
def piece_justificative_template_checksum
|
||||
if piece_justificative_template.attached?
|
||||
piece_justificative_template.checksum
|
||||
def checksum_for_attachment(attachment_sym)
|
||||
attachment = send(attachment_sym)
|
||||
if attachment.attached?
|
||||
attachment.checksum
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue