From 42c706037211cbda626d321db4058c35635772bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Delmaire=20Lo=C3=AFc?= Date: Wed, 22 Jan 2025 14:47:09 +0100 Subject: [PATCH] Rename/split modalities with or without france connect Better that way, clearer. Make a symlink for the display block, in order to keep the same code, drying things. --- ...odalite_with_france_connect_controller.js} | 0 .../_modalities.html.erb | 1 - .../_modalities_with_france_connect.html.erb} | 20 +++++++++---------- .../blocks/default/_modalities.html.erb | 2 +- .../_modalities_with_france_connect.html.erb | 1 + config/authorization_definitions.yml | 4 ++-- .../api_impot_particulier.yml | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) rename app/javascript/controllers/{choose_modalite_impot_particulier_controller.js => choose_modalite_with_france_connect_controller.js} (100%) delete mode 120000 app/views/authorization_request_forms/blocks/api_impot_particulier/_modalities.html.erb rename app/views/authorization_request_forms/blocks/{api_impot_particulier_sandbox/_modalities.html.erb => default/_modalities_with_france_connect.html.erb} (76%) create mode 120000 app/views/authorization_requests/blocks/default/_modalities_with_france_connect.html.erb diff --git a/app/javascript/controllers/choose_modalite_impot_particulier_controller.js b/app/javascript/controllers/choose_modalite_with_france_connect_controller.js similarity index 100% rename from app/javascript/controllers/choose_modalite_impot_particulier_controller.js rename to app/javascript/controllers/choose_modalite_with_france_connect_controller.js diff --git a/app/views/authorization_request_forms/blocks/api_impot_particulier/_modalities.html.erb b/app/views/authorization_request_forms/blocks/api_impot_particulier/_modalities.html.erb deleted file mode 120000 index b2e497325..000000000 --- a/app/views/authorization_request_forms/blocks/api_impot_particulier/_modalities.html.erb +++ /dev/null @@ -1 +0,0 @@ -../api_impot_particulier_sandbox/_modalities.html.erb \ No newline at end of file diff --git a/app/views/authorization_request_forms/blocks/api_impot_particulier_sandbox/_modalities.html.erb b/app/views/authorization_request_forms/blocks/default/_modalities_with_france_connect.html.erb similarity index 76% rename from app/views/authorization_request_forms/blocks/api_impot_particulier_sandbox/_modalities.html.erb rename to app/views/authorization_request_forms/blocks/default/_modalities_with_france_connect.html.erb index 970e644c9..277ce7b03 100644 --- a/app/views/authorization_request_forms/blocks/api_impot_particulier_sandbox/_modalities.html.erb +++ b/app/views/authorization_request_forms/blocks/default/_modalities_with_france_connect.html.erb @@ -4,24 +4,24 @@ <%= f.info_for(:modalities) %> -
+
- <%= - f.dsfr_radio_buttons :modalities, - @authorization_request.available_modalities, + <%= + f.dsfr_radio_buttons :modalities, + @authorization_request.available_modalities, required: true, multiple: true, - radio_group_class: "fr-radio-rich", + radio_group_class: "fr-radio-rich", fieldset_element_class: "small", checked: ->(value) { @authorization_request.modalities.include?(value) }, - input_options: { - "data-action": "click->choose-modalite-impot-particulier#trigger", - "data-choose-modalite-impot-particulier-target": "modality" + input_options: { + "data-action": "click->choose-modalite-with-france-connect#trigger", + "data-choose-modalite-with-france-connect-target": "modality" } %>
-
+
<% france_connect_authorizations = current_organization.valid_authorizations_of(AuthorizationRequest::FranceConnect).map(&:decorate) %> <% if france_connect_authorizations.empty? %> @@ -38,7 +38,7 @@ <% else %> <% options = france_connect_authorizations.map{ |authorization| [authorization.name_for_select, authorization.id] } %> <% selected_option = @authorization_request.france_connect_authorization_id || france_connect_authorizations.first.id %> - <%= f.dsfr_select :france_connect_authorization_id, options_for_select(options, selected_option), class: %w[fr-select], include_blank: "Sélectionner une option", required: true, input_options: { "data-choose-modalite-impot-particulier-target": "franceConnectSelector" } %> + <%= f.dsfr_select :france_connect_authorization_id, options_for_select(options, selected_option), class: %w[fr-select], include_blank: "Sélectionner une option", required: true, input_options: { "data-choose-modalite-with-france-connect-target": "franceConnectSelector" } %> <% end %>
diff --git a/app/views/authorization_requests/blocks/default/_modalities.html.erb b/app/views/authorization_requests/blocks/default/_modalities.html.erb index 15012970e..da19c2c13 100644 --- a/app/views/authorization_requests/blocks/default/_modalities.html.erb +++ b/app/views/authorization_requests/blocks/default/_modalities.html.erb @@ -2,7 +2,7 @@ <% if f.wording_for('modalities.intro') %> <%= f.wording_for('modalities.intro').html_safe %> <% end %> - + <% modalities = @authorization_request.modalities.is_a?(Array) ? @authorization_request.modalities : [@authorization_request.modalities] %>
    <% modalities.each do |modality| %> diff --git a/app/views/authorization_requests/blocks/default/_modalities_with_france_connect.html.erb b/app/views/authorization_requests/blocks/default/_modalities_with_france_connect.html.erb new file mode 120000 index 000000000..9528882e8 --- /dev/null +++ b/app/views/authorization_requests/blocks/default/_modalities_with_france_connect.html.erb @@ -0,0 +1 @@ +_modalities.html.erb \ No newline at end of file diff --git a/config/authorization_definitions.yml b/config/authorization_definitions.yml index bc420187e..aeb66fd2d 100644 --- a/config/authorization_definitions.yml +++ b/config/authorization_definitions.yml @@ -339,7 +339,7 @@ shared: - name: basic_infos - name: personal_data - name: legal - - name: modalities + - name: modalities_with_france_connect - name: scopes - name: contacts - name: operational_acceptance @@ -482,7 +482,7 @@ shared: - name: basic_infos - name: personal_data - name: legal - - name: modalities + - name: modalities_with_france_connect - name: scopes - name: contacts scopes: *api_impot_particulier_scopes diff --git a/config/authorization_request_forms/api_impot_particulier.yml b/config/authorization_request_forms/api_impot_particulier.yml index 6a1e54b68..757ec36db 100644 --- a/config/authorization_request_forms/api_impot_particulier.yml +++ b/config/authorization_request_forms/api_impot_particulier.yml @@ -36,7 +36,7 @@ api-impot-particulier-sandbox: - name: basic_infos - name: personal_data - name: legal - - name: modalities + - name: modalities_with_france_connect - name: scopes - name: contacts @@ -89,7 +89,7 @@ api-impot-particulier-production-editeur: - name: basic_infos - name: personal_data - name: legal - - name: modalities + - name: modalities_with_france_connect - name: scopes - name: contacts - name: operational_acceptance