Fix hidden checkbox bug, address field : full width

This commit is contained in:
Mathieu Magnin 2017-02-14 14:55:08 +01:00
parent b08a4c5091
commit f60098311e
3 changed files with 43 additions and 53 deletions

View file

@ -1,6 +1,2 @@
%h4{style:'margin-left:15px;'} %input{type: 'hidden', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", value: ''}
= champ.libelle %input{type: 'checkbox', style:'margin-left: 15px;', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.value == 'on')}
- if champ.mandatory?
= '*'
%input{type: 'hidden', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", value: ''}
%input{type: 'checkbox', style:'margin-left: 15px;', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.value == 'on')}

View file

@ -1,8 +1,3 @@
%h4{style:'margin-left:15px;'} %div
= champ.libelle %input{type: 'hidden', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", value: ''}
- if champ.mandatory? %input{type: 'checkbox', style:'margin-left: 15px;', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.value == 'on')}
= '*'
%input{type: 'hidden', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", value: ''}
%input{type: 'checkbox', style:'margin-left: 15px;', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.value == 'on')}
%div{style:'margin-left: 5%; margin-right: 5%; text-align: justify; text-justify: inter-word;'}
= champ.description.gsub(/\r\n/, '<br>').html_safe

View file

@ -3,54 +3,53 @@
- if champ.type_champ == 'header_section' - if champ.type_champ == 'header_section'
- break - break
- unless champ.type_champ == 'checkbox' || champ.type_champ == 'engagement' .row
.row %div{ class: if champ.type_champ == 'textarea' || champ.type_champ == 'engagement' then 'col-md-12' else 'col-md-6' end }
%div{ class: if champ.type_champ == 'textarea' then 'col-md-12' else 'col-md-6' end } .form-group
.form-group %label{ for: "champs_#{ champ.id }"}
%label{ for: "champs_#{ champ.id }"} = champ.libelle
= champ.libelle - if champ.mandatory?
- if champ.mandatory? *
*
- if champ.type_champ == 'textarea' - if champ.type_champ == 'textarea'
= render partial: 'users/description/champs/textarea', locals: { champ: champ } = render partial: 'users/description/champs/textarea', locals: { champ: champ }
- elsif champ.type_champ == 'checkbox' - elsif champ.type_champ == 'checkbox'
= render partial: 'users/description/champs/checkbox', locals: { champ: champ } = render partial: 'users/description/champs/checkbox', locals: { champ: champ }
- elsif champ.type_champ == 'civilite' - elsif champ.type_champ == 'civilite'
= render partial: 'users/description/champs/civilite', locals: { champ: champ } = render partial: 'users/description/champs/civilite', locals: { champ: champ }
- elsif champ.type_champ == 'datetime' - elsif champ.type_champ == 'datetime'
= render partial: 'users/description/champs/datetime', locals: { champ: champ } = render partial: 'users/description/champs/datetime', locals: { champ: champ }
- elsif champ.type_champ == 'yes_no' - elsif champ.type_champ == 'yes_no'
= render partial: 'users/description/champs/yes_no', locals: { champ: champ } = render partial: 'users/description/champs/yes_no', locals: { champ: champ }
- elsif champ.type_champ == 'drop_down_list' - elsif champ.type_champ == 'drop_down_list'
= render partial: 'users/description/champs/drop_down_list', locals: { champ: champ } = render partial: 'users/description/champs/drop_down_list', locals: { champ: champ }
- elsif champ.type_champ == 'pays' - elsif champ.type_champ == 'pays'
= render partial: 'users/description/champs/pays', locals: { champ: champ } = render partial: 'users/description/champs/pays', locals: { champ: champ }
- elsif champ.type_champ == 'regions' - elsif champ.type_champ == 'regions'
= render partial: 'users/description/champs/regions', locals: { champ: champ } = render partial: 'users/description/champs/regions', locals: { champ: champ }
- elsif champ.type_champ == 'engagement' - elsif champ.type_champ == 'engagement'
= render partial: 'users/description/champs/engagement', locals: { champ: champ } = render partial: 'users/description/champs/engagement', locals: { champ: champ }
- elsif champ.type_champ == 'departements' - elsif champ.type_champ == 'departements'
= render partial: 'users/description/champs/departements', locals: { champ: champ } = render partial: 'users/description/champs/departements', locals: { champ: champ }
- else - else
%input.form-control{name:"champs['#{ champ.id }']", %input.form-control{name:"champs['#{ champ.id }']",
placeholder: champ.libelle, placeholder: champ.libelle,
id: "champs_#{ champ.id }", id: "champs_#{ champ.id }",
value: champ.value, value: champ.value,
type: champ.type_champ, type: champ.type_champ,
'data-provide' => champ.data_provide, 'data-provide' => champ.data_provide,
'data-date-format' => champ.data_date_format} 'data-date-format' => champ.data_date_format}
- unless champ.description.empty? || champ.type_champ == 'engagement' - unless champ.description.empty?
.help-block{ id:"description_champs_#{ champ.id }" } %div{ id:"description_champs_#{ champ.id }", class: ('help-block' unless champ.type_champ == 'engagement') }
= champ.description_with_links = champ.description_with_links