-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9258 from demarches-simplifiees/DSFR-champs
Passe les champs au DSFR
- Loading branch information
Showing
84 changed files
with
432 additions
and
161 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1 +1 @@ | ||
16.14.0 | ||
18.17.0 |
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
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
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
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
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
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,13 @@ | ||
module Dsfr | ||
class InputStatusMessageComponent < ApplicationComponent | ||
def initialize(errors_on_attribute:, error_full_messages:, described_by:) | ||
@errors_on_attribute = errors_on_attribute | ||
@error_full_messages = error_full_messages | ||
@described_by = described_by | ||
end | ||
|
||
def render? | ||
@errors_on_attribute | ||
end | ||
end | ||
end |
3 changes: 3 additions & 0 deletions
3
app/components/dsfr/input_status_message_component/input_status_message_component.html.haml
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,3 @@ | ||
.fr-messages-group{ id: @describedby_id } | ||
- @error_full_messages.each do |error_message| | ||
%p{ class: class_names('fr-message' => true, "fr-message--#{@errors_on_attribute ? 'error' : 'valid'}" => true) }= error_message |
3 changes: 3 additions & 0 deletions
3
app/components/editable_champ/annuaire_education_component.rb
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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
class EditableChamp::AnnuaireEducationComponent < EditableChamp::ComboSearchComponent | ||
def dsfr_input_classname | ||
'fr-input' | ||
end | ||
end |
7 changes: 5 additions & 2 deletions
7
app/components/editable_champ/champ_label_component/champ_label_component.html.haml
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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
= # we do this trick because some html elements should use 'label' and some should be plain paragraphs | ||
|
||
- if @champ.html_label? | ||
= @form.label @champ.main_value_name, id: @champ.labelledby_id, for: @champ.input_id, class: 'fr-label' do | ||
- render EditableChamp::ChampLabelContentComponent.new form: @form, champ: @champ, seen_at: @seen_at | ||
- elsif @champ.legend_label? | ||
%legend.fr-fieldset__legend.fr-text--regular{ id: @champ.labelledby_id }= render EditableChamp::ChampLabelContentComponent.new form: @form, champ: @champ, seen_at: @seen_at | ||
- elsif @champ.single_checkbox? | ||
-# no label to add | ||
- else | ||
.fr-label.mb-4{ id: @champ.labelledby_id } | ||
= render EditableChamp::ChampLabelContentComponent.new form: @form, champ: @champ, seen_at: @seen_at | ||
|
||
|
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 |
---|---|---|
@@ -1,2 +1,9 @@ | ||
class EditableChamp::CheckboxComponent < EditableChamp::EditableChampBaseComponent | ||
def dsfr_champ_container | ||
:fieldset | ||
end | ||
|
||
def dsfr_input_classname | ||
'fr-radio' | ||
end | ||
end |
13 changes: 9 additions & 4 deletions
13
app/components/editable_champ/checkbox_component/checkbox_component.html.haml
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 |
---|---|---|
@@ -1,4 +1,9 @@ | ||
= @form.check_box :value, | ||
{ required: @champ.required?, id: @champ.input_id, checked: @champ.true?, aria: { describedby: @champ.describedby_id }, class: class_names('required' => @champ.required?)}, | ||
'true', | ||
'false' | ||
.fr-fieldset__element | ||
.fr-checkbox-group | ||
= @form.check_box :value, | ||
{ required: @champ.required?, id: @champ.input_id, checked: @champ.true?, aria: { describedby: @champ.describedby_id }, class: class_names('required' => @champ.required?)}, | ||
'true', | ||
'false' | ||
%label.fr-label{ for: @champ.input_id, id: @champ.labelledby_id } | ||
= render EditableChamp::ChampLabelContentComponent.new form: @form, champ: @champ, seen_at: @seen_at | ||
|
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
3 changes: 2 additions & 1 deletion
3
app/components/editable_champ/communes_component/communes_component.en.yml
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
--- | ||
en: | ||
postal_code: Enter the postal code then select the municipality from the list | ||
postal_code: "Enter <strong>the postal code</strong>" | ||
commune: "Select <strong>the municipality</strong> from the list" | ||
not_found: No municipality found for postal code %{postal_code}. Please check that you haven't made any mistakes. |
3 changes: 2 additions & 1 deletion
3
app/components/editable_champ/communes_component/communes_component.fr.yml
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
--- | ||
fr: | ||
postal_code: Renseignez le code postal puis sélectionnez la commune dans la liste | ||
postal_code: "Renseignez le <strong>code postal</strong>" | ||
commune: "Sélectionnez la commune dans la liste" | ||
not_found: Aucune commune trouvée pour le code postal %{postal_code}. Verifiez que vous n'avez pas fait d’erreur. |
28 changes: 19 additions & 9 deletions
28
app/components/editable_champ/communes_component/communes_component.html.haml
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 |
---|---|---|
@@ -1,13 +1,23 @@ | ||
%label.notice{ for: code_postal_input_id }= t('.postal_code') | ||
= @form.text_field :code_postal, required: @champ.required?, id: code_postal_input_id, class: "width-33-desktop width-100-mobile small-margin" | ||
- if @champ.code_postal? | ||
.fr-fieldset__element.fr-mb-0 | ||
.fr-input-group | ||
= @form.label :code_postal, t('.postal_code').html_safe, class: 'fr-label', for: code_postal_input_id | ||
= @form.text_field :code_postal, required: @champ.required?, id: code_postal_input_id, class: "width-33-desktop width-100-mobile small-margin fr-input" | ||
- if @champ.code_postal? | ||
- if commune_options.empty? | ||
.fr-error-text.mb-4= t('.not_found', postal_code: @champ.code_postal) | ||
|
||
.fr-fieldset__element.fr-mb-0 | ||
- if commune_options.empty? | ||
.fr-error-text.mb-4= t('.not_found', postal_code: @champ.code_postal) | ||
-# noop | ||
- elsif commune_options.size <= 3 | ||
%fieldset.radios | ||
%fieldset.fr-fieldset | ||
.fr-fieldset__legend--regular.fr-fieldset__legend= t('.commune').html_safe | ||
|
||
- commune_options.each.with_index do |(option, value), index| | ||
%label | ||
= @form.radio_button :value, value, checked: @champ.selected == value, id: index == 0 ? @champ.input_id : nil | ||
= option | ||
.fr-fieldset__element | ||
.fr-radio-group | ||
= @form.radio_button :value, value, checked: @champ.selected == value, id: index == 0 ? @champ.input_id : "radio-#{index}-#{value.parameterize}" | ||
= @form.label :value, option, for: index == 0 ? @champ.input_id : "radio-#{index}-#{value.parameterize}", class: 'fr-label' | ||
- else | ||
= @form.select :value, commune_options, commune_select_options, required: @champ.required?, id: @champ.input_id, aria: { describedby: @champ.describedby_id }, class: "width-33-desktop width-100-mobile" | ||
= @form.label :value, t('.commune').html_safe, for: @champ.input_id, class: 'fr-label' | ||
= @form.select :value, commune_options, commune_select_options, required: @champ.required?, id: @champ.input_id, aria: { describedby: @champ.describedby_id }, class: "width-33-desktop width-100-mobile fr-select" |
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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
class EditableChamp::DateComponent < EditableChamp::EditableChampBaseComponent | ||
def dsfr_input_classname | ||
'fr-input' | ||
end | ||
end |
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
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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
class EditableChamp::DecimalNumberComponent < EditableChamp::EditableChampBaseComponent | ||
def dsfr_input_classname | ||
'fr-input' | ||
end | ||
end |
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
2 changes: 1 addition & 1 deletion
2
app/components/editable_champ/departements_component/departements_component.html.haml
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 |
---|---|---|
@@ -1 +1 @@ | ||
= @form.select :value, options, select_options, required: @champ.required?, id: @champ.input_id, aria: { describedby: @champ.describedby_id }, class: "width-33-desktop width-100-mobile" | ||
= @form.select :value, options, select_options, required: @champ.required?, id: @champ.input_id, aria: { describedby: @champ.describedby_id }, class: "fr-select" |
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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
class EditableChamp::DgfipComponent < EditableChamp::EditableChampBaseComponent | ||
def dsfr_input_classname | ||
'fr-input' | ||
end | ||
end |
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
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
Oops, something went wrong.