diff --git a/app/models/procedure.rb b/app/models/procedure.rb index a4e839346..2d2289148 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -235,7 +235,6 @@ class Procedure < ApplicationRecord validates :description, presence: true, allow_blank: false, allow_nil: false validates :administrateurs, presence: true validates :lien_site_web, presence: true, if: :publiee? - validate :validate_for_publication, on: :publication validate :check_juridique 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, numericality: { only_integer: true, greater_than_or_equal_to: 1, less_than_or_equal_to: MAX_DUREE_CONSERVATION } @@ -325,18 +324,6 @@ class Procedure < ApplicationRecord end end - def validate_for_publication - old_attributes = self.slice(:aasm_state, :closed_at) - self.aasm_state = :publiee - self.closed_at = nil - - is_valid = validate - - self.attributes = old_attributes - - is_valid - end - def suggested_path(administrateur) if path_customized? return path diff --git a/app/views/new_administrateur/procedures/_publication_form.html.haml b/app/views/new_administrateur/procedures/_publication_form.html.haml index 0989ab17b..76900b50e 100644 --- a/app/views/new_administrateur/procedures/_publication_form.html.haml +++ b/app/views/new_administrateur/procedures/_publication_form.html.haml @@ -30,14 +30,5 @@ autocomplete: 'off', placeholder: 'https://exemple.gouv.fr/ma_demarche') - - procedure.validate(:publication) - - errors = procedure.errors - -# Ignore the :taken error if the path can be claimed - - if errors.details[:path]&.pluck(:error)&.include?(:taken) && procedure.path_available?(administrateur, procedure.path) - - errors.delete(:path) - - - options = { class: "button primary", id: 'publish' } - - if errors.details[:path].present? - - options[:disabled] = :disabled .flex.justify-end - = submit_tag procedure_publish_label(procedure, :submit), options + = submit_tag procedure_publish_label(procedure, :submit), { class: "button primary", id: 'publish' }