aboutsummaryrefslogtreecommitdiff
path: root/javascript/app/controllers/application.js
blob: 2936011290ce7e56857ee75522bb66f8cd4c1ad8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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);
    }
  }
});