Form: add description

This commit is contained in:
Simon Lehericey 2017-08-02 15:29:12 +02:00 committed by Mathieu Magnin
parent d4bbcdf682
commit 46c144146c
3 changed files with 16 additions and 4 deletions

View file

@ -8,8 +8,15 @@
}
label {
margin-bottom: $default-spacer;
display: inline-block;
margin-bottom: $default-padding;
display: block;
.notice {
font-size: 14px;
display: block;
margin-top: $default-spacer;
color: $grey;
}
}
input[type=text]:not([data-address='true']),

View file

@ -32,8 +32,10 @@ class RootController < ApplicationController
end
def patron
description = 'a not so long description'
all_champs = TypeDeChamp.type_champs
.map { |name, _| TypeDeChamp.new(type_champ: name, libelle: name, mandatory: true) }
.map { |name, _| TypeDeChamp.new(type_champ: name, libelle: name, description: description, mandatory: true) }
.map { |type_de_champ| ChampPublic.new(type_de_champ: type_de_champ) }
.map.with_index do |champ, i|
champ.id = i

View file

@ -1 +1,4 @@
= form.label :value, "#{champ.libelle} #{champ.mandatory ? '*' : nil}"
= form.label :value do
#{champ.libelle} #{champ.mandatory ? '*' : nil}
- if champ.description.present?
%span.notice= champ.description