angular-docs-cn/public/_includes/_version-dropdown.jade

48 lines
1.6 KiB
Plaintext

language = current.path[1]
title = "JavaScript "
filter = /(\.html$)/
replace = /(\.html$)|(^index\.html$)/
version = ''
<!-- Replace _ undscores with . dots -->
if current.path[2]
version = current.path[2].replace(/\_+/gm, ".")
<!-- VERSION TREE CREATOR MIXIN -->
mixin tree(directory, urlPrefix, name, latest)
ul
for val, semvar in directory
if semvar !== '.git' && semvar !== '_data'
libVersion = (semvar == "latest") ? latest : semvar.replace(/\_+/gm, ".")
li <a href="#{urlPrefix}/#{semvar}/" md-button>#{name} #{libVersion}</a>
<!-- BUTTON TITLE GENERATION -->
if language == 'js'
if version == "latest"
title = 'Angular 2 for JavaScript'
else
title = 'Angular ' + version + ' for JavaScript'
if language == 'dart'
if version == "latest"
title = 'Angular 2 for Dart'
else
title = 'Angular ' + version + ' for Dart'
<!-- DROPDOWN BUTTON -->
nav.hero-subtitle.text-subhead.dropdown
button(aria-label="Select a version of Angular" md-button class="dropdown-button" ng-click="toggleVersionMenu($event)") #{title} <span class="icon icon-arrow-drop-down"></span>
div(class="overlay ng-hide" ng-click="toggleVersionMenu($event)" ng-show="showMenu")
<!-- DROPDOWN MENU -->
div(class="dropdown-menu ng-hide" ng-show="showMenu")
mixin tree(public.docs.js, "/docs/js", "Angular 2 for JavaScript")
mixin tree(public.docs.dart, "/docs/dart", "Angular 2 for Dart")
ul
li <a href="https://angularjs.org/" md-button>#{name} Angular 1.X for JavaScript</a>
li <a href="https://docs.angulardart.org/" md-button>#{name} Angular 1.X for Dart</a>