szurubooru/client/js/controllers/home_controller.js
rr- 69fe8ec31a client/general: refactor all the things
- Move controls to the "controls/" directory
- Make controls interface look similar to each other
- Prefix "private" methods and attributes with underscore
2016-05-21 00:08:43 +02:00

27 lines
628 B
JavaScript

'use strict';
const page = require('page');
const topNavController = require('../controllers/top_nav_controller.js');
const HomeView = require('../views/home_view.js');
class HomeController {
constructor() {
this._homeView = new HomeView();
}
registerRoutes() {
page('/', (ctx, next) => { this._indexRoute(); });
page('*', (ctx, next) => { this._notFoundRoute(); });
}
_indexRoute() {
topNavController.activate('home');
this._homeView.render({});
}
_notFoundRoute() {
topNavController.activate('');
}
}
module.exports = new HomeController();