2016-04-11 20:38:59 +00:00
|
|
|
'use strict';
|
|
|
|
|
2016-06-12 18:11:43 +00:00
|
|
|
const router = require('../router.js');
|
2016-04-14 18:28:44 +00:00
|
|
|
const settings = require('../settings.js');
|
2016-06-13 20:34:39 +00:00
|
|
|
const TopNavigation = require('../models/top_navigation.js');
|
2016-04-11 20:38:59 +00:00
|
|
|
const SettingsView = require('../views/settings_view.js');
|
|
|
|
|
|
|
|
class SettingsController {
|
|
|
|
constructor() {
|
2016-05-20 19:35:12 +00:00
|
|
|
this._settingsView = new SettingsView();
|
2016-04-11 20:38:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
registerRoutes() {
|
2016-06-12 18:11:43 +00:00
|
|
|
router.enter('/settings', (ctx, next) => { this._settingsRoute(); });
|
2016-04-11 20:38:59 +00:00
|
|
|
}
|
|
|
|
|
2016-05-20 19:35:12 +00:00
|
|
|
_settingsRoute() {
|
2016-06-13 20:34:39 +00:00
|
|
|
TopNavigation.activate('settings');
|
2016-05-20 19:35:12 +00:00
|
|
|
this._settingsView.render({
|
2016-04-14 18:28:44 +00:00
|
|
|
getSettings: () => settings.getSettings(),
|
|
|
|
saveSettings: newSettings => settings.saveSettings(newSettings),
|
2016-04-11 20:38:59 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = new SettingsController();
|