Skip to content

Commit

Permalink
Make sure at least one option is selected in the solicitaiton form
Browse files Browse the repository at this point in the history
  • Loading branch information
n-b committed Mar 18, 2020
1 parent 0bbe9e8 commit 3b99faa
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
// = require rails-ujs

// = require_tree ./pages
// = require_tree ./shared
5 changes: 5 additions & 0 deletions app/assets/stylesheets/pages.sass
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ section.section#section-details
margin-top: 1em
margin-top: var(--space-s)

section.section#section-formulaire
#solicitation-options .panel
padding: 1em
padding: var(--space-s)

.section#stats
padding: 2em

Expand Down
6 changes: 4 additions & 2 deletions app/views/landings/_form.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
- @solicitation.form_info.each do |k,v|
= f.hidden_field "form_info[#{k}]", value: v
- if landing_options.present?
.form__group
= f.label :options
.form__group#solicitation-options
= f.label :options, t('.select_options')
.panel
= f.fields_for :options do |fields|
- landing_options.each do |option|
.p
= fields.check_box option.slug
= fields.label option.slug, class: 'label-inline' do
= option.description.html_safe
:javascript
checkboxes_require_one("#solicitation-options", "#{ t(".select_at_least_one_option") }");
.form__group
= f.label 'description', t('.description.label')
- example = landing.description_example.presence || t('.description.default_example')
Expand Down
2 changes: 2 additions & 0 deletions config/locales/views.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ fr:
phone_number:
label: Téléphone
placeholder: 06 12 34 56 78
select_at_least_one_option: Sélectionnez au moins une case
select_options: 'Sélectionnez les cases qui correspondent à votre situation :'
siret:
label: SIRET
placeholder: 123 456 789 00010
Expand Down

0 comments on commit 3b99faa

Please sign in to comment.