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:
|
||||
title: Modifications
|
||||
title:
|
||||
one: Modification
|
||||
other: Modifications
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
%p.card-admin-status-accept Activée
|
||||
%div
|
||||
%p.card-admin-title
|
||||
%span.badge.baseline= @procedure.revisions.size - 1
|
||||
= t('.title')
|
||||
%span.badge.baseline= @procedure.revisions_count
|
||||
= t('.title', count: @procedure.revisions_count)
|
||||
|
||||
%p.card-admin-subtitle Historique des modifications du formulaire
|
||||
%p.button Voir
|
||||
|
|
|
@ -660,6 +660,11 @@ class Procedure < ApplicationRecord
|
|||
feature_enabled?(:procedure_revisions) && revisions.size > 2
|
||||
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?
|
||||
routing_enabled? || groupe_instructeurs.size > 1
|
||||
end
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
%ul.revision-changes
|
||||
- changes.filter { |change| change[:model] == :attestation_template }.each do |change|
|
||||
= render partial: 'administrateurs/procedures/revision_change_attestation_template', locals: { change: change }
|
||||
- changes.filter { |change| change[:model] == :type_de_champ }.each do |change|
|
||||
= render partial: 'administrateurs/procedures/revision_change_type_de_champ', locals: { change: change }
|
||||
- move_changes, move_private_changes = changes.filter { |change| change[:op] == :move }.partition { |change| !change[:private] }
|
||||
- if move_changes.size != 0
|
||||
%li.mb-1= t(:move, scope: [:administrateurs, :revision_changes], count: move_changes.size)
|
||||
- if move_private_changes.size != 0
|
||||
%li.mb-1= t(:move_private, scope: [:administrateurs, :revision_changes], count: move_private_changes.size)
|
||||
- if changes.empty?
|
||||
%li.mb-1= t(:no_changes, scope: [:administrateurs, :revision_changes])
|
||||
- else
|
||||
- changes.filter { |change| change[:model] == :attestation_template }.each do |change|
|
||||
= render partial: 'administrateurs/procedures/revision_change_attestation_template', locals: { change: change }
|
||||
- changes.filter { |change| change[:model] == :type_de_champ }.each do |change|
|
||||
= render partial: 'administrateurs/procedures/revision_change_type_de_champ', locals: { change: change }
|
||||
- move_changes, move_private_changes = changes.filter { |change| change[:op] == :move }.partition { |change| !change[:private] }
|
||||
- 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|
|
||||
- if previous_revision.present? && !revision.draft?
|
||||
- changes = previous_revision.compare(revision)
|
||||
- if changes.present?
|
||||
.card.mb-4
|
||||
%h2.card-title= "Modifications publiées le #{l(revision.published_at, format: '%d %B %Y à %R')}"
|
||||
= render partial: 'revision_changes', locals: { changes: changes }
|
||||
.card.mb-4
|
||||
%h2.card-title= "Modifications publiées le #{l(revision.published_at, format: '%d %B %Y à %R')}"
|
||||
= render partial: 'revision_changes', locals: { changes: changes }
|
||||
- previous_revision = revision
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
fr:
|
||||
administrateurs:
|
||||
revision_changes:
|
||||
no_changes: Aucune modification
|
||||
attestation_template:
|
||||
add: Un model d’attestation à été ajouté
|
||||
update_title: Le titre de l’attestation à été modifié. Le nouveau titre est « %{to} »
|
||||
|
|
Loading…
Reference in a new issue