Skip to content

Commit

Permalink
[FEATURE] Added 6-7 levels for submenu (Podio feature_28) (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
yar-trach authored and dmh committed Jan 23, 2017
1 parent 836e2b2 commit 3a2379a
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 1 deletion.
30 changes: 30 additions & 0 deletions dev/styles/main/nav/subNavigation.less
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,28 @@
background-color: shade(@sub-navigation-link-hover-bg, 12%);
}

.sub-navigation__link._sub-level-6 {
padding-left: 45px;
background-color: shade(@sub-navigation-background, 14%);
border-color: shade(@sub-navigation-border, 19%);
text-transform: uppercase;
}

.no-touch .sub-navigation__link._sub-level-6:hover {
background-color: shade(@sub-navigation-link-hover-bg, 14%);
}

.sub-navigation__link._sub-level-7 {
padding-left: 49px;
background-color: shade(@sub-navigation-background, 16%);
border-color: shade(@sub-navigation-border, 21%);
text-transform: uppercase;
}

.no-touch .sub-navigation__link._sub-level-7:hover {
background-color: shade(@sub-navigation-link-hover-bg, 16%);
}

.sub-navigation__link._active {
border-left: 3px solid @sub-navigation-active-border;
padding-left: 17px;
Expand All @@ -104,6 +126,14 @@
padding-left: 38px;
}

.sub-navigation__link._sub-level-6._active {
padding-left: 42px;
}

.sub-navigation__link._sub-level-7._active {
padding-left: 46px;
}

.sub-navigation__link._curent {
border-left: 3px solid @sub-navigation-active-border;
color: @sub-navigation-link-active-color;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
#layout: default.hbs #by default it is default.hbs, but you can specify another one
title: Navigation Level 6 #title in menu
position: 1 #position in menu
hideInMenu: false #if true, will be hidden in menu
hideInBreadcrumbs: false #if true, will be hidden in breadcrumbs
externalLink: false #just add link (http://link.com) instead of "false" to use this page like a link to external page.
---

{{> breadcrumbs}}

<div class="container">
<div class="row">
<div class="col-md-3">
{{> subNavigation}}
</div>
<div class="col-md-9">
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
#layout: default.hbs #by default it is default.hbs, but you can specify another one
title: Navigation Level 7 #title in menu
position: 1 #position in menu
hideInMenu: false #if true, will be hidden in menu
hideInBreadcrumbs: false #if true, will be hidden in breadcrumbs
externalLink: false #just add link (http://link.com) instead of "false" to use this page like a link to external page.
---

{{> breadcrumbs}}

<div class="container">
<div class="row">
<div class="col-md-3">
{{> subNavigation}}
</div>
<div class="col-md-9">
</div>
</div>
</div>
42 changes: 41 additions & 1 deletion dev/templates/parts/nav/subNavigation.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,50 @@
<li class="sub-navigation__item">
{{!build sub menu level 5}}
{{!grunt/helpers/helper-submenu.js}}

{{~#subMenu ../../../pages 5~}}
<a href="{{basename}}.html" class="sub-navigation__link _sub-level-5 {{#if this.isCurrentPage}} _active _curent{{/if}}">
<a href="{{basename}}.html" class="sub-navigation__link _sub-level-5 {{#if this.isCurrentPage}} _active _curent {{/if}}
{{!add "active" class if some of children also active}}
{{! grunt/helpers/helper-ifChildrensActive_addClass.js}}
{{~#ifChildrensActive_addClass ../../../../pages ~}}
_active _open
{{~/ifChildrensActive_addClass~}}">
{{data.title}}
</a>

<ul class="sub-navigation__item-list _sub-list-level-6">
{{!build sub menu level 6}}
{{!grunt/helpers/helper-submenu.js}}
{{~#subMenu ../../../../pages 6~}}
<li class="sub-navigation__item">
<a href="{{basename}}.html" class="sub-navigation__link _sub-level-6 {{#if this.isCurrentPage}} _active _curent {{/if}}
{{!add "active" class if some of children also active}}
{{! grunt/helpers/helper-ifChildrensActive_addClass.js}}
{{~#ifChildrensActive_addClass ../../../../../pages ~}}
_active _open
{{~/ifChildrensActive_addClass~}}">
{{data.title}}
</a>

<ul class="sub-navigation__item-list _sub-list-level-7">
{{!build sub menu level 7}}
{{!grunt/helpers/helper-submenu.js}}
{{~#subMenu ../../../../../pages 7~}}
<li class="sub-navigation__item">
<a href="{{basename}}.html" class="sub-navigation__link _sub-level-7 {{#if this.isCurrentPage}} _active _curent {{/if}}
{{!add "active" class if some of children also active}}
{{! grunt/helpers/helper-ifChildrensActive_addClass.js}}
{{~#ifChildrensActive_addClass ../../../../../../pages ~}}
_active _open
{{~/ifChildrensActive_addClass~}}">
{{data.title}}
</a>
</li>
{{~/subMenu~}}
</ul>
</li>
{{~/subMenu~}}
</ul>
{{~/subMenu~}}
</li>
</ul>
Expand Down
26 changes: 26 additions & 0 deletions grunt/helpers/helper-addNavData.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ module.exports.register = function(Handlebars) {
collection[i].parent2 = collectionParentsArr[collectionMenuLevels - 1];
collection[i].parent3 = collectionParentsArr[collectionMenuLevels];
collection[i].parent4 = collectionParentsArr[collectionMenuLevels + 1];
} else if (collectionMenuLevels === 6) {
collection[i].parent1 = collectionParentsArr[collectionMenuLevels - 3];
collection[i].parent2 = collectionParentsArr[collectionMenuLevels - 2];
collection[i].parent3 = collectionParentsArr[collectionMenuLevels - 1];
collection[i].parent4 = collectionParentsArr[collectionMenuLevels];
collection[i].parent5 = collectionParentsArr[collectionMenuLevels + 1];
} else if (collectionMenuLevels === 7) {
collection[i].parent1 = collectionParentsArr[collectionMenuLevels - 4];
collection[i].parent2 = collectionParentsArr[collectionMenuLevels - 3];
collection[i].parent3 = collectionParentsArr[collectionMenuLevels - 2];
collection[i].parent4 = collectionParentsArr[collectionMenuLevels - 1];
collection[i].parent5 = collectionParentsArr[collectionMenuLevels];
collection[i].parent6 = collectionParentsArr[collectionMenuLevels + 1];
}
}

Expand Down Expand Up @@ -73,6 +86,19 @@ module.exports.register = function(Handlebars) {
this.page.parent2 = parentsArr[menuLevels - 1];
this.page.parent3 = parentsArr[menuLevels];
this.page.parent4 = parentsArr[menuLevels + 1];
} else if (menuLevels === 6) {
this.page.parent1 = parentsArr[menuLevels - 3];
this.page.parent2 = parentsArr[menuLevels - 2];
this.page.parent3 = parentsArr[menuLevels - 1];
this.page.parent4 = parentsArr[menuLevels];
this.page.parent5 = parentsArr[menuLevels + 1];
} else if (menuLevels === 7) {
this.page.parent1 = parentsArr[menuLevels - 4];
this.page.parent2 = parentsArr[menuLevels - 3];
this.page.parent3 = parentsArr[menuLevels - 2];
this.page.parent4 = parentsArr[menuLevels - 1];
this.page.parent5 = parentsArr[menuLevels];
this.page.parent6 = parentsArr[menuLevels + 1];
}
});
};

0 comments on commit 3a2379a

Please sign in to comment.