styleguide.ts 691 B

12345678910111213141516171819202122232425262728
  1. import coreModule from 'app/core/core_module';
  2. import config from 'app/core/config';
  3. import _ from 'lodash';
  4. class StyleGuideCtrl {
  5. colors: any = [];
  6. theme: string;
  7. /** @ngInject **/
  8. constructor($http) {
  9. this.theme = config.bootData.user.lightTheme ? 'light': 'dark';
  10. $http.get('public/sass/styleguide.json').then(res => {
  11. this.colors = _.map(res.data[this.theme], (value, key) => {
  12. return {name: key, value: value};
  13. });
  14. });
  15. }
  16. switchTheme() {
  17. var other = this.theme === 'dark' ? 'light' : 'dark';
  18. window.location.href = config.appSubUrl + '/styleguide?theme=' + other;
  19. }
  20. }
  21. coreModule.controller('StyleGuideCtrl', StyleGuideCtrl);