demarches-normaliennes/app/views/admin/procedures/_publish_path_message.html.haml
Nicolas Bouilleaud c26a701a17 Refactor and redesign publish modal
* remove the autocomplete menu
* use ujs to pre-validate the procedure
* tweak the UI
2019-09-17 16:30:48 +02:00

11 lines
641 B
Text

#publish-path-message
- procedure.validate(:publication)
- errors = procedure.errors
-# Ignore the :taken error if the path can be claimed, and instead display the :taken_can_be_claimed error message.
- if errors.details[:path]&.pluck(:error)&.include?(:taken) && procedure.path_available?(administrateur, procedure.path)
.alert.alert-warning
= errors.full_message('Le lien public', errors.generate_message(:path, :taken_can_be_claimed))
- elsif errors.messages[:path].present?
-# Display the actual errors for :path
.alert.alert-danger
= errors.full_message('Le lien public', errors.messages[:path].first)