From 9a55cd8002ebe8421ae52d62e015089b80c4b674 Mon Sep 17 00:00:00 2001 From: benoitqueyron <72251526+Benoit-MINT@users.noreply.github.com> Date: Fri, 18 Oct 2024 11:29:29 +0200 Subject: [PATCH] correction affichage service au dsfr --- app/assets/stylesheets/table_service.scss | 5 --- .../administrateurs/services_controller.rb | 2 +- .../administrateurs/services/index.html.haml | 35 +++++++++++-------- 3 files changed, 22 insertions(+), 20 deletions(-) delete mode 100644 app/assets/stylesheets/table_service.scss diff --git a/app/assets/stylesheets/table_service.scss b/app/assets/stylesheets/table_service.scss deleted file mode 100644 index 6d03c1f30..000000000 --- a/app/assets/stylesheets/table_service.scss +++ /dev/null @@ -1,5 +0,0 @@ -@import "constants"; - -.change { - width: 300px; -} diff --git a/app/controllers/administrateurs/services_controller.rb b/app/controllers/administrateurs/services_controller.rb index 01c14a85c..6ca2af356 100644 --- a/app/controllers/administrateurs/services_controller.rb +++ b/app/controllers/administrateurs/services_controller.rb @@ -5,8 +5,8 @@ module Administrateurs skip_before_action :alert_for_missing_siret_service, only: :edit skip_before_action :alert_for_missing_service, only: :edit def index - @services = services.ordered @procedure = procedure + @services = services.ordered.sort_by { |service| service == procedure.service ? 0 : 1 } end def new diff --git a/app/views/administrateurs/services/index.html.haml b/app/views/administrateurs/services/index.html.haml index 123e76536..b0532b69b 100644 --- a/app/views/administrateurs/services/index.html.haml +++ b/app/views/administrateurs/services/index.html.haml @@ -6,6 +6,8 @@ #services-index.fr-container %h1.fr-h2 Service + = link_to "Nouveau service", new_admin_service_path(procedure_id: @procedure.id), class: "fr-btn fr-btn--primary fr-btn--icon-left fr-icon-add-circle-line mb-3" + .fr-table.fr-table--layout-fixed %table %caption Liste des services pouvant être affectés à la démarche @@ -13,25 +15,30 @@ %tr %th{ scope: "col" } Nom - %th.change{ scope: "col" } - = link_to "Nouveau service", new_admin_service_path(procedure_id: @procedure.id), class: "fr-btn fr-btn--secondary" + %th.fr-col-4{ scope: "col" } + Actions %tbody - @services.each do |service| %tr %td = service.nom - %td.change - - if @procedure.service == service - %strong.mr-2 (Assigné) - - else - = button_to "Assigner", add_to_procedure_admin_services_path(procedure: { id: @procedure.id, service_id: service.id, }), method: :patch, class: 'link mr-2', form_class: 'inline' - = link_to('Modifier', edit_admin_service_path(service, procedure_id: @procedure.id), class: 'link my-2') - - if @procedure.service != service - = link_to 'Supprimer', - admin_service_path(service, procedure_id: @procedure.id), - method: :delete, - data: { confirm: "Confirmez vous la suppression de #{service.nom}" }, - class: 'btn btn-link ml-2' + %td.fr-col-4 + .fr-container.flex.px-0 + .fr-col-4.fr-col--middle + - if @procedure.service == service + %p.fr-badge.fr-badge--success.fr-badge--sm + ASSIGNÉ + - else + = button_to "Assigner", add_to_procedure_admin_services_path(procedure: { id: @procedure.id, service_id: service.id, }), method: :patch, class: 'fr-btn fr-btn--sm fr-btn--secondary fr-btn--icon-left fr-icon-checkbox-circle-line' + .fr-col-4 + = link_to('Modifier', edit_admin_service_path(service, procedure_id: @procedure.id), class: 'fr-btn fr-btn--sm fr-btn--secondary fr-btn--icon-left fr-icon-pencil-line') + .fr-col-4 + = button_to 'Supprimer', + admin_service_path(service, procedure_id: @procedure.id), + method: :delete, + data: { confirm: "Confirmez vous la suppression de #{service.nom}" }, + class: 'fr-btn fr-btn--sm fr-btn--secondary fr-btn--icon-left fr-icon-delete-line', + disabled: (@procedure.service == service) = render Procedure::FixedFooterComponent.new(procedure: @procedure)