store version in window.pskl and display it in settings

This commit is contained in:
juliandescottes 2017-05-14 17:16:24 +02:00 committed by Julian Descottes
parent b768a22b1c
commit df6780a3e7
4 changed files with 38 additions and 2 deletions

View file

@ -12,6 +12,7 @@ module.exports = function(grunt) {
// create a version based on the build timestamp // create a version based on the build timestamp
var dateFormat = require('dateformat'); var dateFormat = require('dateformat');
var version = '-' + dateFormat(new Date(), "yyyy-mm-dd-hh-MM"); var version = '-' + dateFormat(new Date(), "yyyy-mm-dd-hh-MM");
var releaseVersion = require('./package.json').version;
/** /**
* Helper to prefix all strings in provided array with the provided path * Helper to prefix all strings in provided array with the provided path
@ -194,7 +195,8 @@ module.exports = function(grunt) {
dest: 'dest/tmp/index.html', dest: 'dest/tmp/index.html',
options : { options : {
globals : { globals : {
'version' : version 'version' : version,
'releaseVersion' : releaseVersion
} }
} }
} }

View file

@ -1,6 +1,16 @@
/*******************************/ /*******************************/
/* Application Setting panel */ /* Application Setting panel */
/*******************************/ /*******************************/
.application-settings-form {
height: 100%;
}
.settings-section-application {
position: relative;
overflow: hidden;
margin: 0 20px;
height: 100%;
}
.background-picker-wrapper { .background-picker-wrapper {
display: inline-block; display: inline-block;
@ -67,3 +77,18 @@
.settings-section-application .button-primary { .settings-section-application .button-primary {
margin-top: 10px; margin-top: 10px;
} }
.settings-version-info {
position: absolute;
bottom: 10px;
right: 10px;
color: #888;
}
/* Override default link styles for the release notes link
It doesn't need to popout too much */
.settings-version,
.settings-version:hover {
color: white !important;
text-decoration: none !important;
}

View file

@ -18,6 +18,7 @@
loadingMask.style.opacity = 0; loadingMask.style.opacity = 0;
window.setTimeout(function () {loadingMask.parentNode.removeChild(loadingMask);}, 600); window.setTimeout(function () {loadingMask.parentNode.removeChild(loadingMask);}, 600);
pskl.app.init(); pskl.app.init();
pskl._releaseVersion = '@@releaseVersion';
// cleanup // cleanup
delete window.pskl_exports; delete window.pskl_exports;
delete window.loadDebugScripts; delete window.loadDebugScripts;

View file

@ -1,5 +1,5 @@
<script type="text/html" id="templates/settings/application.html"> <script type="text/html" id="templates/settings/application.html">
<form action="" method="POST" name="application-settings-form"> <form action="" method="POST" name="application-settings-form" class="application-settings-form">
<div class="settings-section settings-section-application"> <div class="settings-section settings-section-application">
<div class="settings-title"> <div class="settings-title">
General General
@ -66,6 +66,14 @@
</select> </select>
</div> </div>
<div class="settings-version-info">
Piskel
<span rel="tooltip" data-placement="bottom" title="View release notes">
<a class="settings-version" target="_blank"
href="https://github.com/piskelapp/piskel/releases/tag/v@@releaseVersion">v@@releaseVersion</a>
</span>
</div>
<input type="submit" class="button button-primary" value="Apply settings" /> <input type="submit" class="button button-primary" value="Apply settings" />
</div> </div>
</form> </form>