Skip to content

Commit

Permalink
Merge ea78ba9 into afc3407
Browse files Browse the repository at this point in the history
  • Loading branch information
alchexmist committed Jul 6, 2019
2 parents afc3407 + ea78ba9 commit c092f64
Show file tree
Hide file tree
Showing 38 changed files with 848 additions and 186 deletions.
4 changes: 3 additions & 1 deletion assets/js/app.js
Expand Up @@ -23,6 +23,7 @@ import isNonEmptyArray from './template-helpers/isNonEmptyArray'
import groupChanged from './template-helpers/groupChanged'
import nestingChanged from './template-helpers/nestingChanged'
import showSummary from './template-helpers/showSummary'
import useTranslation from './template-helpers/useTranslation'

import {initialize as initEvents} from './events'
import {initialize as initSidebar} from './sidebar'
Expand All @@ -36,9 +37,10 @@ window.$ = $
$(() => {
// Set up Handlebars.js
Handlebars.registerHelper('isArray', isArray)
Handlebars.registerHelper('useTranslation', useTranslation)
Handlebars.registerHelper('isLocal', isLocal)
Handlebars.registerHelper('isNonEmptyArray', isNonEmptyArray)
Handlebars.registerHelper('groupChanged', groupChanged)
Handlebars.registerHelper('isNonEmptyArray', isNonEmptyArray)
Handlebars.registerHelper('nestingChanged', nestingChanged)
Handlebars.registerHelper('showSummary', showSummary)

Expand Down
4 changes: 2 additions & 2 deletions assets/js/events.js
@@ -1,4 +1,4 @@
/* globals sidebarNodes */
/* globals sidebarNodes, translations */

// Dependencies
// ------------
Expand Down Expand Up @@ -62,7 +62,7 @@ function fillSidebarWithNodes (nodes, filter) {
filter = filter || moduleType
var filtered = nodes[filter] || []
var fullList = $('#full-list')
fullList.replaceWith(sidebarItemsTemplate({'nodes': filtered, 'group': ''}))
fullList.replaceWith(sidebarItemsTemplate({'nodes': filtered, 'group': '', 'translations': translations}))
setupSelected(['#', filter, '-list'].join(''))

$('#full-list li a').on('click', e => {
Expand Down
5 changes: 3 additions & 2 deletions assets/js/search.js
@@ -1,4 +1,4 @@
/* globals searchNodes */
/* globals searchNodes, translations */

// Search
// ======
Expand Down Expand Up @@ -83,7 +83,8 @@ export function search (value) {
var resultsHtml = resultsTemplate({
value: value,
results: results,
errorMessage: errorMessage
errorMessage: errorMessage,
translations: translations
})

$search.html(resultsHtml)
Expand Down
37 changes: 37 additions & 0 deletions assets/js/template-helpers/useTranslation.js
@@ -0,0 +1,37 @@
export default function (string, translations, options) {
switch (string) {
case "callback":
return translations.callback;
case "Callbacks":
return translations.callbacks;
case "Contributing":
return translations.contributing;
case "extras":
return translations.extras;
case "function":
return translations.function;
case "Functions":
return translations.functions;
case "Go to":
return translations.go_to;
case "Keyboard Shortcuts":
return translations.keyboard_shortcuts;
case "License":
return translations.license;
case "Summary":
return translations.summary;
case "task":
return translations.task;
case "Top":
return translations.top;
case "Types":
return translations.types;
case "Search results for":
return translations.search_results;
case "Search the documentation":
return translations.search_documentation;
default:
return string
}
};

2 changes: 1 addition & 1 deletion assets/js/templates/autocomplete-suggestions.handlebars
@@ -1,7 +1,7 @@
<div class="autocomplete-suggestions">
<a class="autocomplete-suggestion" href="search.html?q={{term}}" data-index="-1" tabindex="-1">
<div class="title">"<em>{{term}}</em>"</div>
<div class="description">Search the documentation</div>
<div class="description">{{ translations.search_documentation }}</div>
</a>
{{#each results}}
<a href="{{link}}" class="autocomplete-suggestion" data-index="{{@index}}" tabindex="-1">
Expand Down
Expand Up @@ -2,7 +2,7 @@
<div id="keyboard-shortcuts-modal" tabindex="-1">
<div class="modal-contents">
<div class="modal-header">
<div class="modal-title">Keyboard Shortcuts</div>
<div class="modal-title">{{ translate.keyboard_shortcuts }}</div>
<div class="modal-close">×</div>
</div>
<div class="modal-body">
Expand Down
4 changes: 2 additions & 2 deletions assets/js/templates/search-results.handlebars
@@ -1,10 +1,10 @@
<h1>Search results for <em>{{value}}</em></h1>
<h1>{{ translations.search_results }} <em>{{value}}</em></h1>

{{#isNonEmptyArray results}}
{{#each results}}
<div class="result">
<h2 class="result-id">
<a href="{{this.ref}}">{{this.title}} <small>({{this.type}})</small></a>
<a href="{{this.ref}}">{{this.title}} <small>({{useTranslation this.type ../translations}})</small></a>
</h2>
{{#each excerpts}}
<p class="result-elem">{{{this}}}</p>
Expand Down
14 changes: 7 additions & 7 deletions assets/js/templates/sidebar-items.handlebars
Expand Up @@ -19,36 +19,36 @@
{{node.title}}
{{/if}}

<span class="icon-goto" title="Go to {{node.title}}"></span>
<span class="icon-goto" title="{{ useTranslation "Go to" ../translations }} {{node.title}}"></span>
</a>

<ul>
<li>
<a href="{{node.id}}.html#content">Top</a>
<a href="{{node.id}}.html#content">{{ useTranslation "Top" ../translations }}</a>
</li>

{{#isArray node.headers}}
{{#each node.headers}}
<li>
<a href="{{node.id}}.html#{{{anchor}}}">{{{id}}}</a>
<a href="{{node.id}}.html#{{{anchor}}}">{{{ useTranslation id ../../translations }}}</a>
</li>
{{/each}}
{{else}}
{{#showSummary node}}
<li>
<a href="{{node.id}}.html#summary">Summary</a>
<a href="{{node.id}}.html#summary">{{ useTranslation "Summary" ../translations }}</a>
</li>
{{/showSummary}}
{{#each node.nodeGroups as |group|}}
<li class="docs">
<a href="{{node.id}}.html#{{group.key}}" class="expand">
{{group.name}}
<span class="icon-goto" title="Go to {{group.name}}"></span>
{{useTranslation group.name ../../translations}}
<span class="icon-goto" title="{{ useTranslation "Go to" ../../translations }} {{group.name}}"></span>
</a>
<ul class="{{group.key}}-list deflist">
{{#each group.nodes}}
<li>
<a href="{{node.id}}.html#{{anchor}}">{{{id}}}</a>
<a href="{{node.id}}.html#{{anchor}}">{{{ useTranslation id ../../../translations }}}</a>
</li>
{{/each}}
</ul>
Expand Down
1 change: 0 additions & 1 deletion formatters/epub/dist/epub-3d78b4bc43f40e38d220.js

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions formatters/epub/dist/epub-8efd45a17a94b6e43671.js

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions formatters/html/dist/html-2d8ac0f269b1a5dc3c96.css

This file was deleted.

0 comments on commit c092f64

Please sign in to comment.