Add type de champs civilite
This commit is contained in:
parent
3513b16888
commit
ddeaf5abf3
4 changed files with 45 additions and 29 deletions
|
@ -30,6 +30,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
.type_champ-civilite {
|
||||
@extend .col-md-3;
|
||||
@extend .col-lg-3;
|
||||
}
|
||||
|
||||
.type_champ-phone {
|
||||
@extend .col-md-2;
|
||||
@extend .col-lg-2;
|
||||
|
|
|
@ -2,6 +2,7 @@ class TypeDeChamp < ActiveRecord::Base
|
|||
enum type_champs: {text: 'text',
|
||||
email: 'email',
|
||||
phone: 'phone',
|
||||
civilite: 'civilite',
|
||||
textarea: 'textarea',
|
||||
datetime: 'datetime',
|
||||
number: 'number',
|
||||
|
|
38
app/views/users/description/_champs.html.haml
Normal file
38
app/views/users/description/_champs.html.haml
Normal file
|
@ -0,0 +1,38 @@
|
|||
-@champs.each do |champ|
|
||||
.row
|
||||
%div{class: "type_champ-#{champ.type_champ}"}
|
||||
-if champ.type_champ == 'checkbox'
|
||||
%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')}
|
||||
-else
|
||||
%h4
|
||||
= champ.libelle
|
||||
- if champ.mandatory?
|
||||
= '*'
|
||||
|
||||
-if champ.type_champ == 'textarea'
|
||||
%textarea.form-control{name:"champs['#{champ.id}']",
|
||||
placeholder: champ.libelle,
|
||||
id: "champs_#{champ.id}"}
|
||||
=champ.value
|
||||
-elsif champ.type_champ == 'civilite'
|
||||
%label.radio-inline
|
||||
= radio_button_tag "champs['#{champ.id}']", "M.", champ.value == 'Mme' ? false : true
|
||||
Monsieur
|
||||
|
||||
%label.radio-inline
|
||||
= radio_button_tag "champs['#{champ.id}']", "Mme", champ.value == 'Mme'
|
||||
Madame
|
||||
|
||||
-else
|
||||
%input.form-control{name:"champs['#{champ.id}']",
|
||||
placeholder: champ.libelle,
|
||||
id: "champs_#{champ.id}",
|
||||
value: champ.value,
|
||||
type: champ.type_champ,
|
||||
'data-provide' => ('datepicker' if champ.type_champ == 'datetime'),
|
||||
'data-date-format' => ('dd/mm/yyyy' if champ.type_champ == 'datetime')}
|
|
@ -20,35 +20,7 @@
|
|||
|
||||
#liste_champs
|
||||
-unless @champs.nil?
|
||||
-@champs.each do |champ|
|
||||
.row
|
||||
%div{class: "type_champ-#{champ.type_champ}"}
|
||||
-if champ.type_champ == 'checkbox'
|
||||
%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')}
|
||||
-else
|
||||
%h4
|
||||
= champ.libelle
|
||||
- if champ.mandatory?
|
||||
= '*'
|
||||
|
||||
-if champ.type_champ == 'textarea'
|
||||
%textarea.form-control{name:"champs['#{champ.id}']",
|
||||
placeholder: champ.libelle,
|
||||
id: "champs_#{champ.id}"}
|
||||
=champ.value
|
||||
-else
|
||||
%input.form-control{name:"champs['#{champ.id}']",
|
||||
placeholder: champ.libelle,
|
||||
id: "champs_#{champ.id}",
|
||||
value: champ.value,
|
||||
type: champ.type_champ,
|
||||
'data-provide' => ('datepicker' if champ.type_champ == 'datetime'),
|
||||
'data-date-format' => ('dd/mm/yyyy' if champ.type_champ == 'datetime')}
|
||||
=render partial: 'champs'
|
||||
|
||||
-if !@procedure.lien_demarche.blank? || @procedure.cerfa_flag || @dossier.pieces_justificatives.size > 1
|
||||
%br
|
||||
|
|
Loading…
Reference in a new issue