diff --git a/app/controllers/admin/accompagnateurs_controller.rb b/app/controllers/admin/accompagnateurs_controller.rb index 86adfbe91..7222fc0ca 100644 --- a/app/controllers/admin/accompagnateurs_controller.rb +++ b/app/controllers/admin/accompagnateurs_controller.rb @@ -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 diff --git a/app/views/admin/accompagnateurs/_list_assign.html.haml b/app/views/admin/accompagnateurs/_list_assign.html.haml index 5160a8292..4e9171ccf 100644 --- a/app/views/admin/accompagnateurs/_list_assign.html.haml +++ b/app/views/admin/accompagnateurs/_list_assign.html.haml @@ -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 diff --git a/app/views/admin/accompagnateurs/_list_not_assign.html.haml b/app/views/admin/accompagnateurs/_list_not_assign.html.haml index 9cecdbee1..bba53bfd1 100644 --- a/app/views/admin/accompagnateurs/_list_not_assign.html.haml +++ b/app/views/admin/accompagnateurs/_list_not_assign.html.haml @@ -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