From f60098311ef93130bffd728d15e52f64f30ca7c9 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Tue, 14 Feb 2017 14:55:08 +0100 Subject: [PATCH] Fix hidden checkbox bug, address field : full width --- .../description/champs/_checkbox.html.haml | 8 +- .../description/champs/_engagement.html.haml | 11 +-- .../champs/_render_list_champs.html.haml | 77 +++++++++---------- 3 files changed, 43 insertions(+), 53 deletions(-) diff --git a/app/views/users/description/champs/_checkbox.html.haml b/app/views/users/description/champs/_checkbox.html.haml index 8f2727f9d..bae7b55ad 100644 --- a/app/views/users/description/champs/_checkbox.html.haml +++ b/app/views/users/description/champs/_checkbox.html.haml @@ -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')} diff --git a/app/views/users/description/champs/_engagement.html.haml b/app/views/users/description/champs/_engagement.html.haml index 9381266cf..9addfed85 100644 --- a/app/views/users/description/champs/_engagement.html.haml +++ b/app/views/users/description/champs/_engagement.html.haml @@ -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/, '
').html_safe \ No newline at end of file +%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')} diff --git a/app/views/users/description/champs/_render_list_champs.html.haml b/app/views/users/description/champs/_render_list_champs.html.haml index 021054b59..261ef88e1 100644 --- a/app/views/users/description/champs/_render_list_champs.html.haml +++ b/app/views/users/description/champs/_render_list_champs.html.haml @@ -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