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
|
module Manager
|
||||||
class ProceduresController < Manager::ApplicationController
|
class ProceduresController < Manager::ApplicationController
|
||||||
def whitelist
|
def whitelist
|
||||||
procedure = Procedure.find(params[:id])
|
|
||||||
procedure.whitelist!
|
procedure.whitelist!
|
||||||
flash[:notice] = "Démarche whitelistée."
|
flash[:notice] = "Démarche whitelistée."
|
||||||
redirect_to manager_procedure_path(procedure)
|
redirect_to manager_procedure_path(procedure)
|
||||||
end
|
end
|
||||||
|
|
||||||
def draft
|
def draft
|
||||||
procedure = Procedure.find(params[:id])
|
|
||||||
if procedure.dossiers.empty?
|
if procedure.dossiers.empty?
|
||||||
procedure.draft!
|
procedure.draft!
|
||||||
flash[:notice] = "La démarche a bien été passée en brouillon."
|
flash[:notice] = "La démarche a bien été passée en brouillon."
|
||||||
|
@ -19,14 +17,12 @@ module Manager
|
||||||
end
|
end
|
||||||
|
|
||||||
def hide
|
def hide
|
||||||
procedure = Procedure.find(params[:id])
|
|
||||||
procedure.hide!
|
procedure.hide!
|
||||||
flash[:notice] = "La démarche a bien été supprimée, en cas d'erreur contactez un développeur."
|
flash[:notice] = "La démarche a bien été supprimée, en cas d'erreur contactez un développeur."
|
||||||
redirect_to manager_procedures_path
|
redirect_to manager_procedures_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_administrateur
|
def add_administrateur
|
||||||
procedure = Procedure.find(params[:id])
|
|
||||||
administrateur = Administrateur.find_by(email: params[:email])
|
administrateur = Administrateur.find_by(email: params[:email])
|
||||||
if administrateur
|
if administrateur
|
||||||
procedure.administrateurs << administrateur
|
procedure.administrateurs << administrateur
|
||||||
|
@ -36,5 +32,11 @@ module Manager
|
||||||
end
|
end
|
||||||
redirect_to manager_procedure_path(procedure)
|
redirect_to manager_procedure_path(procedure)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def procedure
|
||||||
|
Procedure.find(params[:id])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue