Display left panel only if layout file exist

This commit is contained in:
Xavier J 2016-12-01 12:19:22 +01:00
parent 0da13454f7
commit 5c61733199
9 changed files with 40 additions and 24 deletions

View file

@ -63,6 +63,6 @@ h5 span {
.split-hr-left {
border-bottom: 1px solid #FFFFFF;
margin: 20px 10px 20px 0;
margin: 20px 10px 0px 0;
}

View file

@ -18,10 +18,11 @@
}
#home {
text-align: center;
padding: 10px;
box-shadow: 0 1px 2px 0 rgba(0,0,0,0.5);
background-color: #003189;
height: 60px;
.logo {
width: 118px;
margin-top: 10px;
height: 40px;
}
#tps-title {
@ -29,13 +30,13 @@
font-size: 24px;
font-weight: bold;
line-height: 28px;
padding: 5px 0 0 20px;
margin-top: 17px;
}
}
#navbar-body {
height: 60px;
background-color: #FFFFFF;
box-shadow: 0 1px 2px 0 rgba(0,0,0,0.5);
box-shadow: 0 1px 2px 0 rgba(50,50,50,0.5);
padding-left: 50px;
.main-info {
font-family: Arial;

View file

@ -1,5 +1,5 @@
#search-block{
margin: 5px 5px 0 0;
margin: 11px 5px 0 0;
height: 50px;
}

View file

@ -15,6 +15,12 @@ class RenderPartialService
retrieve_left_panel
end
def self.left_panel_exist? left_panel_url
file = left_panel_url.split('/').last
File.exist?(Rails.root.join('app','views', 'layouts', 'left_panels', '_'+file+'.html.haml'))
end
private
def retrieve_navbar

View file

@ -1,5 +1,5 @@
%div#footer
%p{class: "copyright col-md-push-2 col-md-10 col-lg-push-2 col-lg-10 text-muted small"}
%p{class: "copyright col-md-push-#{12-main_container_size} col-md-#{main_container_size} col-lg-push-#{12-main_container_size} col-lg-#{main_container_size} text-muted small"}
=link_to 'SGMAP', "http://etatplateforme.modernisation.gouv.fr"
2016

View file

@ -0,0 +1,6 @@
%div#main-container{class: "col-lg-#{main_container_size} col-md-#{main_container_size}"}
%div.row
= render partial: 'layouts/flash_messages'
%div.row
= yield
%div.row

View file

@ -1,9 +1,9 @@
%div.col-lg-2.col-md-2.no-padding
%div.col-lg-2.col-md-2
%a#title_navbar{href: '/'}
%div.row#home
%div.col-lg-6
%div.col-lg-6.no-padding
= image_tag('marianne_small.png', class: 'logo')
%div.col-lg-6#tps-title
%div.col-lg-6.no-padding#tps-title
TPS
%div.col-lg-10.col-md-10.no-padding

View file

@ -31,22 +31,21 @@
%div#header.navbar
= render partial: "layouts/navbar"
%div.row.no-margin
- if RenderPartialService.left_panel_exist? @left_pannel_url
%div.col-lg-2.col-md-2#left-pannel
- if gestionnaire_signed_in?
#search-block
= render partial: 'layouts/left_panels/search_area'
- begin
= render partial: @left_pannel_url
-rescue
= render partial: 'layouts/left_panels/left_panel_default'
%div.col-lg-10.col-md-10#main-container
%div.row
= render partial: 'layouts/flash_messages'
%div.row
= yield
%div.row
- main_container_size = 10
- else
- main_container_size = 12
=render partial: 'layouts/main_container', locals: {main_container_size: main_container_size}
#mask_search
%h1
%i.fa.fa-times{style:'position: fixed; top: 10; right: 30; color: white;'}
= render partial: 'layouts/footer'
= render partial: 'layouts/footer', locals: {main_container_size: main_container_size}
= render partial: 'layouts/google_analytics'

View file

@ -16,4 +16,8 @@ describe RenderPartialService do
it { is_expected.to eq 'layouts/left_panel/_left_panel_'+controller.to_s.parameterize + '_' + method.to_s }
end
describe 'left_panel_exist?' do
pending
end
end