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