Small refactor
This commit is contained in:
parent
7ec83f414d
commit
11f8e7a3f9
1 changed files with 6 additions and 4 deletions
|
@ -1,14 +1,12 @@
|
|||
module Manager
|
||||
class ProceduresController < Manager::ApplicationController
|
||||
def whitelist
|
||||
procedure = Procedure.find(params[:id])
|
||||
procedure.whitelist!
|
||||
flash[:notice] = "Démarche whitelistée."
|
||||
redirect_to manager_procedure_path(procedure)
|
||||
end
|
||||
|
||||
def draft
|
||||
procedure = Procedure.find(params[:id])
|
||||
if procedure.dossiers.empty?
|
||||
procedure.draft!
|
||||
flash[:notice] = "La démarche a bien été passée en brouillon."
|
||||
|
@ -19,14 +17,12 @@ module Manager
|
|||
end
|
||||
|
||||
def hide
|
||||
procedure = Procedure.find(params[:id])
|
||||
procedure.hide!
|
||||
flash[:notice] = "La démarche a bien été supprimée, en cas d'erreur contactez un développeur."
|
||||
redirect_to manager_procedures_path
|
||||
end
|
||||
|
||||
def add_administrateur
|
||||
procedure = Procedure.find(params[:id])
|
||||
administrateur = Administrateur.find_by(email: params[:email])
|
||||
if administrateur
|
||||
procedure.administrateurs << administrateur
|
||||
|
@ -36,5 +32,11 @@ module Manager
|
|||
end
|
||||
redirect_to manager_procedure_path(procedure)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def procedure
|
||||
Procedure.find(params[:id])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue