Add description champs on description page.

This commit is contained in:
Xavier J 2016-06-09 14:18:28 +02:00
parent 3c75fb27c4
commit 54256b1e55
4 changed files with 21 additions and 2 deletions

View file

@ -14,6 +14,14 @@ function action_type_de_champs() {
toggleErrorClass(this, validatePhone(val)); toggleErrorClass(this, validatePhone(val));
}); });
$("#liste_champs input").on('focus', function (){
$("#description_"+this.id).slideDown();
});
$("#liste_champs input").on('blur', function (){
$("#description_"+this.id).slideUp();
});
address_type_init(); address_type_init();
} }

View file

@ -85,3 +85,10 @@
width: 100%; width: 100%;
} }
} }
.description_div {
margin-top: 5px;
margin-left: 5px;
color: dimgrey;
display: none;
}

View file

@ -2,7 +2,7 @@ class Champ < ActiveRecord::Base
belongs_to :dossier belongs_to :dossier
belongs_to :type_de_champ belongs_to :type_de_champ
delegate :libelle, :type_champ, :order_place, :mandatory, to: :type_de_champ delegate :libelle, :type_champ, :order_place, :mandatory, :description, to: :type_de_champ
def mandatory? def mandatory?
mandatory mandatory

View file

@ -35,4 +35,8 @@
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' => ('dd/mm/yyyy' if champ.type_champ == 'datetime')} 'data-date-format' => ('dd/mm/yyyy' if champ.type_champ == 'datetime')}
- unless champ.description.empty?
.row
.col-lg-8.col-md-8{class: 'description_div', id:"description_champs_#{champ.id}"}
= champ.description