From 46c144146cadaa5d1284af1e2d1b925e82e10d4d Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Wed, 2 Aug 2017 15:29:12 +0200 Subject: [PATCH] Form: add description --- app/assets/stylesheets/new_design/forms.scss | 11 +++++++++-- app/controllers/root_controller.rb | 4 +++- .../dossiers/champs/_champ_label.html.haml | 5 ++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/new_design/forms.scss b/app/assets/stylesheets/new_design/forms.scss index 043585de6..9b5c7bc72 100644 --- a/app/assets/stylesheets/new_design/forms.scss +++ b/app/assets/stylesheets/new_design/forms.scss @@ -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']), diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index 6837a259e..981e53fed 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -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 diff --git a/app/views/new_gestionnaire/dossiers/champs/_champ_label.html.haml b/app/views/new_gestionnaire/dossiers/champs/_champ_label.html.haml index b2e5960e4..b6dc5e579 100644 --- a/app/views/new_gestionnaire/dossiers/champs/_champ_label.html.haml +++ b/app/views/new_gestionnaire/dossiers/champs/_champ_label.html.haml @@ -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