From e9c143f226a370e3f3d8a168669c59c34de6535d Mon Sep 17 00:00:00 2001 From: seb-by-ouidou Date: Tue, 29 Aug 2023 14:44:49 +0000 Subject: [PATCH] fix: split into smaller PR --- .../_breadcrumbs.html.haml | 16 ------ .../admins_groups/index.html.haml | 17 ------ app/views/manager/admins_groups/show.html.erb | 57 ------------------- .../admins_group_manager_controller_spec.rb | 12 ---- .../admins_groups_controller_spec.rb | 23 -------- .../admins_group_managers_controller_spec.rb | 25 -------- .../manager/admins_groups_controller_spec.rb | 27 --------- 7 files changed, 177 deletions(-) delete mode 100644 app/views/admins_group_managers/_breadcrumbs.html.haml delete mode 100644 app/views/admins_group_managers/admins_groups/index.html.haml delete mode 100644 app/views/manager/admins_groups/show.html.erb delete mode 100644 spec/controllers/admins_group_managers/admins_group_manager_controller_spec.rb delete mode 100644 spec/controllers/admins_group_managers/admins_groups_controller_spec.rb delete mode 100644 spec/controllers/manager/admins_group_managers_controller_spec.rb delete mode 100644 spec/controllers/manager/admins_groups_controller_spec.rb diff --git a/app/views/admins_group_managers/_breadcrumbs.html.haml b/app/views/admins_group_managers/_breadcrumbs.html.haml deleted file mode 100644 index 2aee56b39..000000000 --- a/app/views/admins_group_managers/_breadcrumbs.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -#breadcrumbs.sub-header - .fr-container.flex.justify-between.align-baseline.column - %nav.fr-breadcrumb.mt-0{ role: "navigation", aria: { label: t('you_are_here', scope: [:layouts, :breadcrumb]) } } - %button.fr-breadcrumb__button{ aria: { expanded: "false", controls: "breadcrumb-1" } } - = t('show', scope: [:layouts, :breadcrumb]) - - .fr-collapse#breadcrumb-1 - %ol.fr-breadcrumb__list - %li= link_to t('root', scope: [:layouts, :breadcrumb]), root_path, class: 'fr-breadcrumb__link' - - - steps.each.with_index do |step, i| - - if i == steps.size - 1 - %li{ aria: { current: "page" } } - %span.fr-breadcrumb__link= step[0] - - else - %li= link_to step[0], step[1], class: 'fr-breadcrumb__link' diff --git a/app/views/admins_group_managers/admins_groups/index.html.haml b/app/views/admins_group_managers/admins_groups/index.html.haml deleted file mode 100644 index fc9fb0924..000000000 --- a/app/views/admins_group_managers/admins_groups/index.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -= render partial: 'admins_group_managers/breadcrumbs', - locals: { steps: [['Groupes d\'administrateurs', admins_group_manager_admins_groups_path]] } - -#admins_groups-index.container - %h1.fr-h1 Liste des groupes d'administrateurs - - %table.fr-table.width-100.mt-3 - %thead - %tr - %th{ scope: "col" } - Nom - - %tbody - - @admins_groups.each do |admins_group| - %tr - %td - = admins_group.name diff --git a/app/views/manager/admins_groups/show.html.erb b/app/views/manager/admins_groups/show.html.erb deleted file mode 100644 index e7e777c31..000000000 --- a/app/views/manager/admins_groups/show.html.erb +++ /dev/null @@ -1,57 +0,0 @@ -<%# -# Show - -This view is the template for the show page. -It renders the attributes of a resource, -as well as a link to its edit page. - -## Local variables: - -- `page`: - An instance of [Administrate::Page::Show][1]. - Contains methods for accessing the resource to be displayed on the page, - as well as helpers for describing how each attribute of the resource - should be displayed. - -[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Show -%> -<% content_for(:title) { t("administrate.actions.show_resource", name: page.page_title) } %> -<% admins_group = page.resource %> - - - -
-
- <% page.attributes.each do |attribute| %> -
- <%= t( - "helpers.label.#{resource_name}.#{attribute.name}", - default: attribute.name.titleize, - ) %> -
- -
- <%= render_field attribute, page: page %> - <% if attribute.name == 'admins_group_managers' %> - <%= form_tag(add_admins_group_manager_manager_admins_group_path(admins_group), style: 'margin-top: 1rem;') do %> - <%= email_field_tag(:emails, '', placeholder: 'Emails', autocapitalize: 'off', autocorrect: 'off', spellcheck: 'false', style: 'margin-bottom: 1rem;width:24rem;') %> - - <% end %> - <% end %> -
- <% end %> -
-
diff --git a/spec/controllers/admins_group_managers/admins_group_manager_controller_spec.rb b/spec/controllers/admins_group_managers/admins_group_manager_controller_spec.rb deleted file mode 100644 index 721188fc1..000000000 --- a/spec/controllers/admins_group_managers/admins_group_manager_controller_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -describe AdminsGroupManagers::AdminsGroupManagerController, type: :controller do - describe 'before actions: authenticate_admins_group_manager!' do - it 'is present' do - before_actions = AdminsGroupManagers::AdminsGroupManagerController - ._process_action_callbacks - .filter { |process_action_callbacks| process_action_callbacks.kind == :before } - .map(&:filter) - - expect(before_actions).to include(:authenticate_admins_group_manager!) - end - end -end diff --git a/spec/controllers/admins_group_managers/admins_groups_controller_spec.rb b/spec/controllers/admins_group_managers/admins_groups_controller_spec.rb deleted file mode 100644 index 0feaecf17..000000000 --- a/spec/controllers/admins_group_managers/admins_groups_controller_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -describe AdminsGroupManagers::AdminsGroupsController, type: :controller do - let(:admins_group_manager) { create(:admins_group_manager) } - - describe "#index" do - subject { get :index } - - context "when not logged" do - before { subject } - it { expect(response).to redirect_to(new_user_session_path) } - end - - context "when logged in" do - let!(:admins_group) { create(:admins_group, admins_group_managers: [admins_group_manager]) } - before do - sign_in(admins_group_manager.user) - subject - end - - it { expect(response).to have_http_status(:ok) } - it { expect(assigns(:admins_groups)).to include(admins_group) } - end - end -end diff --git a/spec/controllers/manager/admins_group_managers_controller_spec.rb b/spec/controllers/manager/admins_group_managers_controller_spec.rb deleted file mode 100644 index a732bdee7..000000000 --- a/spec/controllers/manager/admins_group_managers_controller_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -describe Manager::AdminsGroupManagersController, type: :controller do - let(:super_admin) { create(:super_admin) } - let(:admins_group_manager) { create(:admins_group_manager) } - - before { sign_in super_admin } - - describe '#index' do - render_views - - it 'searches admin by email' do - get :index, params: { search: admins_group_manager.email } - expect(response).to have_http_status(:success) - end - end - - describe '#show' do - render_views - - before do - get :show, params: { id: admins_group_manager.id } - end - - it { expect(response.body).to include(admins_group_manager.email) } - end -end diff --git a/spec/controllers/manager/admins_groups_controller_spec.rb b/spec/controllers/manager/admins_groups_controller_spec.rb deleted file mode 100644 index d556ec317..000000000 --- a/spec/controllers/manager/admins_groups_controller_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -describe Manager::AdminsGroupsController, type: :controller do - let(:super_admin) { create(:super_admin) } - let(:admins_group) { create(:admins_group) } - - before { sign_in super_admin } - - describe '#index' do - render_views - - before do - admins_group - get :index - end - - it { expect(response.body).to include(admins_group.name) } - end - - describe '#show' do - render_views - - before do - get :show, params: { id: admins_group.id } - end - - it { expect(response.body).to include(admins_group.name) } - end -end