gallery.accords-library.com/client/js/controllers/settings_controller.js

29 lines
793 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("submit", (e) => this._evtSubmit(e));
}
_evtSubmit(e) {
this._view.clearMessages();
2016-08-05 18:09:11 +00:00
settings.save(e.detail);
this._view.showSuccess("Settings saved.");
}
2020-06-04 18:09:35 +00:00
}
module.exports = (router) => {
router.enter(["settings"], (ctx, next) => {
ctx.controller = new SettingsController();
});
};