From f7af01e0dc7c38b598a849f062b181b3f8c55a62 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 26 Feb 2019 16:38:58 +0100 Subject: [PATCH 1/2] Create new procedures with administrateurs --- app/controllers/admin/procedures_controller.rb | 2 +- ...101524_add_procedure_administrateur_to_administrateurs.rake} | 2 +- spec/controllers/admin/procedures_controller_spec.rb | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) rename lib/tasks/deployment/{20190214101524_add_procedure_administrateur_to_administrateurs.rake => 20190226101524_add_procedure_administrateur_to_administrateurs.rake} (91%) diff --git a/app/controllers/admin/procedures_controller.rb b/app/controllers/admin/procedures_controller.rb index ba277ae29..9f9ded6e7 100644 --- a/app/controllers/admin/procedures_controller.rb +++ b/app/controllers/admin/procedures_controller.rb @@ -67,7 +67,7 @@ class Admin::ProceduresController < AdminController end def create - @procedure = current_administrateur.admin_procedures.build(procedure_params) + @procedure = Procedure.new(procedure_params.merge(administrateurs: [current_administrateur])) @path = @procedure.path @availability = Procedure.path_availability(current_administrateur, @procedure.path) diff --git a/lib/tasks/deployment/20190214101524_add_procedure_administrateur_to_administrateurs.rake b/lib/tasks/deployment/20190226101524_add_procedure_administrateur_to_administrateurs.rake similarity index 91% rename from lib/tasks/deployment/20190214101524_add_procedure_administrateur_to_administrateurs.rake rename to lib/tasks/deployment/20190226101524_add_procedure_administrateur_to_administrateurs.rake index 78683c2c2..6843a58e2 100644 --- a/lib/tasks/deployment/20190214101524_add_procedure_administrateur_to_administrateurs.rake +++ b/lib/tasks/deployment/20190226101524_add_procedure_administrateur_to_administrateurs.rake @@ -13,6 +13,6 @@ namespace :after_party do end progress.finish - AfterParty::TaskRecord.create version: '20190214101524' + AfterParty::TaskRecord.create version: '20190226101524' end end diff --git a/spec/controllers/admin/procedures_controller_spec.rb b/spec/controllers/admin/procedures_controller_spec.rb index 64725cc03..f7dac8b68 100644 --- a/spec/controllers/admin/procedures_controller_spec.rb +++ b/spec/controllers/admin/procedures_controller_spec.rb @@ -197,6 +197,7 @@ describe Admin::ProceduresController, type: :controller do it { expect(subject.organisation).to eq(organisation) } it { expect(subject.direction).to eq(direction) } it { expect(subject.administrateur_id).to eq(admin.id) } + it { expect(subject.administrateurs).to eq([admin]) } it { expect(subject.duree_conservation_dossiers_dans_ds).to eq(duree_conservation_dossiers_dans_ds) } it { expect(subject.duree_conservation_dossiers_hors_ds).to eq(duree_conservation_dossiers_hors_ds) } end From 083698a4876482de8f79a77f9cb558349770307f Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 26 Feb 2019 17:51:26 +0100 Subject: [PATCH 2/2] Revert "Redesign admin roles menu" --- app/assets/stylesheets/switch_menu.scss | 14 +------ .../_switch_devise_profile_module.html.haml | 37 ++++++++++++------- app/views/layouts/application_old.html.haml | 2 + ...admin_procedurescontroller_index.html.haml | 1 - 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/app/assets/stylesheets/switch_menu.scss b/app/assets/stylesheets/switch_menu.scss index bd8e913ea..e9c18733c 100644 --- a/app/assets/stylesheets/switch_menu.scss +++ b/app/assets/stylesheets/switch_menu.scss @@ -1,16 +1,6 @@ #switch-menu { position: fixed; + left: 10px; bottom: 10px; - color: #FFFFFF; - list-style: none; - text-decoration: none; - padding-left: 20px; -} - -#switch-menu a, -#switch-menu a:link, -#switch-menu a:visited, -#switch-menu a:hover { - text-decoration: none; - color: #FFFFFF; + z-index: 300; } diff --git a/app/views/layouts/_switch_devise_profile_module.html.haml b/app/views/layouts/_switch_devise_profile_module.html.haml index 02f2678a2..2b13779b5 100644 --- a/app/views/layouts/_switch_devise_profile_module.html.haml +++ b/app/views/layouts/_switch_devise_profile_module.html.haml @@ -1,14 +1,25 @@ - if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect? - %ul#switch-menu - %li - Changer de rĂ´le - - if user_signed_in? - %li - = link_to(dossiers_path, id: :menu_item_procedure, title: 'Aller dans votre espace usager. Vous pourrez revenir ici ensuite') do - %i.fa.fa-users -   Usager - - if gestionnaire_signed_in? - %li - = link_to(gestionnaire_procedures_path, title: 'Aller dans votre espace instructeur. Vous pourrez revenir ici ensuite.') do - %i.fa.fa-user -   Instructeur + #switch-menu.dropdown.dropup + %button.btn.btn-default.dropdown-toggle{ type: :button, 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false } + %i.fa.fa-toggle-on + %span.caret + %ul.dropdown-menu.dropdown-menu-left + - if user_signed_in? + %li + = link_to(dossiers_path, id: :menu_item_procedure) do + %i.fa.fa-user +   + Usager + - if gestionnaire_signed_in? + %li + = link_to(gestionnaire_procedures_path) do + %i.fa.fa-user +   + Instructeur + + - if administrateur_signed_in? + %li + = link_to(admin_procedures_path) do + %i.fa.fa-user +   + Administrateur diff --git a/app/views/layouts/application_old.html.haml b/app/views/layouts/application_old.html.haml index 633e368dc..a5a6a67b8 100644 --- a/app/views/layouts/application_old.html.haml +++ b/app/views/layouts/application_old.html.haml @@ -48,4 +48,6 @@ %h1 %i.fa.fa-times{ style: 'position: fixed; top: 10; right: 30; color: white;' } + = render partial: 'layouts/switch_devise_profile_module' + = render partial: 'layouts/footer', locals: { main_container_size: main_container_size } diff --git a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml index 30c64b9bf..bdf47c5e3 100644 --- a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml +++ b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_index.html.haml @@ -31,7 +31,6 @@ = current_administrateur.procedures.archivees.count .split-hr-left - = render partial: 'layouts/switch_devise_profile_module' #infos-block