|
@@ -9,12 +9,27 @@ class StyleGuideCtrl {
|
|
|
buttonNames = ['primary', 'secondary', 'inverse', 'success', 'warning', 'danger'];
|
|
buttonNames = ['primary', 'secondary', 'inverse', 'success', 'warning', 'danger'];
|
|
|
buttonSizes = ['btn-small', '', 'btn-large'];
|
|
buttonSizes = ['btn-small', '', 'btn-large'];
|
|
|
buttonVariants = ['-', '-outline-'];
|
|
buttonVariants = ['-', '-outline-'];
|
|
|
|
|
+ page: any;
|
|
|
|
|
+ pages = ['colors', 'buttons', 'forms', 'dashboard', 'query-editors'];
|
|
|
|
|
|
|
|
/** @ngInject **/
|
|
/** @ngInject **/
|
|
|
- constructor($http) {
|
|
|
|
|
|
|
+ constructor(private $http, $routeParams) {
|
|
|
this.theme = config.bootData.user.lightTheme ? 'light': 'dark';
|
|
this.theme = config.bootData.user.lightTheme ? 'light': 'dark';
|
|
|
|
|
+ this.page = {};
|
|
|
|
|
|
|
|
- $http.get('public/sass/styleguide.json').then(res => {
|
|
|
|
|
|
|
+ if ($routeParams.page) {
|
|
|
|
|
+ this.page[$routeParams.page] = 1;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.page.colors = true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (this.page.colors) {
|
|
|
|
|
+ this.loadColors();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ loadColors() {
|
|
|
|
|
+ this.$http.get('public/sass/styleguide.json').then(res => {
|
|
|
this.colors = _.map(res.data[this.theme], (value, key) => {
|
|
this.colors = _.map(res.data[this.theme], (value, key) => {
|
|
|
return {name: key, value: value};
|
|
return {name: key, value: value};
|
|
|
});
|
|
});
|
|
@@ -23,7 +38,7 @@ class StyleGuideCtrl {
|
|
|
|
|
|
|
|
switchTheme() {
|
|
switchTheme() {
|
|
|
var other = this.theme === 'dark' ? 'light' : 'dark';
|
|
var other = this.theme === 'dark' ? 'light' : 'dark';
|
|
|
- window.location.href = config.appSubUrl + '/styleguide?theme=' + other;
|
|
|
|
|
|
|
+ window.location.href = window.location.href + '?theme=' + other;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|