mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-27 21:50:21 +00:00
Nav
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Google Cloud Engine (GCE)
|
title: Google Compute Engine (GCE)
|
||||||
weight: 106
|
weight: 106
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,16 +3,6 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "hero" }}
|
{{ define "hero" }}
|
||||||
<section class="hero">
|
|
||||||
{{ with .Params.Title }}
|
|
||||||
<h1>{{ . }}</h1>
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{ with .Params.Author }}
|
|
||||||
<span class="byline bg-link">{{ . }}</span>
|
|
||||||
{{end}}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
|
|||||||
@@ -33,11 +33,12 @@
|
|||||||
{{ $topLevel := .Scratch.Get "topLevel"}}
|
{{ $topLevel := .Scratch.Get "topLevel"}}
|
||||||
{{ if $topLevel }}
|
{{ if $topLevel }}
|
||||||
{{ range $topLevel.Sections }}
|
{{ range $topLevel.Sections }}
|
||||||
{{ if .IsAncestor $.CurrentSection }}
|
{{ $isCurrent := .IsAncestor $.CurrentSection }}
|
||||||
|
{{ if $isCurrent }}
|
||||||
{{ $.Scratch.Set "secondLevel" . }}
|
{{ $.Scratch.Set "secondLevel" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<li><a href="{{ .Permalink }}" class="">{{ .Title }}</a></li>
|
<li class="{{if $isCurrent}}active{{end}}"><a href="{{ .Permalink }}">{{ .Title }}</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="tree-nav">
|
<div class="tree-nav invisible">
|
||||||
<ul>
|
<ul>
|
||||||
{{ template "section-tree-nav" ($.Scratch.Get "secondLevel") }}
|
{{ template "section-tree-nav" ($.Scratch.Get "secondLevel") }}
|
||||||
</ul>
|
</ul>
|
||||||
@@ -7,14 +7,12 @@
|
|||||||
{{ range .Sections}}
|
{{ range .Sections}}
|
||||||
<li class="tree-nav-item"><a href="{{ .RelPermalink}}">{{ .Title }}</a>
|
<li class="tree-nav-item"><a href="{{ .RelPermalink}}">{{ .Title }}</a>
|
||||||
{{if gt (len .Sections) 0}}
|
{{if gt (len .Sections) 0}}
|
||||||
<i class="material-icons pull-right expand-more">add_box</i>
|
<i class="material-icons pull-right expand-toggle">add_box</i>
|
||||||
<ul class="tree-nav-sublist hide">
|
<ul class="tree-nav-sublist hide">
|
||||||
{{ range .Pages }}
|
{{ range .Pages }}
|
||||||
<li class="tree-nav-item-child"><a href="{{ .RelPermalink}}">{{ .Title }}</a></li>
|
<li class="tree-nav-item-child"><a href="{{ .RelPermalink}}">{{ .Title }}</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<ul>
|
{{ template "section-tree-nav" . }}
|
||||||
{{ template "section-tree-nav" . }}
|
|
||||||
</ul>
|
|
||||||
</ul>
|
</ul>
|
||||||
{{end}}
|
{{end}}
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
+50
-49
@@ -110,32 +110,6 @@ const bootstrapSlider = function() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getEvents = function() {
|
|
||||||
return $.get('/events/feed/index.json', (resp)=> {
|
|
||||||
buildEventsList(resp.events);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const buildEventsList = function(events) {
|
|
||||||
let htmlOut = '';
|
|
||||||
events.sort((a,b) => {
|
|
||||||
return moment(a.eventDate).isBefore(b.eventDate);
|
|
||||||
});
|
|
||||||
events.forEach((el) => {
|
|
||||||
if (moment(el.eventDate).isAfter()) {
|
|
||||||
htmlOut += `<div class="row aside-item">
|
|
||||||
<div class="bg-accent col-md row middle-md center-md"><i class="material-icons">event_available</i></div>
|
|
||||||
<div class="col-md aside-info">
|
|
||||||
<a href="${el.permalink}">${el.title}</a>
|
|
||||||
${el.eventDate}
|
|
||||||
</div>
|
|
||||||
</div>`;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#events-list-injected').html(htmlOut);
|
|
||||||
}
|
|
||||||
|
|
||||||
const bootstrapSorts = function() {
|
const bootstrapSorts = function() {
|
||||||
if (window.location.pathname.includes('events')) {
|
if (window.location.pathname.includes('events')) {
|
||||||
$('.sort-button').on('click', (el)=> {
|
$('.sort-button').on('click', (el)=> {
|
||||||
@@ -176,6 +150,35 @@ const bootstrapSorts = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const toggleNav = function(input, mode="toggle"/*show, hide*/) {
|
||||||
|
let $target = $(input);
|
||||||
|
let children = $target.find('>UL');
|
||||||
|
let icon = $target.find('>.expand-toggle');
|
||||||
|
|
||||||
|
let show = ((mode === 'toggle' && children.hasClass('hide')) || mode === 'show' );
|
||||||
|
|
||||||
|
if (children.length > 0) {
|
||||||
|
if ( show ) {
|
||||||
|
children.removeClass('hide');
|
||||||
|
icon.html('indeterminate_check_box');
|
||||||
|
} else {
|
||||||
|
children.addClass('hide');
|
||||||
|
icon.html('add_box');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( show ) {
|
||||||
|
let parent = $target.parent().parent();
|
||||||
|
if ( parent && parent.length ) {
|
||||||
|
toggleNav(parent, 'show');
|
||||||
|
}
|
||||||
|
|
||||||
|
$target.addClass('open');
|
||||||
|
} else {
|
||||||
|
$target.removeClass('open');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const bootstrapNav = function () {
|
const bootstrapNav = function () {
|
||||||
// mobile nav
|
// mobile nav
|
||||||
// init-attaches to js object
|
// init-attaches to js object
|
||||||
@@ -184,35 +187,33 @@ const bootstrapNav = function () {
|
|||||||
$(".js-ml-stack-nav").mlStackNav();
|
$(".js-ml-stack-nav").mlStackNav();
|
||||||
|
|
||||||
// sidenav
|
// sidenav
|
||||||
$('.tree-nav .tree-nav-item').on('click', function(e) {
|
$('.tree-nav').on('click', '.tree-nav-item', function(e) {
|
||||||
// actual clicked element
|
// actual clicked element
|
||||||
let target = e.target;
|
let target = e.target;
|
||||||
|
|
||||||
if (!target.href) {
|
if (target.href) {
|
||||||
let sub = $(e.currentTarget).find('>ul.tree-nav-sublist');
|
return;
|
||||||
|
|
||||||
// stop it from affecting other nodes
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
|
|
||||||
if (sub.length > 0) {
|
|
||||||
sub.toggleClass('hide');
|
|
||||||
|
|
||||||
// parent li rather then actual el clicked
|
|
||||||
$(e.currentTarget).toggleClass('open');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// stop it from affecting other nodes
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
toggleNav(e.currentTarget);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// epand the current page
|
||||||
|
let cur = $('.tree-nav A[href="'+window.location.pathname+'"]').closest('LI');
|
||||||
|
cur.addClass('active');
|
||||||
|
toggleNav(cur, 'show');
|
||||||
|
$('.tree-nav').removeClass('invisible');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bootstrapNav();
|
$(document).ready(() => {
|
||||||
bootstrapDropdowns();
|
bootstrapNav();
|
||||||
bootstrapModals();
|
bootstrapDropdowns();
|
||||||
bootstrapSorts();
|
bootstrapModals();
|
||||||
bootstrapSlider();
|
bootstrapSorts();
|
||||||
|
bootstrapSlider();
|
||||||
if ($('#events-list-injected').length > 0) {
|
});
|
||||||
getEvents();
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user