aboutsummaryrefslogtreecommitdiff
path: root/client/js/controllers/help_controller.js
diff options
context:
space:
mode:
authorrr-2016-06-14 10:31:48 +0200
committerrr-2016-06-18 10:35:20 +0200
commit54e3099c5696e0b4fc7b05fb5ecc41ab4726628b (patch)
tree29127e1c3d3d3d9bebfccefdf148da7305e2d5b3 /client/js/controllers/help_controller.js
parentc74f06da35af3c35d565a3c96e3d048f7a1ec011 (diff)
client/general: refactor control flow
- Controller lifetime is bound to route lifetime - View lifetime is bound to controller lifetime - Control lifetime is bound to view lifetime - Enhanced event dispatching - Enhanced responsiveness in some places - Views communicate user input to controllers via new event system
Diffstat (limited to 'client/js/controllers/help_controller.js')
-rw-r--r--client/js/controllers/help_controller.js42
1 files changed, 15 insertions, 27 deletions
diff --git a/client/js/controllers/help_controller.js b/client/js/controllers/help_controller.js
index 9c199a6..f7dcafa 100644
--- a/client/js/controllers/help_controller.js
+++ b/client/js/controllers/help_controller.js
@@ -1,35 +1,23 @@
'use strict';
-const router = require('../router.js');
-const TopNavigation = require('../models/top_navigation.js');
+const topNavigation = require('../models/top_navigation.js');
const HelpView = require('../views/help_view.js');
class HelpController {
- constructor() {
- this._helpView = new HelpView();
- }
-
- registerRoutes() {
- router.enter(
- '/help',
- (ctx, next) => { this._showHelpRoute(); });
- router.enter(
- '/help/:section',
- (ctx, next) => { this._showHelpRoute(ctx.params.section); });
- router.enter(
- '/help/:section/:subsection',
- (ctx, next) => {
- this._showHelpRoute(ctx.params.section, ctx.params.subsection);
- });
- }
-
- _showHelpRoute(section, subsection) {
- TopNavigation.activate('help');
- this._helpView.render({
- section: section,
- subsection: subsection,
- });
+ constructor(section, subsection) {
+ topNavigation.activate('help');
+ this._helpView = new HelpView(section, subsection);
}
}
-module.exports = new HelpController();
+module.exports = router => {
+ router.enter('/help', (ctx, next) => {
+ new HelpController();
+ });
+ router.enter('/help/:section', (ctx, next) => {
+ new HelpController(ctx.params.section);
+ });
+ router.enter('/help/:section/:subsection', (ctx, next) => {
+ new HelpController(ctx.params.section, ctx.params.subsection);
+ });
+};

© 2015 - 2026 Jakob L. Kreuze