From 101bd6825205026db8d60325eaf6071d22adc43a Mon Sep 17 00:00:00 2001 From: Julien Portalier Date: Tue, 18 Oct 2016 15:51:32 +0200 Subject: [PATCH] Add opensimplif feature flip to hide user/gestionnaire tabs --- app/views/backoffice/dossiers/_onglets.html.haml | 5 +---- app/views/backoffice/dossiers/index.html.haml | 7 ++++++- app/views/users/dossiers/_onglets.html.haml | 2 -- app/views/users/dossiers/index.html.haml | 5 ++++- spec/features/backoffice/onglets_link_spec.rb | 14 +++++++++++++- spec/features/users/onglets_link_spec.rb | 13 ++++++++++++- spec/spec_helper.rb | 4 ++++ 7 files changed, 40 insertions(+), 10 deletions(-) diff --git a/app/views/backoffice/dossiers/_onglets.html.haml b/app/views/backoffice/dossiers/_onglets.html.haml index 6b366d70e..9018c1144 100644 --- a/app/views/backoffice/dossiers/_onglets.html.haml +++ b/app/views/backoffice/dossiers/_onglets.html.haml @@ -1,6 +1,3 @@ -=link_to 'Tous mes dossiers en CSV', backoffice_download_dossiers_tps_path, {class: 'btn btn-success btn-sm', style: 'float: right; margin-right: 4%; margin-top: 7px'} -%h1 Gestion des dossiers - #filter_by_procedure{style:'margin-left: 5%'} %select{onchange: 'location = this.value', style:'margin-top: 10px; margin-bottom: 10px', id: 'filter_by_procedure_select'} %option{value: backoffice_dossiers_path} @@ -67,4 +64,4 @@ %a.btn#pref_list_dossier_open_action{href: '#'} %i.fa.fa-columns -%br \ No newline at end of file +%br diff --git a/app/views/backoffice/dossiers/index.html.haml b/app/views/backoffice/dossiers/index.html.haml index b6473abf4..c37cde902 100644 --- a/app/views/backoffice/dossiers/index.html.haml +++ b/app/views/backoffice/dossiers/index.html.haml @@ -1,7 +1,12 @@ #backoffice_index #pref_list_menu = render partial: 'backoffice/dossiers/pref_list' - = render partial: 'backoffice/dossiers/onglets' + + =link_to 'Tous mes dossiers en CSV', backoffice_download_dossiers_tps_path, {class: 'btn btn-success btn-sm', style: 'float: right; margin-right: 4%; margin-top: 7px'} + %h1 Gestion des dossiers + + -unless Features.opensimplif + = render partial: 'backoffice/dossiers/onglets' = smart_listing_render :dossiers diff --git a/app/views/users/dossiers/_onglets.html.haml b/app/views/users/dossiers/_onglets.html.haml index de6a40156..de53b9039 100644 --- a/app/views/users/dossiers/_onglets.html.haml +++ b/app/views/users/dossiers/_onglets.html.haml @@ -1,5 +1,3 @@ -%h1 Mes dossiers - %br #onglets %ul.nav.nav-tabs diff --git a/app/views/users/dossiers/index.html.haml b/app/views/users/dossiers/index.html.haml index f7931ed8f..a692b6ea2 100644 --- a/app/views/users/dossiers/index.html.haml +++ b/app/views/users/dossiers/index.html.haml @@ -1,5 +1,8 @@ #users_index - = render partial: 'onglets' + %h1 Mes dossiers + + -unless Features.opensimplif + = render partial: 'onglets' = smart_listing_render :dossiers diff --git a/spec/features/backoffice/onglets_link_spec.rb b/spec/features/backoffice/onglets_link_spec.rb index b88c9347c..e0d61d38c 100644 --- a/spec/features/backoffice/onglets_link_spec.rb +++ b/spec/features/backoffice/onglets_link_spec.rb @@ -89,4 +89,16 @@ feature 'on click on tabs button' do end end end -end \ No newline at end of file + + context "OpenSimplif" do + before do + allow(Features).to receive(:opensimplif).and_return(true) + visit backoffice_dossiers_url + end + + scenario "it hides the tabs" do + expect(page).to_not have_css('#filter_by_procedure') + expect(page).to_not have_css('#onglets') + end + end +end diff --git a/spec/features/users/onglets_link_spec.rb b/spec/features/users/onglets_link_spec.rb index f2cb8c7b3..3685869c1 100644 --- a/spec/features/users/onglets_link_spec.rb +++ b/spec/features/users/onglets_link_spec.rb @@ -99,4 +99,15 @@ feature 'on click on tabs button' do end end end -end \ No newline at end of file + + context "OpenSimplif" do + before do + allow(Features).to receive(:opensimplif).and_return(true) + visit users_dossiers_url + end + + scenario "it hides the tabs" do + expect(page).to_not have_css('#onglets') + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c8bf64f29..38f9934da 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -83,6 +83,10 @@ class Features def self.unified_login false end + + def self.opensimplif + false + end end WebMock.disable_net_connect!(allow_localhost: true)