Skip to content

Commit

Permalink
tech(refactor): change revision_changes_component signature to take b…
Browse files Browse the repository at this point in the history
…oth revisions instead of changes only
  • Loading branch information
mfo committed Apr 25, 2024
1 parent e4b94b4 commit f3b6770
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- list.with_empty do
= t('.no_changes')

- @changes.each do |change|
- @tdc_changes.each do |change|
- prefix = change.private? ? 'private' : 'public'
- case change.op
- when :add
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
%p.mb-2= t('.draft_changed_procedure_alert')
= render Dsfr::AlertComponent.new(state: :info, size: :sm, extra_class_names: 'fr-mb-2w') do |c|
- c.with_body do
= render Procedure::RevisionChangesComponent.new changes: procedure.revision_changes, previous_revision: procedure.published_revision
= render Procedure::RevisionChangesComponent.new new_revision: procedure.draft_revision, previous_revision: procedure.published_revision
- if procedure.close?
= render partial: 'publication_form_inputs', locals: { procedure: procedure, closed_procedures: @closed_procedures, form: f }
- elsif @procedure.brouillon? && @procedure.missing_steps.empty?
Expand Down
3 changes: 1 addition & 2 deletions app/views/administrateurs/procedures/modifications.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
- previous_revision = nil
- @procedure.revisions.each do |revision|
- if previous_revision.present? && !revision.draft?
- changes = previous_revision.compare(revision)
- dossiers = revision.dossiers.visible_by_administration
- dossiers_en_construction_count = dossiers.state_en_construction.count
- dossiers_en_instruction_count = dossiers.state_en_instruction.count
Expand All @@ -28,5 +27,5 @@
%p= t('.dossiers_en_construction', count: dossiers_en_construction_count)
- elsif !dossiers_en_instruction_count.zero?
%p= t('.dossiers_en_instruction', count: dossiers_en_instruction_count)
= render Procedure::RevisionChangesComponent.new changes:, previous_revision:
= render Procedure::RevisionChangesComponent.new new_revision: revision, previous_revision:
- previous_revision = revision
2 changes: 1 addition & 1 deletion app/views/administrateurs/procedures/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
.fr-container
= render Dsfr::CalloutComponent.new(title: t(:has_changes, scope: [:administrateurs, :revision_changes]), icon: "fr-fi-information-line") do |c|
- c.with_body do
= render Procedure::RevisionChangesComponent.new changes: @procedure.revision_changes, previous_revision: @procedure.published_revision
= render Procedure::RevisionChangesComponent.new new_revision: @procedure.draft_revision, previous_revision: @procedure.published_revision

= render Procedure::PublicationWarningComponent.new(procedure: @procedure)

Expand Down

0 comments on commit f3b6770

Please sign in to comment.