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;'}
= champ.libelle
- 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')}
%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;'}
= champ.libelle
- 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')}
%div{style:'margin-left: 5%; margin-right: 5%; text-align: justify; text-justify: inter-word;'}
= champ.description.gsub(/\r\n/, '<br>').html_safe
%div
%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

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