controller
This commit is contained in:
parent
60eed4ec01
commit
d2bd2ffcbe
2 changed files with 7 additions and 5 deletions
|
@ -233,17 +233,19 @@ module Administrateurs
|
|||
|
||||
@procedure.assign_attributes(publish_params)
|
||||
|
||||
if @procedure.draft_changed?
|
||||
if @procedure.draft_changed? && !@procedure.close?
|
||||
@procedure.publish_revision!
|
||||
flash.notice = "Nouvelle version de la démarche publiée"
|
||||
redirect_to admin_procedure_path(@procedure)
|
||||
elsif @procedure.draft_changed? && @procedure.close?
|
||||
@procedure.publish_or_reopen!(current_administrateur)
|
||||
@procedure.publish_revision!
|
||||
flash.notice = "Démarche publiée"
|
||||
elsif @procedure.publish_or_reopen!(current_administrateur)
|
||||
flash.notice = "Démarche publiée"
|
||||
redirect_to admin_procedure_path(@procedure)
|
||||
else
|
||||
flash.alert = @procedure.errors.full_messages
|
||||
redirect_to admin_procedure_path(@procedure)
|
||||
end
|
||||
redirect_to admin_procedure_path(@procedure)
|
||||
end
|
||||
|
||||
def transfert
|
||||
|
|
|
@ -405,7 +405,7 @@ class Procedure < ApplicationRecord
|
|||
end
|
||||
|
||||
def draft_changed?
|
||||
published_revision.different_from?(draft_revision) && revision_changes.present?
|
||||
!brouillon? && published_revision.different_from?(draft_revision) && revision_changes.present?
|
||||
end
|
||||
|
||||
def revision_changes
|
||||
|
|
Loading…
Reference in a new issue