Added version information to front page

This commit is contained in:
Marcin Kurczewski 2014-10-12 19:30:50 +02:00
parent e19ab7887f
commit 5383008315
7 changed files with 23 additions and 5 deletions

1
TODO
View file

@ -59,7 +59,6 @@ refactors:
miscellaneous:
- endless pager should include information about page number
- add log engine and log everything that should be logged
- add version on homepage that reads version from package.json and git hash
- add README - apache2 has good README:
http://svn.apache.org/repos/asf/httpd/httpd/trunk/README
- add spinner to forms such as registration, user query, login, settings

View file

@ -40,8 +40,10 @@ function readTemplates(grunt) {
module.exports = function(grunt) {
var pkg = grunt.file.readJSON('package.json');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
pkg: pkg,
phpCheckStyleConfigPath: phpCheckStyleConfigPath,
phpSourcesDir: phpSourcesDir,
@ -114,6 +116,7 @@ module.exports = function(grunt) {
processhtml: {
options: {
data: {
version: pkg.version + '@' + exec('git rev-parse --short HEAD', {silent: true}).output.trim(),
customFaviconUrl: config.misc.customFaviconUrl,
serviceName: config.basic.serviceName,
templates: readTemplates(grunt),

View file

@ -1,6 +1,6 @@
{
"name": "szuru2",
"version": "0.0.0",
"name": "szurubooru",
"version": "0.9.0",
"dependencies": {
"jquery.cookie": "1.4.1",
"jquery": "~2.1.1",

View file

@ -32,3 +32,8 @@
#home .post-footer img {
margin-left: 0.5em;
}
#home .version {
opacity: .4;
font-size: 12px;
}

View file

@ -1,6 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<!-- build:remove -->
<head data-version="dev" data-build-time="">
<!-- /build -->
<!-- build:template
<head data-version="<%= version %>" data-build-time="<%= timestamp %>">
/build -->
<meta charset="utf-8"/>
<!-- build:remove -->

View file

@ -53,6 +53,8 @@ App.Presenters.HomePresenter = function(
canViewPosts: auth.hasPrivilege(auth.privileges.viewPosts),
formatRelativeTime: util.formatRelativeTime,
formatFileSize: util.formatFileSize,
version: jQuery('head').attr('data-version'),
buildTime: jQuery('head').attr('data-build-time'),
}));
}

View file

@ -49,4 +49,8 @@
</div>
</div>
<% } %>
<p>
<small class="version">Version: <a href="//github.com/rr-/szuru2/commits/master"><%= version %></a> (built <%= formatRelativeTime(buildTime) %>)</small>
</p>
</div>