2015-10-23 16:19:55 +02:00
|
|
|
class AdminController < ApplicationController
|
2015-11-16 16:16:08 +01:00
|
|
|
before_action :authenticate_administrateur!
|
2015-10-23 16:19:55 +02:00
|
|
|
|
|
|
|
def index
|
2015-10-26 15:54:20 +01:00
|
|
|
redirect_to (admin_procedures_path)
|
2015-10-23 16:19:55 +02:00
|
|
|
end
|
2015-12-21 12:02:53 +01:00
|
|
|
|
|
|
|
def retrieve_procedure
|
2015-12-24 15:57:03 +01:00
|
|
|
id = params[:procedure_id] || params[:id]
|
2015-12-21 12:02:53 +01:00
|
|
|
|
|
|
|
@procedure = current_administrateur.procedures.find(id)
|
|
|
|
|
2015-12-24 15:57:03 +01:00
|
|
|
rescue ActiveRecord::RecordNotFound
|
2017-07-13 10:16:55 +02:00
|
|
|
flash.alert = 'Procédure inexistante'
|
2015-12-24 15:57:03 +01:00
|
|
|
redirect_to admin_procedures_path, status: 404
|
|
|
|
end
|
|
|
|
|
|
|
|
def procedure_locked?
|
2015-12-21 14:40:28 +01:00
|
|
|
if @procedure.locked?
|
2015-12-24 15:57:03 +01:00
|
|
|
flash.alert = 'Procédure verrouillée'
|
|
|
|
redirect_to admin_procedure_path(id: @procedure.id)
|
2015-12-21 12:02:53 +01:00
|
|
|
end
|
|
|
|
end
|
2018-08-13 17:49:15 +02:00
|
|
|
|
|
|
|
def reset_procedure
|
|
|
|
if @procedure.brouillon_avec_lien?
|
|
|
|
@procedure.reset!
|
|
|
|
end
|
|
|
|
end
|
2015-10-23 16:19:55 +02:00
|
|
|
end
|