demarches-normaliennes/app/controllers/new_administrateur/administrateur_controller.rb

29 lines
698 B
Ruby
Raw Normal View History

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'
2019-09-24 16:38:58 +02:00
redirect_to admin_procedures_path, status: 404
2018-11-14 16:24:34 +01:00
end
def procedure_locked?
if @procedure.locked?
flash.alert = 'Démarche verrouillée'
redirect_to admin_procedure_path(@procedure)
end
end
def reset_procedure
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