Skip to content

Commit

Permalink
refs #7 #87 Adds new setting home_page.general.footer_navigation.item…
Browse files Browse the repository at this point in the history
…s which include page slugs to link on new sticky application footer.
  • Loading branch information
volontarian committed Mar 26, 2015
1 parent 76a4097 commit 7da6b8b
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/assets/stylesheets/home_page/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*= require home_page/variables
*= require home_page/loader
*= require home_page/bootswatch
*= require home_page/sticky_footer
*= require bootstrap-datetimepicker
*= require selectize
*= require selectize.bootstrap3
Expand Down
30 changes: 30 additions & 0 deletions app/assets/stylesheets/home_page/sticky_footer.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
background-color: #f5f5f5;
}

.container .text-muted {
margin: 20px 0;
text-align:center;
}

.footer > .container {
padding-right: 15px;
padding-left: 15px;
}

code {
font-size: 80%;
}
14 changes: 14 additions & 0 deletions app/helpers/home_page/layout_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,19 @@ def sidenav(links_count = 2)

result && result.scan('<a').length >= links_count ? result : ''
end

def footer_navigation
links = []
page_slugs = Setting['home_page.general.footer_navigation.items']
pages = page_slugs.any? ? Page.where(slug: page_slugs) : []

pages.each do |page|
text = page.title
path = page_path(page)
links << (current_page?(path) ? text : link_to(text, path))
end

raw links.join(' | ')
end
end
end
19 changes: 19 additions & 0 deletions app/views/layouts/shared/_foot.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
<% unless @hide_footer %>
<footer class="footer">
<div class="container">
<p class="text-muted">
<% if Setting['home_page.general.footer_navigation.items'].length > 0 %>
<span>
<%= footer_navigation %>
</span>
<br/>
<br/>
<% end %>
<span>
<%= raw t('general.powered_by_home_page_software', link: link_to('Home-Page.Software', 'http://Home-Page.Software')) %>
</span>
</p>
</div>
</footer>
<% end %>

<%= javascript_include_tag *home_page_javascripts %>
<%= yield :javascript_includes %>
<%= javascript_tag do %>
Expand Down
19 changes: 18 additions & 1 deletion app/views/layouts/shared/_head.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,21 @@
<link href="images/apple-touch-icon-144x144.png" rel="apple-touch-icon-precomposed" sizes="144x144"/>
<link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon-precomposed" sizes="114x114"/>
<link href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon-precomposed" sizes="72x72"/>
<link href="images/apple-touch-icon.png" rel="apple-touch-icon-precomposed"/>
<link href="images/apple-touch-icon.png" rel="apple-touch-icon-precomposed"/>

<% if Setting['home_page.general.footer_navigation.items'].length > 0 %>
<style type="text/css">
<!--

body {
/* Margin bottom by footer height */
margin-bottom: 100px;
}

.footer {
height: 100px;
}

-->
</style>
<% end %>
1 change: 1 addition & 0 deletions app/views/settings/plugins/home_page/_panel.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<div role="tabpanel" class="tab-pane active" id="home_page_settings_general">
<p>
<%= setting_input f, 'home_page.general.navigation.items' %>
<%= setting_input f, 'home_page.general.footer_navigation.items' %>
<%= setting_input f, 'home_page.general.enabled_apis' %>
<%= setting_input f, 'home_page.general.partial_paths' %>
</p>
Expand Down
3 changes: 2 additions & 1 deletion config/initializers/default_settings.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Setting.defaults['home_page.general.plugins'] = ['home_page']
Setting.defaults['home_page.general.navigation.items'] = ['page_modules', 'users', 'settings', 'authentication']
Setting.defaults['home_page.general.navigation.items'] = ['pages', 'users', 'settings', 'authentication']
Setting.defaults['home_page.general.footer_navigation.items'] = []
Setting.defaults['home_page.general.available_apis'] = ['volontariat']
Setting.defaults['home_page.general.enabled_apis'] = []
Setting.defaults['home_page.general.partial_paths'] = []
Expand Down
3 changes: 2 additions & 1 deletion config/locales/resources/setting/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ en:
general:
navigation:
items: Navigation Items

footer_navigation:
items: Footer Navigation Items
enabled_apis: Enabled APIs
partial_paths: Partial Paths

0 comments on commit 7da6b8b

Please sign in to comment.