Skip to content

Commit

Permalink
Move theme and fullscreen to home
Browse files Browse the repository at this point in the history
  • Loading branch information
javalikescript committed May 25, 2024
1 parent 3f415d7 commit 9c166fa
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
2 changes: 2 additions & 0 deletions extensions/web-base/www/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@
-->
<app-page id="home" :title="title" hide-back="true">
<template slot="bar-right">
<button v-on:click="nextTheme()" title="Next theme"><i class="fas fa-brush"></i></button>
<button v-if="app.canAdminister" v-on:click="app.toPage('engineSettings')" title="Configuration"><i class="fas fa-cog"></i></button>
<button v-on:click="app.hideMenu = !app.hideMenu" title="Hide Menu"><i class="fas fa-expand-alt"></i></button>
</template>
<article class="tiles">
<div class="tile" v-for="tile in sortedTiles" v-on:click="onTile(tile)">
Expand Down
17 changes: 17 additions & 0 deletions extensions/web-base/www/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var fetchInitNoCache = {
var app = new Vue({
el: '#app',
data: {
theme: 'boot',
menu: '',
hideMenu: window.innerWidth < 360,
dialog: '',
Expand All @@ -32,6 +33,16 @@ var app = new Vue({
user: {}
},
methods: {
setTheme: function(theme) {
if (this.theme !== theme) {
this.theme = theme;
var body = document.getElementsByTagName('body')[0];
body.setAttribute('class', 'theme_' + theme);
}
},
getTheme: function() {
return this.theme;
},
toPage: function(id, path) {
this.navigateTo(formatNavigationPath(id, path));
},
Expand Down Expand Up @@ -439,6 +450,12 @@ var homePage = new Vue({
window.open(tile.url, '_blank');
}
}
},
nextTheme: function() {
var theme = app.getTheme();
var themes = ['light', 'ms', 'black'];
var index = (themes.indexOf(theme) + 1) % themes.length;
app.setTheme(themes[index]);
}
},
computed: {
Expand Down
3 changes: 1 addition & 2 deletions extensions/web-base/www/app/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ window.addEventListener('hashchange', function() {
homePage.title = webBaseConfig.title;
}
if (webBaseConfig.theme) {
var body = document.getElementsByTagName('body')[0];
body.setAttribute('class', 'theme_' + webBaseConfig.theme);
app.setTheme(webBaseConfig.theme);
}
app.user = results[2];
var addons = results[1];
Expand Down
1 change: 0 additions & 1 deletion extensions/web-dashboard/web-dashboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<template slot="bar-right">
<button v-on:click="app.toPage('extension', 'web-dashboard')" title="Configuration"><i class="fas fa-cog"></i></button>
<button :title="'Last change ' + (lastChange ? lastChange.toISOString() : 'not available')"><i :class="['fas', 'fa-' + (changeTimer ? 'link' : 'unlink')]"></i></button>
<button v-on:click="app.hideMenu = !app.hideMenu" title="Hide Menu"><i class="fas fa-expand-alt"></i></button>
</template>
<article>
<div class="tile-container">
Expand Down

0 comments on commit 9c166fa

Please sign in to comment.