From cf2c56c7061b7ed40fdd3b40a352ddb9c9b7371f Mon Sep 17 00:00:00 2001 From: alexwl Date: Tue, 2 Oct 2018 13:17:04 +0300 Subject: Initial commit --- javascript/app/controllers/application.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 javascript/app/controllers/application.js (limited to 'javascript/app/controllers/application.js') diff --git a/javascript/app/controllers/application.js b/javascript/app/controllers/application.js new file mode 100644 index 0000000..2936011 --- /dev/null +++ b/javascript/app/controllers/application.js @@ -0,0 +1,21 @@ +import {updateColorThemeCss,themes} from '../utils/color-themes'; +import Ember from 'ember'; + +export default Ember.Controller.extend({ + settings : Ember.inject.service('settings'), + themes: Object.values(themes), + init() { + this._super(...arguments); + updateColorThemeCss(this.get('settings').get('colorTheme')); + }, + currentTheme: Ember.computed('settings',function() { + return this.get('settings.colorTheme.id'); + }), + actions : { + themeChanged (themeId) { + const theme = themes[themeId]; + this.get('settings').set('colorTheme',theme); + updateColorThemeCss(theme); + } + } +}); -- cgit v1.2.3