2016-03-19 21:37:04 +01:00
|
|
|
'use strict';
|
|
|
|
|
2016-06-12 20:11:43 +02:00
|
|
|
const router = require('../router.js');
|
2016-04-01 00:20:34 +02:00
|
|
|
const topNavController = require('../controllers/top_nav_controller.js');
|
|
|
|
const HelpView = require('../views/help_view.js');
|
|
|
|
|
2016-03-19 21:37:04 +01:00
|
|
|
class HelpController {
|
2016-04-01 00:20:34 +02:00
|
|
|
constructor() {
|
2016-05-20 21:35:12 +02:00
|
|
|
this._helpView = new HelpView();
|
2016-03-19 21:37:04 +01:00
|
|
|
}
|
|
|
|
|
2016-04-06 21:49:26 +02:00
|
|
|
registerRoutes() {
|
2016-06-12 20:11:43 +02:00
|
|
|
router.enter(
|
|
|
|
'/help',
|
|
|
|
(ctx, next) => { this._showHelpRoute(); });
|
|
|
|
router.enter(
|
2016-04-06 21:49:26 +02:00
|
|
|
'/help/:section',
|
2016-05-20 21:35:12 +02:00
|
|
|
(ctx, next) => { this._showHelpRoute(ctx.params.section); });
|
2016-06-12 20:11:43 +02:00
|
|
|
router.enter(
|
2016-04-17 00:03:45 +02:00
|
|
|
'/help/:section/:subsection',
|
|
|
|
(ctx, next) => {
|
2016-05-20 21:35:12 +02:00
|
|
|
this._showHelpRoute(ctx.params.section, ctx.params.subsection);
|
2016-04-17 00:03:45 +02:00
|
|
|
});
|
2016-04-06 21:49:26 +02:00
|
|
|
}
|
|
|
|
|
2016-05-20 21:35:12 +02:00
|
|
|
_showHelpRoute(section, subsection) {
|
2016-04-01 00:20:34 +02:00
|
|
|
topNavController.activate('help');
|
2016-05-20 21:35:12 +02:00
|
|
|
this._helpView.render({
|
2016-04-08 10:35:38 +02:00
|
|
|
section: section,
|
2016-04-17 00:03:45 +02:00
|
|
|
subsection: subsection,
|
2016-04-08 10:35:38 +02:00
|
|
|
});
|
2016-03-19 21:37:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-01 00:20:34 +02:00
|
|
|
module.exports = new HelpController();
|