From cb8ae29ff71141072d1b3092c9ffd2ceccbef213 Mon Sep 17 00:00:00 2001 From: Isabelle Lafont Date: Wed, 3 Apr 2024 15:39:24 +0200 Subject: [PATCH 01/13] Change header name and config fr.yml --- .../instruction/authorization_requests/index.html.erb | 8 ++++---- config/locales/fr.yml | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/views/instruction/authorization_requests/index.html.erb b/app/views/instruction/authorization_requests/index.html.erb index 881850255..1438c71af 100644 --- a/app/views/instruction/authorization_requests/index.html.erb +++ b/app/views/instruction/authorization_requests/index.html.erb @@ -35,12 +35,12 @@ <% %w[ - id status - name created_at - type - form_name + organization + project_name + target_api + applicant_email actions ].each do |attr| %> diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 4e18db8b6..757ec7973 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -274,12 +274,12 @@ fr: table: caption: Liste des demandes en cours header: - id: Identifiant - name: Intitulé de la demande - created_at: Date - type: Type de données - form_name: Nom du formulaire status: Statut + created_at: Date + organization: Organisation + project_name: Projet + target_api: Nom de l'API + applicant_email: Email du demandeur actions: Actions actions: show: Consulter From cf83814fbc320269bb42a7c2aa095c47bcb8378e Mon Sep 17 00:00:00 2001 From: Isabelle Lafont Date: Wed, 3 Apr 2024 16:38:29 +0200 Subject: [PATCH 02/13] Rearrange instruction authorization request column list order --- .../authorization_requests/index.html.erb | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/views/instruction/authorization_requests/index.html.erb b/app/views/instruction/authorization_requests/index.html.erb index 1438c71af..575b962f2 100644 --- a/app/views/instruction/authorization_requests/index.html.erb +++ b/app/views/instruction/authorization_requests/index.html.erb @@ -60,9 +60,6 @@ <% @authorization_requests.each do |authorization_request| %> - - <%= authorization_request.id %> - <%= authorization_request_status_badge(authorization_request) %> @@ -70,17 +67,20 @@ <%= authorization_request_reopening_badge %> <% end %> - - <%= authorization_request.name %> - - <%= authorization_request.created_at %> + <%= authorization_request.created_at.strftime("%d/%m/%y") %> + + + <%= authorization_request.applicant.current_organization.raison_sociale %> + + + <%= authorization_request.name %> - + <%= authorization_request.definition.name %> - - <%= authorization_request.form.name %> + + <%= authorization_request.applicant.email %> <%= link_to t('.table.actions.show'), instruction_authorization_request_path(authorization_request), class: %w(fr-btn fr-btn--sm) %> From 2841f41e6671d2954b5cb0e409dd9ef9261c6909 Mon Sep 17 00:00:00 2001 From: Isabelle Lafont Date: Wed, 3 Apr 2024 16:56:00 +0200 Subject: [PATCH 03/13] Fix cucumber test --- features/step_definitions/authorization_requests_steps.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/step_definitions/authorization_requests_steps.rb b/features/step_definitions/authorization_requests_steps.rb index 279f3db2b..c9bf6b52f 100644 --- a/features/step_definitions/authorization_requests_steps.rb +++ b/features/step_definitions/authorization_requests_steps.rb @@ -150,9 +150,9 @@ end # https://rubular.com/r/dRUFmK5dzDpjJv -Alors(/je vois (\d+) demandes? d'habilitation(?: "([^"]+)")?(?:(?: en)? (.+))?/) do |count, type, status| - if type.present? - expect(page).to have_css('.authorization-request-definition-name', text: type, count:) +Alors(/je vois (\d+) demandes? d'habilitation(?: "([^"]+)")?(?:(?: en)? (.+))?/) do |count, target_api, status| + if target_api.present? + expect(page).to have_css('.authorization-request-target-api', text: target_api, count:) else expect(page).to have_css('.authorization-request', count:) end From 3b27efab1a15c13e10f8bb9058565cdb42ff4dca Mon Sep 17 00:00:00 2001 From: Mehdi Farsi Date: Mon, 8 Apr 2024 09:29:18 +0200 Subject: [PATCH 04/13] add badges locales for instruction --- config/locales/fr.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 757ec7973..9e6397f0d 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -275,7 +275,7 @@ fr: caption: Liste des demandes en cours header: status: Statut - created_at: Date + created_at: Date de création organization: Organisation project_name: Projet target_api: Nom de l'API @@ -283,6 +283,14 @@ fr: actions: Actions actions: show: Consulter + status: + draft: Brouillon + changes_requested: A modifier + submitted: En cours + validated: Validée + refused: Refusée + archived: Archivée/supprimée + revoked: Révoquée moderation_buttons: title: Instruire la demande refuse: Refuser From 2a1bb358736e1f4ec11c833c950c58deeb118939 Mon Sep 17 00:00:00 2001 From: Mehdi Farsi Date: Mon, 8 Apr 2024 09:31:36 +0200 Subject: [PATCH 05/13] call to authorization_request.organization + target-api => definition-name --- app/views/instruction/authorization_requests/index.html.erb | 4 ++-- features/step_definitions/authorization_requests_steps.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/instruction/authorization_requests/index.html.erb b/app/views/instruction/authorization_requests/index.html.erb index 575b962f2..d9a0621e0 100644 --- a/app/views/instruction/authorization_requests/index.html.erb +++ b/app/views/instruction/authorization_requests/index.html.erb @@ -71,12 +71,12 @@ <%= authorization_request.created_at.strftime("%d/%m/%y") %> - <%= authorization_request.applicant.current_organization.raison_sociale %> + <%= authorization_request.organization.raison_sociale %> <%= authorization_request.name %> - + <%= authorization_request.definition.name %> diff --git a/features/step_definitions/authorization_requests_steps.rb b/features/step_definitions/authorization_requests_steps.rb index c9bf6b52f..4c9ef7003 100644 --- a/features/step_definitions/authorization_requests_steps.rb +++ b/features/step_definitions/authorization_requests_steps.rb @@ -150,9 +150,9 @@ end # https://rubular.com/r/dRUFmK5dzDpjJv -Alors(/je vois (\d+) demandes? d'habilitation(?: "([^"]+)")?(?:(?: en)? (.+))?/) do |count, target_api, status| - if target_api.present? - expect(page).to have_css('.authorization-request-target-api', text: target_api, count:) +Alors(/je vois (\d+) demandes? d'habilitation(?: "([^"]+)")?(?:(?: en)? (.+))?/) do |count, definition_name, status| + if definition_name.present? + expect(page).to have_css('.authorization-request-definition-name', text: definition_name, count:) else expect(page).to have_css('.authorization-request', count:) end From e0ca1ab6f8f460c8c9f94d394e08dbd358f68307 Mon Sep 17 00:00:00 2001 From: Mehdi Farsi Date: Mon, 8 Apr 2024 09:32:47 +0200 Subject: [PATCH 06/13] display the right badge status translation depending on scope: --- app/helpers/application_helper.rb | 13 +++++++++++-- .../authorization_requests/index.html.erb | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b400882b2..8b711f996 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -13,10 +13,10 @@ def displays_provider_logo? @authorization_definition.present? && @display_provider_logo_in_header # rubocop:disable Naming/HelperInstanceVariable end - def authorization_request_status_badge(authorization_request, no_icon: false) + def authorization_request_status_badge(authorization_request, no_icon: false, scope: nil) content_tag( :span, - t("authorization_request.status.#{authorization_request.state}"), + t(authorization_request_status_badge_translation(authorization_request, scope)), class: [ 'fr-badge', no_icon ? 'fr-badge--no-icon' : nil, @@ -50,4 +50,13 @@ def authorization_request_reopening_badge class: 'fr-badge fr-badge--no-icon fr-badge--purple-glycine', ) end + + def authorization_request_status_badge_translation(authorization_request, scope) + case scope + when :instruction, 'instruction' + "instruction.authorization_requests.index.status.#{authorization_request.state}" + else + "authorization_request.status.#{authorization_request.state}" + end + end end diff --git a/app/views/instruction/authorization_requests/index.html.erb b/app/views/instruction/authorization_requests/index.html.erb index d9a0621e0..f181996cb 100644 --- a/app/views/instruction/authorization_requests/index.html.erb +++ b/app/views/instruction/authorization_requests/index.html.erb @@ -61,7 +61,7 @@ <% @authorization_requests.each do |authorization_request| %> - <%= authorization_request_status_badge(authorization_request) %> + <%= authorization_request_status_badge(authorization_request, scope: :instruction) %> <% if authorization_request.reopening? %> <%= authorization_request_reopening_badge %> From 945a878961f4c96f8d85cb3d31ded863529a7345 Mon Sep 17 00:00:00 2001 From: Mehdi Farsi Date: Mon, 8 Apr 2024 09:33:40 +0200 Subject: [PATCH 07/13] fix N+1 for authorization_request.organization in Instruction::AuthorizationRequestController#index --- .../instruction/authorization_requests_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/instruction/authorization_requests_controller.rb b/app/controllers/instruction/authorization_requests_controller.rb index 54422cd7a..25d2a2508 100644 --- a/app/controllers/instruction/authorization_requests_controller.rb +++ b/app/controllers/instruction/authorization_requests_controller.rb @@ -5,7 +5,7 @@ class Instruction::AuthorizationRequestsController < InstructionController before_action :extract_authorization_request, except: [:index] def index - @q = policy_scope([:instruction, AuthorizationRequest]).not_archived.ransack(params[:q]) + @q = policy_scope([:instruction, AuthorizationRequest]).includes([:organization]).not_archived.ransack(params[:q]) @q.sorts = 'created_at desc' if @q.sorts.empty? @authorization_requests = @q.result(distinct: true).page(params[:page]) end From 7557d3f78fe2ad33092e09d5b939e4919290a9a2 Mon Sep 17 00:00:00 2001 From: Mehdi Farsi Date: Mon, 8 Apr 2024 09:34:28 +0200 Subject: [PATCH 08/13] exclude false unused i18n keys in i18n-tasks.yml --- config/i18n-tasks.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 2f239727a..56ae5f756 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -133,6 +133,7 @@ ignore_unused: - 'instruction.{approve,refuse,request_changes_on}_authorization_requests.create.{reopening_,}success.title' - 'gdpr_contact_mailer.delegue_protection_donnees.subject' - 'gdpr_contact_mailer.responsable_traitement.subject' +- 'instruction.authorization_requests.index.status.*' # - '{devise,kaminari,will_paginate}.*' # - 'simple_form.{yes,no}' # - 'simple_form.{placeholders,hints,labels}.*' From 4db932f6d9787e5c27898b08165d2b76a7232c18 Mon Sep 17 00:00:00 2001 From: Mehdi Farsi Date: Mon, 8 Apr 2024 10:08:12 +0200 Subject: [PATCH 09/13] move instruction index page title up --- app/views/instruction/authorization_requests/index.html.erb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/views/instruction/authorization_requests/index.html.erb b/app/views/instruction/authorization_requests/index.html.erb index f181996cb..09e3566bd 100644 --- a/app/views/instruction/authorization_requests/index.html.erb +++ b/app/views/instruction/authorization_requests/index.html.erb @@ -1,3 +1,5 @@ +

<%= t('.table.caption') %>

+ <%= search_form_for(@q, url: instruction_authorization_requests_path, html: { method: :get, data: { turbo: false }, class: %w[search-box] }) do |f| %>
@@ -28,9 +30,6 @@
- <% From a1e32b7e4a1bb39264c3d360390da7fdd7c9663b Mon Sep 17 00:00:00 2001 From: Mehdi Farsi Date: Mon, 8 Apr 2024 11:06:59 +0200 Subject: [PATCH 10/13] add status badge icons --- app/assets/stylesheets/dsfr-extensions.css | 50 ++++++++++++++++++++++ app/helpers/application_helper.rb | 4 +- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/dsfr-extensions.css b/app/assets/stylesheets/dsfr-extensions.css index 7d138994f..253d60991 100644 --- a/app/assets/stylesheets/dsfr-extensions.css +++ b/app/assets/stylesheets/dsfr-extensions.css @@ -60,3 +60,53 @@ .fr-bg-alt-blue-france { background-color: var(--background-action-low-blue-france); } + + +/* Badge Icon */ + +.fr-badge--purple-glycine::before, +.fr-badge--secondary::before { + content: "" +} + +.fr-badge.fr-badge--info::before, +.fr-badge--sm.fr-badge--info::before { + -webkit-mask-image: url("icons/system/time-fill.svg"); + mask-image: url("icons/system/time-fill.svg"); +} + +.fr-badge.fr-badge--success::before, +.fr-badge--sm.fr-badge--success::before { + -webkit-mask-image: url("icons/system/check-line.svg"); + mask-image: url("icons/system/check-line.svg"); +} + +.fr-badge.fr-badge--error::before, +.fr-badge--sm.fr-badge--error::before { + -webkit-mask-image: url("icons/system/fr--error-fill.svg"); + mask-image: url("icons/system/fr--error-fill.svg"); +} + +.fr-badge.fr-badge--warning::before, +.fr-badge--sm.fr-badge--warning::before { + -webkit-mask-image: url("icons/system/fr--warning-fill.svg"); + mask-image: url("icons/system/fr--warning-fill.svg"); +} + +.fr-badge.fr-badge--new::before, +.fr-badge--sm.fr-badge--new::before { + -webkit-mask-image: url("icons/weather/flashlight-fill.svg"); + mask-image: url("icons/weather/flashlight-fill.svg"); +} + +.fr-badge.fr-badge--purple-glycine::before, +.fr-badge--sm.fr-badge--purple-glycine::before { + -webkit-mask-image: url("icons/others/recycle-fill.svg"); + mask-image: url("icons/others/recycle-fill.svg"); +} + +.fr-badge.fr-badge--secondary::before, +.fr-badge--sm.fr-badge--secondary::before { + -webkit-mask-image: url("icons/business/archive-fill.svg"); + mask-image: url("icons/business/archive-fill.svg"); +} \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8b711f996..3a6ca0562 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -37,7 +37,7 @@ def authorization_request_status_badge_class(authorization_request) when 'validated' %w[fr-badge--success] when 'refused', 'revoked' - %w[fr-badge--error fr-badge--no-icon] + %w[fr-badge--error] when 'archived' %w[fr-badge--secondary] end @@ -47,7 +47,7 @@ def authorization_request_reopening_badge content_tag( :span, t('authorization_request.reopening'), - class: 'fr-badge fr-badge--no-icon fr-badge--purple-glycine', + class: 'fr-badge fr-badge--purple-glycine', ) end From e20434ef9e6cc357c17b69e8371e06c4e7a6195d Mon Sep 17 00:00:00 2001 From: Mehdi Farsi Date: Mon, 8 Apr 2024 11:20:52 +0200 Subject: [PATCH 11/13] change archived label wording --- config/locales/fr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 9e6397f0d..8be8105de 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -19,7 +19,7 @@ fr: submitted: En cours d'instruction validated: Validée refused: Refusée - archived: Archivée/supprimée + archived: Archivée revoked: Révoquée reopening: Mise à jour contacts: @@ -289,7 +289,7 @@ fr: submitted: En cours validated: Validée refused: Refusée - archived: Archivée/supprimée + archived: Archivée revoked: Révoquée moderation_buttons: title: Instruire la demande From 624461453ad5049980b504dadb9217ac138d66bf Mon Sep 17 00:00:00 2001 From: Mehdi Farsi Date: Mon, 8 Apr 2024 11:22:17 +0200 Subject: [PATCH 12/13] list new title type in 'il y a un titre contenant {string}' feature step --- features/step_definitions/web_steps.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index ce8abd5d0..011f72756 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -9,6 +9,7 @@ Alors('il y a un titre contenant {string}') do |text| elements = [ page.all('h1').first, + page.all('p.fr-h2').first, page.all('h2').first, page.all('table caption').first, ] From de94c6e4de88f8bb1c3a75e63d678278ec400dbd Mon Sep 17 00:00:00 2001 From: Mehdi Farsi Date: Mon, 8 Apr 2024 11:37:16 +0200 Subject: [PATCH 13/13] add colors to badges --- app/assets/stylesheets/dsfr-extensions.css | 13 ++++++++++++- app/helpers/application_helper.rb | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/dsfr-extensions.css b/app/assets/stylesheets/dsfr-extensions.css index 253d60991..c546f8db5 100644 --- a/app/assets/stylesheets/dsfr-extensions.css +++ b/app/assets/stylesheets/dsfr-extensions.css @@ -61,7 +61,6 @@ background-color: var(--background-action-low-blue-france); } - /* Badge Icon */ .fr-badge--purple-glycine::before, @@ -109,4 +108,16 @@ .fr-badge--sm.fr-badge--secondary::before { -webkit-mask-image: url("icons/business/archive-fill.svg"); mask-image: url("icons/business/archive-fill.svg"); +} + +/* Badge color */ + +fr-badge--grey { + background-color: var(--grey-975-75-hover); + color: var(--grey-50-1000); +} + +.fr-badge.fr-badge--secondary { + background-color: var(--grey-50-1000); + color: var(--grey-1000-50); } \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3a6ca0562..ac5bb563a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -29,7 +29,7 @@ def authorization_request_status_badge(authorization_request, no_icon: false, sc def authorization_request_status_badge_class(authorization_request) case authorization_request.state when 'draft' - %w[fr-badge--purple-glycine fr-badge--no-icon] + %w[fr-badge--grey fr-badge--no-icon] when 'changes_requested' %w[fr-badge--warning] when 'submitted'
- <%= t('.table.caption') %> -