Browse Source

add dontShowMinutes feature

modals-to-spa
stingl 4 years ago
parent
commit
0639357b22
  1. 7
      index.html
  2. 21
      js/app.js

7
index.html

@ -434,6 +434,13 @@ @@ -434,6 +434,13 @@
</label>
</div>
<br/>
<div class="form-group">
<label>
<input type="checkbox" class="form-control-checkbox" v-model="dontShowMinutes">
Zeit immer in Stunden anzeigen
</label>
</div>
<br/>
<div class="form-group" v-if="experimental.portalSwitcher">
<label>
<input type="checkbox" class="form-control-checkbox" v-model="publicDB">

21
js/app.js

@ -14,6 +14,7 @@ const TimeTrack = { @@ -14,6 +14,7 @@ const TimeTrack = {
dashboardLogo: 'assets/img/logo.png',
ticketSystemUrl: '',
showPT: true,
dontShowMinutes: false,
linkTarget: '_blank',
inputs: {
importJson: ''
@ -94,14 +95,17 @@ const TimeTrack = { @@ -94,14 +95,17 @@ const TimeTrack = {
let storedArchive = JSON.parse(localStorage.getItem('archive'));
this.archive = storedArchive == null ? [] : storedArchive;
let storedticketSystemUrl = localStorage.getItem('ticketSystemUrl');
this.ticketSystemUrl = storedticketSystemUrl == null ? '' : storedticketSystemUrl;
let storedTicketSystemUrl = localStorage.getItem('ticketSystemUrl');
this.ticketSystemUrl = storedTicketSystemUrl == null ? '' : storedTicketSystemUrl;
let storedShowPT = localStorage.getItem('showPT');
this.showPT = (storedShowPT == null || false) ? true : storedShowPT;
this.showPT = (storedShowPT == null) ? true : storedShowPT;
let storedDontShowMinutes = localStorage.getItem('dontShowMinutes');
this.dontShowMinutes = (storedDontShowMinutes == null || storedDontShowMinutes === 'false') ? false : Boolean(storedDontShowMinutes);
let storedPublicDB = localStorage.getItem('publicDB');
this.publicDB = (storedPublicDB == null || false) ? false : storedPublicDB;
this.publicDB = (storedPublicDB == null) ? false : storedPublicDB;
let storedTheme = localStorage.getItem('theme');
this.theme = storedTheme == null ? 'materia' : storedTheme;
@ -124,6 +128,7 @@ const TimeTrack = { @@ -124,6 +128,7 @@ const TimeTrack = {
localStorage.setItem('portals', JSON.stringify(this.portals));
localStorage.setItem('ticketSystemUrl', this.ticketSystemUrl);
localStorage.setItem('showPT', this.showPT);
localStorage.setItem('dontShowMinutes', Boolean(this.dontShowMinutes));
localStorage.setItem('publicDB', this.publicDB);
localStorage.setItem('fun', this.fun);
localStorage.setItem('theme', this.theme);
@ -266,14 +271,14 @@ const TimeTrack = { @@ -266,14 +271,14 @@ const TimeTrack = {
if (time >= 480 && this.showPT) {
postFix = ' PT';
time = (time / 480).toFixed(1);
} else if (time >= 60) {
} else if (time >= 60 || this.dontShowMinutes) {
postFix = ' Stunde';
time = (time / 60).toFixed(2);
}
let plural = '';
if ((time > 1 || time <= 0) && postFix !== ' PT') {
if (((time > 1 || time <= 0) || this.dontShowMinutes) && postFix !== ' PT') {
plural = 'n'
}
@ -545,6 +550,10 @@ const TimeTrack = { @@ -545,6 +550,10 @@ const TimeTrack = {
this.updateStorage();
this.$forceUpdate();
},
dontShowMinutes() {
this.updateStorage();
this.$forceUpdate();
},
theme() {
this.updateStorage();
this.$forceUpdate();