From 6290aeb1098cbbe271ea64d3353ad50ee9ed9b95 Mon Sep 17 00:00:00 2001 From: Caillou <6117264+JeSuisUnCaillou@users.noreply.github.com> Date: Tue, 21 Jan 2025 13:19:53 +0100 Subject: [PATCH] display buttons to reopen stages --- .../components/reopen_authorizations.css | 18 +++++++++++ app/models/authorization.rb | 4 +++ app/views/reopen_authorizations/new.html.erb | 31 ++++++++++++++++--- config/locales/fr.yml | 3 ++ 4 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 app/assets/stylesheets/components/reopen_authorizations.css diff --git a/app/assets/stylesheets/components/reopen_authorizations.css b/app/assets/stylesheets/components/reopen_authorizations.css new file mode 100644 index 000000000..b9e414fe3 --- /dev/null +++ b/app/assets/stylesheets/components/reopen_authorizations.css @@ -0,0 +1,18 @@ +.reopen-stage-buttons-container { + width: 100%; + display: flex; + align-items: flex-start; +} + +.reopen-stage-buttons { + flex: 1; + display: flex; + flex-direction: column; + gap: 1rem; +} + +.reopen-stage-cancel { + display: flex; + align-items: flex-end; + height: 100%; +} \ No newline at end of file diff --git a/app/models/authorization.rb b/app/models/authorization.rb index 1bc59f7eb..40f5f7b60 100644 --- a/app/models/authorization.rb +++ b/app/models/authorization.rb @@ -78,6 +78,10 @@ def definition authorization_request_class.constantize.definition end + def can_reopen_to_another_stage? + authorization_request.available_classes_for_reopen.count > 1 + end + private def affect_snapshot_documents(request_as_validated) diff --git a/app/views/reopen_authorizations/new.html.erb b/app/views/reopen_authorizations/new.html.erb index 1e333bd51..4dccf3c08 100644 --- a/app/views/reopen_authorizations/new.html.erb +++ b/app/views/reopen_authorizations/new.html.erb @@ -6,17 +6,38 @@

<%= t('.title', authorization_name: @authorization.name) %>

-

<%= t('.disclaimer').html_safe %>

+ + <% if @authorization.can_reopen_to_another_stage? %> +
+

Vous avez la possibilité de mettre à jour deux versions de cette habilitation

+

Cette habilitation existe en version bac à sable et production.

+
+ <% end %> diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 54f62cd3f..ed922759d 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -446,6 +446,9 @@ fr: Votre habilitation restera valide quelque soit l'issue de la demande de mise à jour. cancel: Annuler reopen: Mettre à jour l'habilitation + reopen_to_stage: + sandbox: Mettre à jour l'habilitation bac à sable + production: Mettre à jour l'habilitation de production create: success: title: L'habilitation %{name} a bien été réouverte