fix(revisions): improuve changes information display
This commit is contained in:
parent
d4ab97f270
commit
c05bc61c99
6 changed files with 26 additions and 16 deletions
|
@ -1,3 +1,5 @@
|
||||||
---
|
---
|
||||||
fr:
|
fr:
|
||||||
title: Modifications
|
title:
|
||||||
|
one: Modification
|
||||||
|
other: Modifications
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
%p.card-admin-status-accept Activée
|
%p.card-admin-status-accept Activée
|
||||||
%div
|
%div
|
||||||
%p.card-admin-title
|
%p.card-admin-title
|
||||||
%span.badge.baseline= @procedure.revisions.size - 1
|
%span.badge.baseline= @procedure.revisions_count
|
||||||
= t('.title')
|
= t('.title', count: @procedure.revisions_count)
|
||||||
|
|
||||||
%p.card-admin-subtitle Historique des modifications du formulaire
|
%p.card-admin-subtitle Historique des modifications du formulaire
|
||||||
%p.button Voir
|
%p.button Voir
|
||||||
|
|
|
@ -660,6 +660,11 @@ class Procedure < ApplicationRecord
|
||||||
feature_enabled?(:procedure_revisions) && revisions.size > 2
|
feature_enabled?(:procedure_revisions) && revisions.size > 2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def revisions_count
|
||||||
|
# We start counting from the first revision after publication and we are not counting the draft (there is always one)
|
||||||
|
revisions.size - 2
|
||||||
|
end
|
||||||
|
|
||||||
def routee?
|
def routee?
|
||||||
routing_enabled? || groupe_instructeurs.size > 1
|
routing_enabled? || groupe_instructeurs.size > 1
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
%ul.revision-changes
|
%ul.revision-changes
|
||||||
- changes.filter { |change| change[:model] == :attestation_template }.each do |change|
|
- if changes.empty?
|
||||||
= render partial: 'administrateurs/procedures/revision_change_attestation_template', locals: { change: change }
|
%li.mb-1= t(:no_changes, scope: [:administrateurs, :revision_changes])
|
||||||
- changes.filter { |change| change[:model] == :type_de_champ }.each do |change|
|
- else
|
||||||
= render partial: 'administrateurs/procedures/revision_change_type_de_champ', locals: { change: change }
|
- changes.filter { |change| change[:model] == :attestation_template }.each do |change|
|
||||||
- move_changes, move_private_changes = changes.filter { |change| change[:op] == :move }.partition { |change| !change[:private] }
|
= render partial: 'administrateurs/procedures/revision_change_attestation_template', locals: { change: change }
|
||||||
- if move_changes.size != 0
|
- changes.filter { |change| change[:model] == :type_de_champ }.each do |change|
|
||||||
%li.mb-1= t(:move, scope: [:administrateurs, :revision_changes], count: move_changes.size)
|
= render partial: 'administrateurs/procedures/revision_change_type_de_champ', locals: { change: change }
|
||||||
- if move_private_changes.size != 0
|
- move_changes, move_private_changes = changes.filter { |change| change[:op] == :move }.partition { |change| !change[:private] }
|
||||||
%li.mb-1= t(:move_private, scope: [:administrateurs, :revision_changes], count: move_private_changes.size)
|
- if move_changes.present?
|
||||||
|
%li.mb-1= t(:move, scope: [:administrateurs, :revision_changes], count: move_changes.size)
|
||||||
|
- if move_private_changes.present?
|
||||||
|
%li.mb-1= t(:move_private, scope: [:administrateurs, :revision_changes], count: move_private_changes.size)
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
- @procedure.revisions.each do |revision|
|
- @procedure.revisions.each do |revision|
|
||||||
- if previous_revision.present? && !revision.draft?
|
- if previous_revision.present? && !revision.draft?
|
||||||
- changes = previous_revision.compare(revision)
|
- changes = previous_revision.compare(revision)
|
||||||
- if changes.present?
|
.card.mb-4
|
||||||
.card.mb-4
|
%h2.card-title= "Modifications publiées le #{l(revision.published_at, format: '%d %B %Y à %R')}"
|
||||||
%h2.card-title= "Modifications publiées le #{l(revision.published_at, format: '%d %B %Y à %R')}"
|
= render partial: 'revision_changes', locals: { changes: changes }
|
||||||
= render partial: 'revision_changes', locals: { changes: changes }
|
|
||||||
- previous_revision = revision
|
- previous_revision = revision
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
fr:
|
fr:
|
||||||
administrateurs:
|
administrateurs:
|
||||||
revision_changes:
|
revision_changes:
|
||||||
|
no_changes: Aucune modification
|
||||||
attestation_template:
|
attestation_template:
|
||||||
add: Un model d’attestation à été ajouté
|
add: Un model d’attestation à été ajouté
|
||||||
update_title: Le titre de l’attestation à été modifié. Le nouveau titre est « %{to} »
|
update_title: Le titre de l’attestation à été modifié. Le nouveau titre est « %{to} »
|
||||||
|
|
Loading…
Reference in a new issue