fix theme switching in style guide

This commit is contained in:
Andrei Stefan
2017-05-02 16:45:34 +03:00
parent f43c749422
commit 53ccc6f48f
2 changed files with 7 additions and 7 deletions

View File

@@ -9,10 +9,6 @@
<i class="fa fa-random"></i>
Switch theme
</a>
<a class="btn btn-inverse" ng-click="ctrl.switchTheme()">
<i class="fa fa-refresh"></i>
Reload
</a>
<div class="page-header-tabs">
<ul class="gf-tabs">

View File

@@ -14,7 +14,7 @@ class StyleGuideCtrl {
pages = ['colors', 'buttons', 'icons', 'plugins'];
/** @ngInject **/
constructor(private $http, private $routeParams, private $location) {
constructor(private $http, private $routeParams, private $location, private backendSrv) {
this.theme = config.bootData.user.lightTheme ? 'light': 'dark';
this.page = {};
@@ -49,8 +49,12 @@ class StyleGuideCtrl {
switchTheme() {
this.$routeParams.theme = this.theme === 'dark' ? 'light' : 'dark';
this.$location.search(this.$routeParams);
setTimeout(() => {
var cmd = {
theme: this.$routeParams.theme
};
this.backendSrv.put('/api/user/preferences', cmd).then(() => {
window.location.href = window.location.href;
});
}