refactor(procedure): add a prefix to closing_reason enum
This commit is contained in:
parent
579fe2c933
commit
280f1ac3c7
4 changed files with 8 additions and 8 deletions
|
@ -226,7 +226,7 @@ class Procedure < ApplicationRecord
|
|||
enum closing_reason: {
|
||||
internal_procedure: 'internal_procedure',
|
||||
other: 'other'
|
||||
}
|
||||
}, _prefix: true
|
||||
|
||||
scope :for_api_v2, -> {
|
||||
includes(:draft_revision, :published_revision, administrateurs: :user)
|
||||
|
@ -265,7 +265,7 @@ class Procedure < ApplicationRecord
|
|||
|
||||
validate :check_juridique, on: [:create, :publication]
|
||||
|
||||
validates :replaced_by_procedure_id, presence: true, if: -> { closing_reason == Procedure.closing_reasons.fetch(:internal_procedure) }
|
||||
validates :replaced_by_procedure_id, presence: true, if: :closing_reason_internal_procedure?
|
||||
|
||||
validates :path, presence: true, format: { with: /\A[a-z0-9_\-]{3,200}\z/ }, uniqueness: { scope: [:path, :closed_at, :hidden_at, :unpublished_at], case_sensitive: false }
|
||||
validates :duree_conservation_dossiers_dans_ds, allow_nil: false,
|
||||
|
|
|
@ -11,7 +11,7 @@ module Maintenance
|
|||
end
|
||||
|
||||
def process(procedure)
|
||||
procedure.update!(closing_reason: Procedure.closing_reasons.fetch(:other))
|
||||
procedure.closing_reason_other!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
.fr-grid-row
|
||||
.fr-col-12.fr-col-offset-md-2.fr-col-md-8
|
||||
%h1= t('administrateurs.procedures.closing_notification.page_title')
|
||||
- if @procedure.closing_reason == Procedure.closing_reasons.fetch(:other)
|
||||
- if @procedure.closing_reason_other?
|
||||
%h2.fr-h5= I18n.t('administrateurs.procedures.closing_notification.page_subtitle', closing_path: closing_details_path(@procedure.path)).html_safe
|
||||
- else
|
||||
%h2.fr-h5= I18n.t('administrateurs.procedures.closing_notification.page_subtitle_with_redirection', redirection_path: commencer_path(@procedure.replaced_by_procedure.path)).html_safe
|
||||
|
|
|
@ -54,13 +54,13 @@
|
|||
= render Dsfr::AlertComponent.new(state: :info, size: :sm, extra_class_names: "fr-mb-2w") do |c|
|
||||
- c.with_body do
|
||||
%p
|
||||
- if dossier.brouillon? && dossier.procedure.closing_reason == Procedure.closing_reasons.fetch(:internal_procedure)
|
||||
- if dossier.brouillon? && dossier.procedure.closing_reason_internal_procedure?
|
||||
= I18n.t('views.users.dossiers.dossiers_list.procedure_closed.brouillon.internal_procedure', link: commencer_path(dossier.procedure.replaced_by_procedure.path)).html_safe
|
||||
- elsif dossier.brouillon? && dossier.procedure.closing_reason == Procedure.closing_reasons.fetch(:other)
|
||||
- elsif dossier.brouillon? && dossier.procedure.closing_reason_other?
|
||||
= I18n.t('views.users.dossiers.dossiers_list.procedure_closed.brouillon.other', link: closing_details_path(dossier.procedure.path)).html_safe
|
||||
- elsif (dossier.en_construction? || dossier.en_instruction?) && dossier.procedure.closing_reason == Procedure.closing_reasons.fetch(:internal_procedure)
|
||||
- elsif (dossier.en_construction? || dossier.en_instruction?) && dossier.procedure.closing_reason_internal_procedure?
|
||||
= I18n.t('views.users.dossiers.dossiers_list.procedure_closed.en_cours.internal_procedure')
|
||||
- elsif (dossier.en_construction? || dossier.en_instruction?) && dossier.procedure.closing_reason == Procedure.closing_reasons.fetch(:other)
|
||||
- elsif (dossier.en_construction? || dossier.en_instruction?) && dossier.procedure.closing_reason_other?
|
||||
= I18n.t('views.users.dossiers.dossiers_list.procedure_closed.en_cours.other', link: closing_details_path(dossier.procedure.path)).html_safe
|
||||
|
||||
- if dossier.pending_correction?
|
||||
|
|
Loading…
Reference in a new issue