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