Merge pull request #6663 from betagouv/remove-procedure-autocomplete-leftovers
Suppression du code obsolète pour l'auto-validation du chemin des démarches
This commit is contained in:
commit
d4cbcaf768
2 changed files with 1 additions and 23 deletions
|
@ -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
|
||||
|
|
|
@ -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' }
|
||||
|
|
Loading…
Reference in a new issue