Skip to content

Commit

Permalink
allow for configurable layout container classes
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed authored and cbeer committed Nov 16, 2015
1 parent 1fe1d1c commit dbd37b0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
8 changes: 8 additions & 0 deletions app/helpers/blacklight/layout_helper_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,13 @@ def main_content_classes
def sidebar_classes
'col-md-3 col-sm-4'
end

##
# Class used for specifying main layout container classes. Can be
# overwritten to return 'container-fluid' for Bootstrap full-width layout
# @return [String]
def container_classes
'container'
end
end
end
2 changes: 1 addition & 1 deletion app/views/layouts/blacklight.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<%= render partial: 'shared/ajax_modal' %>

<div id="main-container" class="container">
<div id="main-container" class="<%= container_classes %>">
<%= content_tag :h1, application_name, class: 'sr-only application-heading' %>
<%= render :partial=>'/flash_msg', layout: 'shared/flash_messages' %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/_header_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div id="header-navbar" class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="<%= container_classes %>">
<div class="navbar-header">
<button type="button" class="navbar-toggle btn collapsed" data-toggle="collapse" data-target="#user-util-collapse">
<span class="sr-only">Toggle navigation</span>
Expand All @@ -17,7 +17,7 @@
</div>

<div id="search-navbar" class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container">
<div class="<%= container_classes %>">
<%= render_search_bar %>
</div>
</div>
7 changes: 7 additions & 0 deletions spec/helpers/layout_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,11 @@
expect(helper.sidebar_classes).to eq 'col-md-3 col-sm-4'
end
end

describe '#container_classes' do
it 'returns a string of classe(s)' do
expect(helper.container_classes).to be_an String
expect(helper.container_classes).to eq 'container'
end
end
end

0 comments on commit dbd37b0

Please sign in to comment.