Browse code

now layouts or pages can specify "sidebar: collapse" in the yaml front matter for an always collapsed sidebar

Brandon Mathis authored on 26/09/2011 at 02:30:55
Showing 2 changed files
... ...
@@ -1,6 +1,6 @@
1 1
 {% capture root_url %}{{ site.root | strip_slash }}{% endcapture %}
2 2
 {% include head.html %}
3
-<body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == false %} class="no-sidebar" {% endif %}>
3
+<body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == false %} class="no-sidebar" {% endif %} {% if page.sidebar == 'collapse' %} class="collapse-sidebar sidebar-footer" {% endif %}>
4 4
   <header role="banner">{% include header.html %}</header>
5 5
   <nav role="navigation">{% include navigation.html %}</nav>
6 6
   <div id="main">
... ...
@@ -11,15 +11,17 @@ function getNav() {
11 11
 }
12 12
 
13 13
 function addSidebarToggler() {
14
-  $('#content').append('<span class="toggle-sidebar"></span>');
15
-  $('.toggle-sidebar').bind('click', function(e) {
16
-    e.preventDefault();
17
-    if ($('body').hasClass('collapse-sidebar')) {
18
-      $('body').removeClass('collapse-sidebar');
19
-    } else {
20
-      $('body').addClass('collapse-sidebar');
21
-    }
22
-  });
14
+  if(!$('body').hasClass('sidebar-footer')) {
15
+    $('#content').append('<span class="toggle-sidebar"></span>');
16
+    $('.toggle-sidebar').bind('click', function(e) {
17
+      e.preventDefault();
18
+      if ($('body').hasClass('collapse-sidebar')) {
19
+        $('body').removeClass('collapse-sidebar');
20
+      } else {
21
+        $('body').addClass('collapse-sidebar');
22
+      }
23
+    });
24
+  }
23 25
   var sections = $('aside.sidebar > section');
24 26
   if (sections.length > 1) {
25 27
     sections.each(function(section, index){