szurubooru/client/js/controllers/settings_controller.js
rr- 76882b59ef client/router: introduce own router
I'm tired of page.js lack of documentation around finer quirks, and
being forced to read its crap code. Refactored into classes, removed
unused cruft.
2016-06-12 21:43:20 +02:00

26 lines
747 B
JavaScript

'use strict';
const router = require('../router.js');
const settings = require('../settings.js');
const topNavController = require('../controllers/top_nav_controller.js');
const SettingsView = require('../views/settings_view.js');
class SettingsController {
constructor() {
this._settingsView = new SettingsView();
}
registerRoutes() {
router.enter('/settings', (ctx, next) => { this._settingsRoute(); });
}
_settingsRoute() {
topNavController.activate('settings');
this._settingsView.render({
getSettings: () => settings.getSettings(),
saveSettings: newSettings => settings.saveSettings(newSettings),
});
}
};
module.exports = new SettingsController();