client/home: format absolute time
This commit is contained in:
parent
ad6750a055
commit
85ed552fce
|
@ -1,5 +1,5 @@
|
||||||
<div class='content-wrapper transparent' id='home'>
|
<div class='content-wrapper transparent' id='home'>
|
||||||
<div class='messages'></div>
|
<div class='messages'></div>
|
||||||
<h1>{{name}}</h1>
|
<h1>{{name}}</h1>
|
||||||
<footer>Version: <span class='version'>{{version}}</span> (built {{buildDate}})</footer>
|
<footer>Version: <span class='version'>{{version}}</span> (built {{#reltime}}{{buildDate}}{{/reltime}})</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
require('./util/handlebars-helpers.js');
|
||||||
|
|
||||||
// ----------------------
|
// ----------------------
|
||||||
// - import controllers -
|
// - import controllers -
|
||||||
// ----------------------
|
// ----------------------
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const handlebars = require('handlebars');
|
||||||
|
const misc = require('./misc.js');
|
||||||
|
|
||||||
|
handlebars.registerHelper('reltime', function(options) {
|
||||||
|
return new handlebars.SafeString(
|
||||||
|
'<time datetime="' +
|
||||||
|
options.fn(this) +
|
||||||
|
'" title="' +
|
||||||
|
options.fn(this) +
|
||||||
|
'">' +
|
||||||
|
misc.formatRelativeTime(options.fn(this)) +
|
||||||
|
'</time>');
|
||||||
|
});
|
|
@ -1,6 +1,5 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const util = require('../util.js');
|
|
||||||
const config = require('../config.js');
|
const config = require('../config.js');
|
||||||
const BaseView = require('./base_view.js');
|
const BaseView = require('./base_view.js');
|
||||||
|
|
||||||
|
@ -14,7 +13,7 @@ class HomeView extends BaseView {
|
||||||
this.showView(this.template({
|
this.showView(this.template({
|
||||||
name: config.basic.name,
|
name: config.basic.name,
|
||||||
version: config.meta.version,
|
version: config.meta.version,
|
||||||
buildDate: util.formatRelativeTime(config.meta.buildDate),
|
buildDate: config.meta.buildDate,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue