blob: eaf6c1426bc32c2557f5d8b8a7abf4ef0823bed1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
'use strict';
const config = require('../config.js');
const BaseView = require('./base_view.js');
class HelpView extends BaseView {
constructor() {
super();
this.template = this.getTemplate('help-template');
this.sectionTemplates = {};
const sectionKeys = ['about', 'keyboard', 'search', 'comments', 'tos'];
for (let section of sectionKeys) {
const templateName = 'help-' + section + '-template';
this.sectionTemplates[section] = this.getTemplate(templateName);
}
}
render(section) {
if (!section) {
section = 'about';
}
if (!(section in this.sectionTemplates)) {
this.showView('');
return;
}
const content = this.sectionTemplates[section]({
'name': config.name,
});
this.showView(this.template({'content': content}));
const allItemsSelector = '#content-holder [data-name]';
for (let item of document.querySelectorAll(allItemsSelector)) {
if (item.getAttribute('data-name') === section) {
item.className = 'active';
} else {
item.className = '';
}
}
}
}
module.exports = HelpView;
|
© 2015 - 2026 Jakob L. Kreuze