var CloseButton = require('./modules/close-button');
var CloseEscape = require('./modules/close-escape');
var Search = require('./modules/search');
+var Summary = require('./modules/summary');
var OverflowInit = require('./modules/overflow-init');
var StickyKitInit = require('./modules/sticky-kit-init');
window[CloseButton] = new CloseButton();
window[CloseEscape] = new CloseEscape();
window[Search] = new Search();
+window[Summary] = new Summary();
window[OverflowInit] = new OverflowInit();
window[StickyKitInit] = new StickyKitInit();
--- /dev/null
+var Summary = function() {
+
+ this.$summary = $('[data-summary]');
+ this.$content = $('[data-summary-content]');
+
+ //
+ // Init
+ //
+ this.init();
+
+};
+
+Summary.prototype.init = function() {
+
+ var that = this,
+ $template;
+
+ if(that.$summary.length == 1 && that.$content.length == 1) {
+
+ $template = that.$summary.find('li:first-child');
+ that.$content.find('h2').each(function(idx) {
+
+ var $element = $(this),
+ $template_clone = $template.clone();
+ $template_clone.find('a').text($element.text());
+ $template_clone.find('a').attr('href', '#section-' + idx);
+ $template_clone.removeClass('hide');
+ that.$summary.append($template_clone);
+
+ $element.attr('id', "section-" + idx);
+
+ });
+
+ $template.remove();
+
+ }
+
+};
+
+module.exports = Summary;
}
}
}
+.hide {
+ display: none;
+}
.hide-xxs {
@include mq($until: xs) {
display: none;
{{ page.description }}
{% endmetablock %}{% endblock %}
-{% block title %}
- {% editable page.title %}
- {{ page.title }}
- {% endeditable %}
-
- {% editable page.basicpage.sub_title %}
- {{ page.basicpage.sub_title }}
- {% endeditable %}
+{% block page_class %}
+ basicpage
{% endblock %}
-
-
{% block page_title %}
{% editable page.basicpage.title %}
{% for page in page_branch %}
<li class="nav-tree__item">
<a class="nav-tree__link{% if page.is_current or page.is_current_or_ascendant %} active{% endif %}" href="{{ page.get_absolute_url }}">{{ page.title }}</a>
+ {% if page.is_current_or_ascendant %}
+ <ul class="nav-tree" data-summary>
+ {% include "pages/menus/current_tree_summary.html" %}
+ </ul>
+ {% endif %}
</li>
- {% if page.is_current_or_ascendant %}
- {% include "pages/menus/current_tree_summary.html" %}
- {% endif %}
{% endfor %}
{% endif %}
{% endif %}
-{% comment %}
-We will use JS to populate the menu
-{% endcomment %}
+<li class="nav-tree__item nav-tree__item--sub hide">
+ <a class="nav-tree__link nav-tree__link--sub" href="#"></a>
+</li>
{% endmetablock %}{% endblock %}
{% block main %}
+ <div class="page page--{% spaceless %}{% block page_class %}{% endblock %}{% endspaceless %}">
- <div class="row">
- <div class="col-sm-9 col-sm-push-3 col-lg-8 col-lg-push-2">
- {% block page_title %}
- {{ page.title }}
- {% endblock %}
+ <div class="row">
+ <div class="col-sm-9 col-sm-push-3 col-lg-8 col-lg-push-2">
+ {% block page_title %}
+ {{ page.title }}
+ {% endblock %}
+ </div>
</div>
- </div>
- <div class="row">
- <div class="col-sm-3 col-lg-2">
- {% block page_sidebar %}
- {% if page.get_ascendants|length < 2 %}
- {% page_menu "pages/menus/current_tree_primary.html" %}
- {% endif %}
- {% if page.get_ascendants|length == 2 %}
- {% page_menu "pages/menus/current_tree_secondary.html" %}
- {% endif %}
- {% endblock %}
- </div>
- <div class="col-sm-9 col-lg-8">
- {% block page_content %}
- {{ page.content }}
- {% endblock %}
+ <div class="row">
+ <div class="col-sm-3 col-lg-2">
+ <div class="page__sidebar">
+ {% block page_sidebar %}
+ {% if page.get_ascendants|length < 2 %}
+ {% page_menu "pages/menus/current_tree_primary.html" %}
+ {% endif %}
+ {% if page.get_ascendants|length == 2 %}
+ {% page_menu "pages/menus/current_tree_secondary.html" %}
+ {% endif %}
+ {% endblock %}
+ </div>
+ </div>
+ <div class="col-sm-9 col-lg-8">
+ <div class="page__content" data-summary-content>
+ {% block page_content %}
+ {{ page.content }}
+ {% endblock %}
+ </div>
+ </div>
</div>
- </div>
+ </div>
{% endblock %}