2018-04-13 16:56:00 +02:00
|
|
|
module NewAdministrateur
|
|
|
|
class AdministrateurController < ApplicationController
|
|
|
|
before_action :authenticate_administrateur!
|
2018-11-14 16:24:34 +01:00
|
|
|
|
|
|
|
def retrieve_procedure
|
|
|
|
id = params[:procedure_id] || params[:id]
|
|
|
|
|
|
|
|
@procedure = current_administrateur.procedures.find(id)
|
|
|
|
|
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
flash.alert = 'Démarche inexistante'
|
|
|
|
redirect_to admin_procedures_path
|
|
|
|
end
|
|
|
|
|
|
|
|
def procedure_locked?
|
|
|
|
if @procedure.locked?
|
|
|
|
flash.alert = 'Démarche verrouillée'
|
|
|
|
redirect_to admin_procedure_path(@procedure)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def reset_procedure
|
2019-09-16 16:59:10 +02:00
|
|
|
if @procedure.brouillon?
|
2018-11-14 16:24:34 +01:00
|
|
|
@procedure.reset!
|
|
|
|
end
|
|
|
|
end
|
2018-04-13 16:56:00 +02:00
|
|
|
end
|
|
|
|
end
|