Display left panel only if layout file exist
This commit is contained in:
parent
0da13454f7
commit
5c61733199
9 changed files with 40 additions and 24 deletions
|
@ -63,6 +63,6 @@ h5 span {
|
||||||
|
|
||||||
.split-hr-left {
|
.split-hr-left {
|
||||||
border-bottom: 1px solid #FFFFFF;
|
border-bottom: 1px solid #FFFFFF;
|
||||||
margin: 20px 10px 20px 0;
|
margin: 20px 10px 0px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,11 @@
|
||||||
}
|
}
|
||||||
#home {
|
#home {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 10px;
|
box-shadow: 0 1px 2px 0 rgba(0,0,0,0.5);
|
||||||
background-color: #003189;
|
background-color: #003189;
|
||||||
|
height: 60px;
|
||||||
.logo {
|
.logo {
|
||||||
width: 118px;
|
margin-top: 10px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
}
|
}
|
||||||
#tps-title {
|
#tps-title {
|
||||||
|
@ -29,13 +30,13 @@
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
line-height: 28px;
|
line-height: 28px;
|
||||||
padding: 5px 0 0 20px;
|
margin-top: 17px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#navbar-body {
|
#navbar-body {
|
||||||
height: 60px;
|
height: 60px;
|
||||||
background-color: #FFFFFF;
|
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;
|
padding-left: 50px;
|
||||||
.main-info {
|
.main-info {
|
||||||
font-family: Arial;
|
font-family: Arial;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#search-block{
|
#search-block{
|
||||||
margin: 5px 5px 0 0;
|
margin: 11px 5px 0 0;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,12 @@ class RenderPartialService
|
||||||
retrieve_left_panel
|
retrieve_left_panel
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
def retrieve_navbar
|
def retrieve_navbar
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%div#footer
|
%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"
|
=link_to 'SGMAP', "http://etatplateforme.modernisation.gouv.fr"
|
||||||
|
|
||||||
2016
|
2016
|
||||||
|
|
6
app/views/layouts/_main_container.html.haml
Normal file
6
app/views/layouts/_main_container.html.haml
Normal 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
|
|
@ -1,9 +1,9 @@
|
||||||
%div.col-lg-2.col-md-2.no-padding
|
%div.col-lg-2.col-md-2
|
||||||
%a#title_navbar{href: '/'}
|
%a#title_navbar{href: '/'}
|
||||||
%div.row#home
|
%div.row#home
|
||||||
%div.col-lg-6
|
%div.col-lg-6.no-padding
|
||||||
= image_tag('marianne_small.png', class: 'logo')
|
= image_tag('marianne_small.png', class: 'logo')
|
||||||
%div.col-lg-6#tps-title
|
%div.col-lg-6.no-padding#tps-title
|
||||||
TPS
|
TPS
|
||||||
|
|
||||||
%div.col-lg-10.col-md-10.no-padding
|
%div.col-lg-10.col-md-10.no-padding
|
||||||
|
|
|
@ -31,22 +31,21 @@
|
||||||
%div#header.navbar
|
%div#header.navbar
|
||||||
= render partial: "layouts/navbar"
|
= render partial: "layouts/navbar"
|
||||||
%div.row.no-margin
|
%div.row.no-margin
|
||||||
%div.col-lg-2.col-md-2#left-pannel
|
- if RenderPartialService.left_panel_exist? @left_pannel_url
|
||||||
- if gestionnaire_signed_in?
|
%div.col-lg-2.col-md-2#left-pannel
|
||||||
#search-block
|
- if gestionnaire_signed_in?
|
||||||
= render partial: 'layouts/left_panels/search_area'
|
#search-block
|
||||||
- begin
|
= render partial: 'layouts/left_panels/search_area'
|
||||||
|
|
||||||
= render partial: @left_pannel_url
|
= render partial: @left_pannel_url
|
||||||
-rescue
|
- main_container_size = 10
|
||||||
= render partial: 'layouts/left_panels/left_panel_default'
|
- else
|
||||||
%div.col-lg-10.col-md-10#main-container
|
- main_container_size = 12
|
||||||
%div.row
|
|
||||||
= render partial: 'layouts/flash_messages'
|
=render partial: 'layouts/main_container', locals: {main_container_size: main_container_size}
|
||||||
%div.row
|
|
||||||
= yield
|
|
||||||
%div.row
|
|
||||||
#mask_search
|
#mask_search
|
||||||
%h1
|
%h1
|
||||||
%i.fa.fa-times{style:'position: fixed; top: 10; right: 30; color: white;'}
|
%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'
|
= render partial: 'layouts/google_analytics'
|
||||||
|
|
|
@ -16,4 +16,8 @@ describe RenderPartialService do
|
||||||
|
|
||||||
it { is_expected.to eq 'layouts/left_panel/_left_panel_'+controller.to_s.parameterize + '_' + method.to_s }
|
it { is_expected.to eq 'layouts/left_panel/_left_panel_'+controller.to_s.parameterize + '_' + method.to_s }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'left_panel_exist?' do
|
||||||
|
pending
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue