From f4de0b8431d22e68807ff607a322bca83e0559fa Mon Sep 17 00:00:00 2001 From: Xavier J Date: Wed, 2 Mar 2016 15:21:45 +0100 Subject: [PATCH 1/4] - Add resize on wysihtml5 bootstrap - Add rich text on procedure description - Ajust text on description dossier user form --- app/assets/stylesheets/application.scss | 4 ++++ app/views/admin/procedures/_informations.html.haml | 6 +++++- app/views/admin/procedures/show.html.haml | 2 +- app/views/users/description/show.html.haml | 9 ++++++--- app/views/users/dossiers/new.html.haml | 2 +- app/views/users/siret/_pro.html.haml | 2 +- spec/controllers/api/v1/procedures_controller_spec.rb | 2 +- 7 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 4dff81461..ffb4d2d33 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -35,6 +35,10 @@ body { padding-top: 50px; } +.wysihtml5-sandbox { + resize:vertical; +} + #wrap { min-height: 100%; margin-bottom: -50px; diff --git a/app/views/admin/procedures/_informations.html.haml b/app/views/admin/procedures/_informations.html.haml index 6e649ac75..199762600 100644 --- a/app/views/admin/procedures/_informations.html.haml +++ b/app/views/admin/procedures/_informations.html.haml @@ -5,7 +5,11 @@ .form-group{class: ('has-error' if @procedure.errors.messages[key])} %h4 =value - =f.text_field key, class: 'form-control', placeholder: value + - if key == :description + = f.text_area key, rows: '6', placeholder: 'Description du projet', class: 'form-control wysihtml5' + + - else + =f.text_field key, class: 'form-control', placeholder: value .row .col-md-6.col-lg-6 diff --git a/app/views/admin/procedures/show.html.haml b/app/views/admin/procedures/show.html.haml index f03a292a2..af3d83e5d 100644 --- a/app/views/admin/procedures/show.html.haml +++ b/app/views/admin/procedures/show.html.haml @@ -54,7 +54,7 @@ %h4.text-info = @facade.procedure.libelle - = @facade.procedure.description + = @facade.procedure.description.html_safe .champs.col-md-4.col-lg-4 %h4.text-info Champs diff --git a/app/views/users/description/show.html.haml b/app/views/users/description/show.html.haml index 228da3ebc..4b686e316 100644 --- a/app/views/users/description/show.html.haml +++ b/app/views/users/description/show.html.haml @@ -1,5 +1,8 @@ .container#description_page - %h2 Description de votre projet + %h2 + = @dossier.procedure.libelle + %h3 Votre dossier + %br -#TODO use form_for @@ -7,12 +10,12 @@ %div .row .col-md-12 - %h4 Nom de votre projet * + %h4 Libellé pour votre dossier * = text_field_tag :nom_projet, @dossier.nom_projet, placeholder: 'Nom du projet', class: 'form-control' %br .row .col-md-12 - %h4 Description de votre projet * + %h4 Description * = text_area_tag :description, @dossier.description, rows: '6', placeholder: 'Description du projet', class: 'form-control wysihtml5' #liste_champs diff --git a/app/views/users/dossiers/new.html.haml b/app/views/users/dossiers/new.html.haml index fd09267fb..d40fcabd4 100644 --- a/app/views/users/dossiers/new.html.haml +++ b/app/views/users/dossiers/new.html.haml @@ -14,7 +14,7 @@ %h2#titre_procedure.text-info = @dossier.procedure.libelle %p - = @dossier.procedure.description + = @dossier.procedure.description.html_safe %br = form_for @dossier, url: {controller: 'users/dossiers', action: :create}, method: :post do |f| diff --git a/app/views/users/siret/_pro.html.haml b/app/views/users/siret/_pro.html.haml index 583bcbe49..34e119cb8 100644 --- a/app/views/users/siret/_pro.html.haml +++ b/app/views/users/siret/_pro.html.haml @@ -6,7 +6,7 @@ = @procedure.libelle %p - = @procedure.description + = @procedure.description.html_safe %br = form_tag(url_for({controller: :dossiers, action: :create}), class: 'form-inline', method: 'POST') do |f| diff --git a/spec/controllers/api/v1/procedures_controller_spec.rb b/spec/controllers/api/v1/procedures_controller_spec.rb index 0fe9a5dcb..a4134720a 100644 --- a/spec/controllers/api/v1/procedures_controller_spec.rb +++ b/spec/controllers/api/v1/procedures_controller_spec.rb @@ -32,7 +32,7 @@ describe API::V1::ProceduresController do it { expect(subject[:label]).to eq(procedure.libelle) } it { expect(subject[:description]).to eq(procedure.description) } it { expect(subject[:organisation]).to eq(procedure.organisation) } - it { expect(subject[:direction]).to eq(proced,ure.direction) } + it { expect(subject[:direction]).to eq(procedure.direction) } it { expect(subject[:link]).to eq(procedure.lien_demarche) } it { expect(subject[:archived]).to eq(procedure.archived) } it { is_expected.to have_key(:types_de_champ) } From 7a82c4b25ff72a5bde5f71cd757b9a6183fc5496 Mon Sep 17 00:00:00 2001 From: Guillaume Lazzara Date: Wed, 2 Mar 2016 10:16:52 +0100 Subject: [PATCH 2/4] Update rails to 4.2.5.2 --- Gemfile | 2 +- Gemfile.lock | 102 ++++++++++++++++++++++++++------------------------- 2 files changed, 53 insertions(+), 51 deletions(-) diff --git a/Gemfile b/Gemfile index 3c2d815a9..c065d7692 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '4.2.0' +gem 'rails', '4.2.5.2' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' diff --git a/Gemfile.lock b/Gemfile.lock index e3431f839..1776d6d98 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,38 +9,38 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.0) - actionpack (= 4.2.0) - actionview (= 4.2.0) - activejob (= 4.2.0) + actionmailer (4.2.5.2) + actionpack (= 4.2.5.2) + actionview (= 4.2.5.2) + activejob (= 4.2.5.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.0) - actionview (= 4.2.0) - activesupport (= 4.2.0) - rack (~> 1.6.0) + actionpack (4.2.5.2) + actionview (= 4.2.5.2) + activesupport (= 4.2.5.2) + rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - actionview (4.2.0) - activesupport (= 4.2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.5.2) + activesupport (= 4.2.5.2) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) + rails-html-sanitizer (~> 1.0, >= 1.0.2) active_model_serializers (0.8.3) activemodel (>= 3.0) - activejob (4.2.0) - activesupport (= 4.2.0) + activejob (4.2.5.2) + activesupport (= 4.2.5.2) globalid (>= 0.3.0) - activemodel (4.2.0) - activesupport (= 4.2.0) + activemodel (4.2.5.2) + activesupport (= 4.2.5.2) builder (~> 3.1) - activerecord (4.2.0) - activemodel (= 4.2.0) - activesupport (= 4.2.0) + activerecord (4.2.5.2) + activemodel (= 4.2.5.2) + activesupport (= 4.2.5.2) arel (~> 6.0) - activesupport (4.2.0) + activesupport (4.2.5.2) i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) @@ -49,7 +49,7 @@ GEM addressable (2.3.8) apipie-rails (0.3.1) json - arel (6.0.2) + arel (6.0.3) as_csv (2.0.2) actionpack (>= 3.0) activemodel (>= 3.0) @@ -99,6 +99,7 @@ GEM execjs coffee-script-source (1.9.1.1) columnize (0.9.0) + concurrent-ruby (1.0.1) crack (0.4.2) safe_yaml (~> 1.0.0) css_splitter (0.4.4) @@ -135,7 +136,7 @@ GEM font-awesome-rails (4.4.0.0) railties (>= 3.2, < 5.0) formatador (0.2.5) - globalid (0.3.5) + globalid (0.3.6) activesupport (>= 4.1.0) guard (2.13.0) formatador (>= 0.2.4) @@ -204,7 +205,7 @@ GEM logstasher (0.6.5) logstash-event (~> 1.2.0) request_store - loofah (2.0.2) + loofah (2.0.3) nokogiri (>= 1.5.9) lumberjack (1.0.9) mail (2.6.3) @@ -215,15 +216,15 @@ GEM rest-client maruku (0.7.2) method_source (0.8.2) - mime-types (2.6.1) - mini_portile (0.6.2) - minitest (5.7.0) + mime-types (2.99.1) + mini_portile2 (2.0.0) + minitest (5.8.4) multi_json (1.11.2) multipart-post (2.0.0) nenv (0.2.0) netrc (0.10.3) - nokogiri (1.6.6.2) - mini_portile (~> 0.6.0) + nokogiri (1.6.7.2) + mini_portile2 (~> 2.0.0.rc2) notiffany (0.0.8) nenv (~> 0.1) shellany (~> 0.0) @@ -271,33 +272,33 @@ GEM rack-test (0.6.3) rack (>= 1.0) railroady (1.3.0) - rails (4.2.0) - actionmailer (= 4.2.0) - actionpack (= 4.2.0) - actionview (= 4.2.0) - activejob (= 4.2.0) - activemodel (= 4.2.0) - activerecord (= 4.2.0) - activesupport (= 4.2.0) + rails (4.2.5.2) + actionmailer (= 4.2.5.2) + actionpack (= 4.2.5.2) + actionview (= 4.2.5.2) + activejob (= 4.2.5.2) + activemodel (= 4.2.5.2) + activerecord (= 4.2.5.2) + activesupport (= 4.2.5.2) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.0) + railties (= 4.2.5.2) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.6) + rails-dom-testing (1.0.7) activesupport (>= 4.2.0.beta, < 5.0) nokogiri (~> 1.6.0) rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.2) + rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (4.2.0) - actionpack (= 4.2.0) - activesupport (= 4.2.0) + railties (4.2.5.2) + actionpack (= 4.2.5.2) + activesupport (= 4.2.5.2) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.0.0) raindrops (0.13.0) - rake (10.4.2) + rake (10.5.0) rb-fsevent (0.9.6) rb-inotify (0.9.5) ffi (>= 0.5.0) @@ -385,12 +386,13 @@ GEM spring (1.3.6) spring-commands-rspec (1.0.4) spring (>= 0.9.1) - sprockets (3.2.0) - rack (~> 1.0) - sprockets-rails (2.3.2) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) + sprockets (3.5.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.0.3) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) swd (1.0.0) activesupport (>= 3) attr_required (>= 0.0.5) @@ -493,7 +495,7 @@ DEPENDENCIES poltergeist pry-byebug railroady - rails (= 4.2.0) + rails (= 4.2.5.2) rest-client rgeo-geojson rspec-rails (~> 3.0) From d0a4cfdcf523ab54048b83db1eece3f9db1eb633 Mon Sep 17 00:00:00 2001 From: Guillaume Lazzara Date: Wed, 2 Mar 2016 10:31:43 +0100 Subject: [PATCH 3/4] Fix logo test --- spec/views/users/dossiers/new_html.haml_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/views/users/dossiers/new_html.haml_spec.rb b/spec/views/users/dossiers/new_html.haml_spec.rb index 7fb4dd692..4e36dbaac 100644 --- a/spec/views/users/dossiers/new_html.haml_spec.rb +++ b/spec/views/users/dossiers/new_html.haml_spec.rb @@ -33,7 +33,7 @@ describe 'users/dossiers/new.html.haml', type: :view do describe 'logo procedure' do context 'procedure have no logo' do it 'TPS logo is present' do - is_expected.to have_css("img[src='/assets#{asset_path('logo-tps.png')}']") + is_expected.to match(/src="\/assets\/logo-tps-.*\.png"/) end end From 8758075456b3ede508d77c408f9ac7ce27646fa0 Mon Sep 17 00:00:00 2001 From: Guillaume Lazzara Date: Thu, 3 Mar 2016 18:33:59 +0100 Subject: [PATCH 4/4] Add custom field 'type' in logstash logs. --- config/initializers/logstasher.rb | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 config/initializers/logstasher.rb diff --git a/config/initializers/logstasher.rb b/config/initializers/logstasher.rb new file mode 100644 index 000000000..0591d543b --- /dev/null +++ b/config/initializers/logstasher.rb @@ -0,0 +1,5 @@ +if LogStasher.enabled + LogStasher.add_custom_fields do |fields| + fields[:type] = "tps" + end +end