From 95481e7b85fd3d5e8d590c53bc46ad35280dc565 Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Thu, 8 Jun 2017 18:07:00 +0200 Subject: [PATCH] Move date input in a partial --- app/views/users/description/champs/_date.html.haml | 7 +++++++ .../description/champs/_render_list_champs.html.haml | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 app/views/users/description/champs/_date.html.haml diff --git a/app/views/users/description/champs/_date.html.haml b/app/views/users/description/champs/_date.html.haml new file mode 100644 index 000000000..2a286a499 --- /dev/null +++ b/app/views/users/description/champs/_date.html.haml @@ -0,0 +1,7 @@ +%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 } 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 01c395d33..6bb776379 100644 --- a/app/views/users/description/champs/_render_list_champs.html.haml +++ b/app/views/users/description/champs/_render_list_champs.html.haml @@ -47,14 +47,16 @@ - when 'explication' + - when 'date' + = render partial: 'users/description/champs/date', 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 } + type: champ.type_champ } + - unless champ.description.empty? %div{ id: "description_champs_#{champ.id}", class: ('help-block' unless champ.type_champ == 'engagement') }