Add constants

This commit is contained in:
gregoirenovel 2018-02-19 11:35:45 +01:00
parent 86d867a7ea
commit 08f364ccdc
3 changed files with 7 additions and 4 deletions

View file

@ -4,6 +4,9 @@ class Admin::AccompagnateursController < AdminController
before_action :retrieve_procedure
ASSIGN = 'assign'
NOT_ASSIGN = 'not_assign'
def show
assign_scope = @procedure.gestionnaires
@ -47,10 +50,10 @@ class Admin::AccompagnateursController < AdminController
to = params[:to]
case to
when 'assign'
when ASSIGN
gestionnaire.assign_to_procedure(procedure)
flash.notice = "L'accompagnateur a bien été affecté"
when 'not_assign'
when NOT_ASSIGN
gestionnaire.remove_from_procedure(procedure)
flash.notice = "L'accompagnateur a bien été désaffecté"
end

View file

@ -9,7 +9,7 @@
- @accompagnateurs_assign.each do |accompagnateur|
%tr
%td.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center
%a.btn.btn-primary{ href: "#{admin_procedure_accompagnateurs_path(procedure_id: @procedure.id, accompagnateur_id: accompagnateur.id, to: 'not_assign')}", 'data-method' => 'put' }
%a.btn.btn-primary{ href: "#{admin_procedure_accompagnateurs_path(procedure_id: @procedure.id, accompagnateur_id: accompagnateur.id, to: Admin::AccompagnateursController::NOT_ASSIGN)}", 'data-method' => 'put' }
.fa.fa-arrow-left
%td{ style: 'padding-top: 11px; font-size: 15px; text-align: right;' }= accompagnateur.email

View file

@ -16,7 +16,7 @@
%tr
%td.col-xs-11{ style: 'padding-top: 11px; font-size: 15px;' }= accompagnateur.email
%td.center
%a.btn.btn-success.gestionnaire-affectation{ href: "#{admin_procedure_accompagnateurs_path(procedure_id: @procedure.id, accompagnateur_id: accompagnateur.id, to: 'assign')}", 'data-method' => 'put' }
%a.btn.btn-success.gestionnaire-affectation{ href: "#{admin_procedure_accompagnateurs_path(procedure_id: @procedure.id, accompagnateur_id: accompagnateur.id, to: Admin::AccompagnateursController::ASSIGN)}", 'data-method' => 'put' }
.fa.fa-arrow-right