szurubooru/client/js/controllers/settings_controller.js

29 lines
789 B
JavaScript
Raw Normal View History

'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('change', e => this._evtChange(e));
}
_evtChange(e) {
this._view.clearMessages();
2016-08-05 20:09:11 +02:00
settings.save(e.detail);
this._view.showSuccess('Settings saved.');
}
};
module.exports = router => {
router.enter('/settings', (ctx, next) => {
ctx.controller = new SettingsController();
});
};