szurubooru/client/js/controllers/settings_controller.js
rr- 1acceb941d client: refactor linking and routing
Print all links through new uri.js component
Refactor the router to use more predictable parsing
Fix linking to entities with weird names (that contain slashes, + etc.)
2017-01-21 00:13:35 +01:00

28 lines
790 B
JavaScript

'use strict';
const settings = require('../models/settings.js');
const topNavigation = require('../models/top_navigation.js');
const SettingsView = require('../views/settings_view.js');
class SettingsController {
constructor() {
topNavigation.activate('settings');
topNavigation.setTitle('Browsing settings');
this._view = new SettingsView({
settings: settings.get(),
});
this._view.addEventListener('submit', e => this._evtSubmit(e));
}
_evtSubmit(e) {
this._view.clearMessages();
settings.save(e.detail);
this._view.showSuccess('Settings saved.');
}
};
module.exports = router => {
router.enter(['settings'], (ctx, next) => {
ctx.controller = new SettingsController();
});
};