fix(types_de_champ): ensure we always reset dossier after demarche changes
This commit is contained in:
parent
1f54986ab8
commit
5dfb96383a
4 changed files with 4 additions and 7 deletions
|
@ -13,10 +13,8 @@ module Administrateurs
|
|||
end
|
||||
|
||||
def reset_procedure
|
||||
if @procedure.brouillon? || @procedure.draft_changed?
|
||||
@procedure.reset!
|
||||
end
|
||||
end
|
||||
|
||||
def ensure_not_super_admin!
|
||||
if administrateur_as_manager?
|
||||
|
|
|
@ -3,6 +3,7 @@ module Administrateurs
|
|||
include Logic
|
||||
|
||||
before_action :retrieve_procedure, :retrieve_coordinate_and_uppers
|
||||
after_action :reset_procedure
|
||||
|
||||
def update
|
||||
condition = condition_form.to_condition
|
||||
|
|
|
@ -4,6 +4,7 @@ module Administrateurs
|
|||
|
||||
before_action :retrieve_procedure, only: [:champs, :annotations, :modifications, :edit, :zones, :monavis, :update_monavis, :jeton, :update_jeton, :publication, :publish, :transfert, :close, :allow_expert_review, :experts_require_administrateur_invitation, :reset_draft]
|
||||
before_action :draft_valid?, only: [:apercu]
|
||||
after_action :reset_procedure, only: [:update]
|
||||
|
||||
ITEMS_PER_PAGE = 25
|
||||
|
||||
|
@ -139,7 +140,6 @@ module Administrateurs
|
|||
render 'edit'
|
||||
end
|
||||
elsif @procedure.brouillon?
|
||||
reset_procedure
|
||||
flash.notice = 'Démarche modifiée. Tous les dossiers de cette démarche ont été supprimés.'
|
||||
redirect_to admin_procedure_path(id: @procedure.id)
|
||||
else
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
module Administrateurs
|
||||
class TypesDeChampController < AdministrateurController
|
||||
before_action :retrieve_procedure
|
||||
after_action :reset_procedure, only: [:create, :update, :destroy]
|
||||
|
||||
def create
|
||||
type_de_champ = draft.add_type_de_champ(type_de_champ_create_params)
|
||||
|
@ -10,7 +11,6 @@ module Administrateurs
|
|||
@created = champ_component_from(@coordinate, focused: true)
|
||||
@morphed = champ_components_starting_at(@coordinate, 1)
|
||||
|
||||
reset_procedure
|
||||
flash.notice = "Formulaire enregistré"
|
||||
else
|
||||
flash.alert = type_de_champ.errors.full_messages
|
||||
|
@ -24,7 +24,6 @@ module Administrateurs
|
|||
@coordinate = draft.coordinate_for(type_de_champ)
|
||||
@morphed = champ_components_starting_at(@coordinate)
|
||||
|
||||
reset_procedure
|
||||
flash.notice = "Formulaire enregistré"
|
||||
else
|
||||
flash.alert = type_de_champ.errors.full_messages
|
||||
|
@ -69,7 +68,6 @@ module Administrateurs
|
|||
|
||||
def destroy
|
||||
@coordinate = draft.remove_type_de_champ(params[:stable_id])
|
||||
reset_procedure
|
||||
flash.notice = "Formulaire enregistré"
|
||||
|
||||
if @coordinate.present?
|
||||
|
|
Loading…
Reference in a new issue