diff --git a/.byebug_history b/.byebug_history deleted file mode 100644 index f22879884..000000000 --- a/.byebug_history +++ /dev/null @@ -1,4 +0,0 @@ -exit -xit -xtei -cniuecniu diff --git a/Gemfile b/Gemfile index e38f8d656..7e1ca50c9 100644 --- a/Gemfile +++ b/Gemfile @@ -119,11 +119,8 @@ end group :development do # Access an IRB console on exception pages or by using <%= console %> in views - gem 'web-console' - gem 'rack-handlers' - gem 'xray-rails' end diff --git a/app/assets/javascripts/bootstrap_wysihtml5.js b/app/assets/javascripts/bootstrap_wysihtml5.js index 4f1ed7bcf..b0606ce8a 100644 --- a/app/assets/javascripts/bootstrap_wysihtml5.js +++ b/app/assets/javascripts/bootstrap_wysihtml5.js @@ -3,6 +3,6 @@ $(document).on('page:load', wysihtml5_active); function wysihtml5_active (){ $('.wysihtml5').each(function(i, elem) { - $(elem).wysihtml5({ toolbar:{ "fa": true, "link": false, "color": true }, "locale": "fr-FR" }); + $(elem).wysihtml5({ toolbar:{ "fa": true, "link": false, "color": false }, "locale": "fr-FR" }); }); -} \ No newline at end of file +} diff --git a/app/assets/javascripts/description.js b/app/assets/javascripts/description.js index 24a9e7e56..6df9f436d 100644 --- a/app/assets/javascripts/description.js +++ b/app/assets/javascripts/description.js @@ -18,14 +18,6 @@ function action_type_de_champs() { 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(); } diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 52609b760..5e30ef194 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -144,10 +144,6 @@ textarea#description { max-width: 27px; } -label { - font-weight: normal; -} - div.pagination { padding-top: 20px; display: block; diff --git a/app/assets/stylesheets/description.scss b/app/assets/stylesheets/description.scss index dc24f6646..c471c10c1 100644 --- a/app/assets/stylesheets/description.scss +++ b/app/assets/stylesheets/description.scss @@ -7,9 +7,7 @@ .show-block { width: 90%; .body{ - padding-left: 35px; - padding-right: 35px; - padding-bottom: 35px; + padding: 15px; } } } @@ -134,10 +132,3 @@ width: 160px; } } - -.description_div { - margin-top: 5px; - margin-left: 5px; - color: dimgrey; - display: none; -} \ No newline at end of file diff --git a/app/assets/stylesheets/typeahead.scss b/app/assets/stylesheets/typeahead.scss index 8cda8e19b..8d4c2a37c 100644 --- a/app/assets/stylesheets/typeahead.scss +++ b/app/assets/stylesheets/typeahead.scss @@ -1,3 +1,6 @@ +.twitter-typeahead { + width: 100%; // http://stackoverflow.com/questions/17957513/extending-the-width-of-bootstrap-typeahead-to-match-input-field +} .tt-menu { padding: 8px 0; diff --git a/app/decorators/champ_decorator.rb b/app/decorators/champ_decorator.rb index 6713e5049..42c9639e4 100644 --- a/app/decorators/champ_decorator.rb +++ b/app/decorators/champ_decorator.rb @@ -7,4 +7,9 @@ class ChampDecorator < Draper::Decorator end object.value end -end \ No newline at end of file + + def description_with_links + description.gsub(URI.regexp, '\0').html_safe if description + end + +end diff --git a/app/decorators/type_de_champ_decorator.rb b/app/decorators/type_de_champ_decorator.rb index d149996a7..ffe824855 100644 --- a/app/decorators/type_de_champ_decorator.rb +++ b/app/decorators/type_de_champ_decorator.rb @@ -39,4 +39,4 @@ class TypeDeChampDecorator < Draper::Decorator @count_type_de_champ ||= procedure.types_de_champ.count end end -end \ No newline at end of file +end diff --git a/app/views/users/description/_show.html.haml b/app/views/users/description/_show.html.haml index 5aebd3baa..1c28d55d0 100644 --- a/app/views/users/description/_show.html.haml +++ b/app/views/users/description/_show.html.haml @@ -15,7 +15,7 @@ = @dossier.procedure.libelle -#TODO use form_for - = form_tag(url_for({controller: 'users/description', action: :create, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST', multipart: true) do + = form_tag(url_for({controller: 'users/description', action: :create, dossier_id: @dossier.id}), class: 'form', method: 'POST', multipart: true) do -unless @champs.nil? #liste_champs =render partial: 'users/description/champs', locals:{private: false} diff --git a/app/views/users/description/champs/_checkbox.html.haml b/app/views/users/description/champs/_checkbox.html.haml index 8f2727f9d..bae7b55ad 100644 --- a/app/views/users/description/champs/_checkbox.html.haml +++ b/app/views/users/description/champs/_checkbox.html.haml @@ -1,6 +1,2 @@ -%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')} +%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')} diff --git a/app/views/users/description/champs/_civilite.html.haml b/app/views/users/description/champs/_civilite.html.haml index 1a9ad45f3..c6fcf6525 100644 --- a/app/views/users/description/champs/_civilite.html.haml +++ b/app/views/users/description/champs/_civilite.html.haml @@ -1,7 +1,8 @@ -%label.radio-inline - = radio_button_tag "champs['#{champ.id}']", "M.", champ.value == 'Mme' ? false : true - Monsieur +%div + %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 \ No newline at end of file + %label.radio-inline + = radio_button_tag "champs['#{champ.id}']", "Mme", champ.value == 'Mme' + Madame \ No newline at end of file diff --git a/app/views/users/description/champs/_engagement.html.haml b/app/views/users/description/champs/_engagement.html.haml index 9381266cf..bae7b55ad 100644 --- a/app/views/users/description/champs/_engagement.html.haml +++ b/app/views/users/description/champs/_engagement.html.haml @@ -1,8 +1,2 @@ -%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')} -%div{style:'margin-left: 5%; margin-right: 5%; text-align: justify; text-justify: inter-word;'} - = champ.description.gsub(/\r\n/, '
').html_safe \ No newline at end of file +%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')} 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 e15eceef6..261ef88e1 100644 --- a/app/views/users/description/champs/_render_list_champs.html.haml +++ b/app/views/users/description/champs/_render_list_champs.html.haml @@ -1,54 +1,55 @@ --champs.each do |champ| +- champs.decorate.each do |champ| - if champ.order_place > order_place - if champ.type_champ == 'header_section' - break - - unless champ.type_champ == 'checkbox' || champ.type_champ == 'engagement' - %h4 - = champ.libelle - - if champ.mandatory? - = '*' - - -if champ.type_champ == 'textarea' - =render partial: 'users/description/champs/textarea', locals: {champ: champ} - - -elsif champ.type_champ == 'checkbox' - = render partial: 'users/description/champs/checkbox', locals: {champ: champ} - - -elsif champ.type_champ == 'civilite' - =render partial: 'users/description/champs/civilite', locals: {champ: champ} - - - elsif champ.type_champ == 'datetime' - =render partial: 'users/description/champs/datetime', locals: {champ: champ} - - - elsif champ.type_champ == 'yes_no' - =render partial: 'users/description/champs/yes_no', locals: {champ: champ} - - - elsif champ.type_champ == 'drop_down_list' - =render partial: 'users/description/champs/drop_down_list', locals: {champ: champ} - - - elsif champ.type_champ == 'pays' - =render partial: 'users/description/champs/pays', locals: {champ: champ} - - - elsif champ.type_champ == 'regions' - =render partial: 'users/description/champs/regions', locals: {champ: champ} - - - elsif champ.type_champ == 'engagement' - =render partial: 'users/description/champs/engagement', locals: {champ: champ} - - - elsif champ.type_champ == 'departements' - =render partial: 'users/description/champs/departements', 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} - - - unless champ.description.empty? || champ.type_champ == 'engagement' .row - .col-lg-8.col-md-8.col-sm-8.col-xs-8{class: 'description_div', id:"description_champs_#{champ.id}"} - = champ.description + %div{ class: if champ.type_champ == 'textarea' || champ.type_champ == 'engagement' then 'col-md-12' else 'col-md-6' end } + .form-group + %label{ for: "champs_#{ champ.id }"} + = champ.libelle + - if champ.mandatory? + * + + - if champ.type_champ == 'textarea' + = render partial: 'users/description/champs/textarea', locals: { champ: champ } + + - elsif champ.type_champ == 'checkbox' + = render partial: 'users/description/champs/checkbox', locals: { champ: champ } + + - elsif champ.type_champ == 'civilite' + = render partial: 'users/description/champs/civilite', locals: { champ: champ } + + - elsif champ.type_champ == 'datetime' + = render partial: 'users/description/champs/datetime', locals: { champ: champ } + + - elsif champ.type_champ == 'yes_no' + = render partial: 'users/description/champs/yes_no', locals: { champ: champ } + + - elsif champ.type_champ == 'drop_down_list' + = render partial: 'users/description/champs/drop_down_list', locals: { champ: champ } + + - elsif champ.type_champ == 'pays' + = render partial: 'users/description/champs/pays', locals: { champ: champ } + + - elsif champ.type_champ == 'regions' + = render partial: 'users/description/champs/regions', locals: { champ: champ } + + - elsif champ.type_champ == 'engagement' + = render partial: 'users/description/champs/engagement', locals: { champ: champ } + + - elsif champ.type_champ == 'departements' + = render partial: 'users/description/champs/departements', 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} + + - unless champ.description.empty? + %div{ id:"description_champs_#{ champ.id }", class: ('help-block' unless champ.type_champ == 'engagement') } + = champ.description_with_links diff --git a/app/views/users/description/champs/_textarea.html.haml b/app/views/users/description/champs/_textarea.html.haml index 4c062a300..9ea66d68e 100644 --- a/app/views/users/description/champs/_textarea.html.haml +++ b/app/views/users/description/champs/_textarea.html.haml @@ -2,4 +2,4 @@ placeholder: champ.description, id: "champs_#{champ.id}", row: '6'} - =champ.value \ No newline at end of file + = champ.value diff --git a/app/views/users/description/champs/_yes_no.html.haml b/app/views/users/description/champs/_yes_no.html.haml index 9224f98f5..58cfac7e4 100644 --- a/app/views/users/description/champs/_yes_no.html.haml +++ b/app/views/users/description/champs/_yes_no.html.haml @@ -1,7 +1,8 @@ -%label.radio-inline - = radio_button_tag "champs['#{champ.id}']", "true", champ.value == 'true' - Oui +%div + %label.radio-inline + = radio_button_tag "champs['#{champ.id}']", "true", champ.value == 'true' + Oui -%label.radio-inline - = radio_button_tag "champs['#{champ.id}']", "false", champ.value == 'false' - Non \ No newline at end of file + %label.radio-inline + = radio_button_tag "champs['#{champ.id}']", "false", champ.value == 'false' + Non \ No newline at end of file