From e10c218d3a20e7e86afd3a4da5e1176772365c3d Mon Sep 17 00:00:00 2001 From: Xavier J Date: Thu, 3 Nov 2016 17:20:56 +0100 Subject: [PATCH] Add dynamic logo (opensimplif) --- app/assets/images/{ => logos}/logo-tps.png | Bin app/decorators/procedure_decorator.rb | 2 +- app/views/administrateurs/sessions/new.html.haml | 2 +- app/views/gestionnaires/passwords/edit.html.haml | 2 +- app/views/gestionnaires/passwords/new.html.haml | 2 +- app/views/gestionnaires/sessions/new.html.haml | 2 +- app/views/layouts/_navbar.html.haml | 2 +- app/views/users/passwords/edit.html.haml | 2 +- app/views/users/passwords/new.html.haml | 2 +- app/views/users/registrations/new.html.haml | 2 +- app/views/users/sessions/new.html.haml | 2 +- app/views/users/siret/_pro.html.haml | 2 +- config/initializers/logos.rb | 2 ++ spec/decorators/procedure_decorator_spec.rb | 2 +- 14 files changed, 14 insertions(+), 12 deletions(-) rename app/assets/images/{ => logos}/logo-tps.png (100%) create mode 100644 config/initializers/logos.rb diff --git a/app/assets/images/logo-tps.png b/app/assets/images/logos/logo-tps.png similarity index 100% rename from app/assets/images/logo-tps.png rename to app/assets/images/logos/logo-tps.png diff --git a/app/decorators/procedure_decorator.rb b/app/decorators/procedure_decorator.rb index df848570d..05577587b 100644 --- a/app/decorators/procedure_decorator.rb +++ b/app/decorators/procedure_decorator.rb @@ -10,7 +10,7 @@ class ProcedureDecorator < Draper::Decorator end def logo_img - return 'logo-tps.png' if logo.blank? + return LOGO_NAME if logo.blank? File.join(STORAGE_URL, File.basename(logo.path)) end def geographic_information diff --git a/app/views/administrateurs/sessions/new.html.haml b/app/views/administrateurs/sessions/new.html.haml index 863389b43..93a5e0b38 100644 --- a/app/views/administrateurs/sessions/new.html.haml +++ b/app/views/administrateurs/sessions/new.html.haml @@ -1,6 +1,6 @@ #form_login %br - = image_tag('logo-tps.png') + = image_tag(LOGO_NAME) %br %h2#login_admin =t('dynamics.admin.connexion_title') diff --git a/app/views/gestionnaires/passwords/edit.html.haml b/app/views/gestionnaires/passwords/edit.html.haml index ff4027fe4..7de92bf83 100644 --- a/app/views/gestionnaires/passwords/edit.html.haml +++ b/app/views/gestionnaires/passwords/edit.html.haml @@ -1,7 +1,7 @@ = devise_error_messages! #form_login - = image_tag('logo-tps.png') + = image_tag(LOGO_NAME) %br %h2#gestionnaire_login Changement de mot de passe diff --git a/app/views/gestionnaires/passwords/new.html.haml b/app/views/gestionnaires/passwords/new.html.haml index eed941e40..4fdf9c3a2 100644 --- a/app/views/gestionnaires/passwords/new.html.haml +++ b/app/views/gestionnaires/passwords/new.html.haml @@ -2,7 +2,7 @@ %br #form_login - = image_tag('logo-tps.png') + = image_tag(LOGO_NAME) %br %h2#gestionnaire_login Mot de passe oubliƩ diff --git a/app/views/gestionnaires/sessions/new.html.haml b/app/views/gestionnaires/sessions/new.html.haml index a3de3cd1e..18e7a5c65 100644 --- a/app/views/gestionnaires/sessions/new.html.haml +++ b/app/views/gestionnaires/sessions/new.html.haml @@ -1,6 +1,6 @@ #form_login %br - = image_tag('logo-tps.png') + = image_tag(LOGO_NAME) %br %h2#gestionnaire_login Accompagnateur diff --git a/app/views/layouts/_navbar.html.haml b/app/views/layouts/_navbar.html.haml index 4f297d196..38c449b0a 100644 --- a/app/views/layouts/_navbar.html.haml +++ b/app/views/layouts/_navbar.html.haml @@ -5,7 +5,7 @@ Env Test = image_tag('marianne_small.png', class: 'logo') %a{href: '/'} - = image_tag('logo-tps.png', class: 'logo') + = image_tag(LOGO_NAME, class: 'logo') - if gestionnaire_signed_in? && user_signed_in? %a{href: (current_gestionnaire.procedure_filter.blank? ? backoffice_dossiers_path : backoffice_dossiers_procedure_path(current_gestionnaire.procedure_filter)), class: 'btn btn-md'} diff --git a/app/views/users/passwords/edit.html.haml b/app/views/users/passwords/edit.html.haml index 60c694678..c13b95e1d 100644 --- a/app/views/users/passwords/edit.html.haml +++ b/app/views/users/passwords/edit.html.haml @@ -29,7 +29,7 @@ = devise_error_messages! #form_login - = image_tag('logo-tps.png') + = image_tag(LOGO_NAME) %br %h2#gestionnaire_login Changement de mot de passe diff --git a/app/views/users/passwords/new.html.haml b/app/views/users/passwords/new.html.haml index 6504a7295..2c98c5514 100644 --- a/app/views/users/passwords/new.html.haml +++ b/app/views/users/passwords/new.html.haml @@ -30,7 +30,7 @@ %br #form_login - = image_tag('logo-tps.png') + = image_tag(LOGO_NAME) %br %h2#gestionnaire_login Mot de passe oubliƩ diff --git a/app/views/users/registrations/new.html.haml b/app/views/users/registrations/new.html.haml index 17054c523..01d7d7c81 100644 --- a/app/views/users/registrations/new.html.haml +++ b/app/views/users/registrations/new.html.haml @@ -30,7 +30,7 @@ #form_login %br - = image_tag('logo-tps.png') + = image_tag(LOGO_NAME) %br %h2#gestionnaire_login Inscription diff --git a/app/views/users/sessions/new.html.haml b/app/views/users/sessions/new.html.haml index 9a0ce150f..3ea216422 100644 --- a/app/views/users/sessions/new.html.haml +++ b/app/views/users/sessions/new.html.haml @@ -17,7 +17,7 @@ - else - = image_tag('logo-tps.png', {id: 'logo_tps'}) + = image_tag(LOGO_NAME, {id: 'logo_tps'}) %br %h2#login_user diff --git a/app/views/users/siret/_pro.html.haml b/app/views/users/siret/_pro.html.haml index 34e119cb8..fb4899a99 100644 --- a/app/views/users/siret/_pro.html.haml +++ b/app/views/users/siret/_pro.html.haml @@ -1,6 +1,6 @@ %p.lead{id: 'pro_section'} - = image_tag('logo-tps.png') + = image_tag(LOGO_NAME) %br %h2#titre_procedure.text-info = @procedure.libelle diff --git a/config/initializers/logos.rb b/config/initializers/logos.rb new file mode 100644 index 000000000..ad429846b --- /dev/null +++ b/config/initializers/logos.rb @@ -0,0 +1,2 @@ +LOGO_NAME = 'logos/logo-tps.png' unless Features.opensimplif +LOGO_NAME = 'logos/logo-opensimplif.jpg' if Features.opensimplif diff --git a/spec/decorators/procedure_decorator_spec.rb b/spec/decorators/procedure_decorator_spec.rb index c730f7c84..45d8e4608 100644 --- a/spec/decorators/procedure_decorator_spec.rb +++ b/spec/decorators/procedure_decorator_spec.rb @@ -16,7 +16,7 @@ describe ProcedureDecorator do describe 'logo_img' do subject { super().logo_img } - it { is_expected.to eq('logo-tps.png') } + it { is_expected.to eq(LOGO_NAME) } end describe 'geographic_information' do