-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a shared view _modalities_with_france_connect: API Impot Particulier make a symlink for his modalities block. Moreover rename the stimulus controller, to make it more generic.
- Loading branch information
Showing
6 changed files
with
60 additions
and
39 deletions.
There are no files selected for viewing
File renamed without changes.
1 change: 1 addition & 0 deletions
1
app/views/authorization_request_forms/blocks/api_impot_particulier/_modalities.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../default/_modalities_with_france_connect.html.erb |
1 change: 1 addition & 0 deletions
1
...ews/authorization_request_forms/blocks/api_impot_particulier_sandbox/_modalities.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../default/_modalities_with_france_connect.html.erb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...views/authorization_request_forms/blocks/default/_modalities_with_france_connect.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<% if @authorization_request.display_prefilled_banner_for_each_block? && @authorization_request.prefilled_data?(%i[modalities france_connect_authorization_id]) %> | ||
<%= render partial: "authorization_request_forms/shared/prefilled_banner" %> | ||
<% end %> | ||
|
||
<%= f.info_for(:modalities) %> | ||
|
||
<div data-controller="choose-modalite-with-france-connect"> | ||
<div class="fr-col-lg-9"> | ||
<%= | ||
f.dsfr_radio_buttons :modalities, | ||
@authorization_request.available_modalities, | ||
required: true, | ||
multiple: true, | ||
radio_group_class: "fr-radio-rich", | ||
fieldset_element_class: "small", | ||
checked: ->(value) { @authorization_request.modalities.include?(value) }, | ||
input_options: { | ||
"data-action": "click->choose-modalite-with-france-connect#trigger", | ||
"data-choose-modalite-with-france-connect-target": "modality" | ||
} | ||
%> | ||
</div> | ||
|
||
<div class="fr-col-lg-9 fr-mb-5w <%= 'fr-hidden' unless @authorization_request.with_france_connect? %>" data-choose-modalite-with-france-connect-target="franceConnectContainer"> | ||
<% france_connect_authorizations = current_organization.valid_authorizations_of(AuthorizationRequest::FranceConnect).map(&:decorate) %> | ||
|
||
<% if france_connect_authorizations.empty? %> | ||
<div class="fr-callout red-callout"> | ||
<h3 class="fr-callout__title"> | ||
<%= t("authorization_request_forms.api_impot_particulier_sandbox.modalities.callout.title") %> | ||
</h3> | ||
<p class="fr-callout__text fr-my-3w"> | ||
<%= t("authorization_request_forms.api_impot_particulier_sandbox.modalities.callout.content") %> | ||
</p> | ||
<%= link_to t("authorization_request_forms.api_impot_particulier_sandbox.modalities.callout.link"), new_authorization_request_form_path("france-connect"), class: "fr-link fr-btn--icon-right fr-icon-arrow-right-line" %> | ||
</div> | ||
|
||
<% 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-with-france-connect-target": "franceConnectSelector" } %> | ||
<% end %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters