Disable transition from publiée to brouillon

This commit is contained in:
Paul Chavard 2019-11-28 10:33:39 +01:00
parent 3e334a3306
commit c1c8ab7ac6
3 changed files with 0 additions and 22 deletions

View file

@ -22,16 +22,6 @@ module Manager
redirect_to manager_procedure_path(procedure)
end
def draft
if procedure.dossiers.empty?
procedure.draft!
flash[:notice] = "La démarche a bien été passée en brouillon."
else
flash[:alert] = "Impossible de repasser en brouillon une démarche à laquelle sont rattachés des dossiers."
end
redirect_to manager_procedure_path(procedure)
end
def hide
procedure.hide!
flash[:notice] = "La démarche a bien été supprimée, en cas d'erreur contactez un développeur."

View file

@ -112,10 +112,6 @@ class Procedure < ApplicationRecord
transitions from: :publiee, to: :hidden
transitions from: :archivee, to: :hidden
end
event :draft, after: :after_draft do
transitions from: :publiee, to: :brouillon
end
end
def publish_or_reopen!(administrateur)
@ -622,10 +618,6 @@ class Procedure < ApplicationRecord
purge_export_files
end
def after_draft
update!(published_at: nil)
end
def update_juridique_required
self.juridique_required ||= (cadre_juridique.present? || deliberation.attached?)
true

View file

@ -39,10 +39,6 @@ as well as a link to its edit page.
<%= link_to 'whitelister', whitelist_manager_procedure_path(procedure), method: :post, class: 'button' %>
<% end %>
<% if procedure.publiee? && procedure.dossiers.empty? %>
<%= link_to 'repasser en test', draft_manager_procedure_path(procedure), method: :post, class: 'button' %>
<% end %>
<% if !procedure.hidden? %>
<%= link_to 'supprimer la démarche', hide_manager_procedure_path(procedure), method: :post, class: 'button', data: { confirm: "Confirmez-vous la suppression de la démarche ?" } %>
<% end %>