From f7b9384d261beaa70994340eb83d6b77ac6535af Mon Sep 17 00:00:00 2001 From: Zara Gebru Date: Fri, 15 Apr 2016 11:27:01 +0200 Subject: Issue #678: added utility converting time passed and dynamically changing version timestamp --- web-ui/app/js/page/version.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'web-ui/app/js/page') diff --git a/web-ui/app/js/page/version.js b/web-ui/app/js/page/version.js index e5299f52..9fd5e629 100644 --- a/web-ui/app/js/page/version.js +++ b/web-ui/app/js/page/version.js @@ -14,13 +14,23 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -define(['flight/lib/component', 'views/templates'], function (defineComponent, templates) { +define(['flight/lib/component', 'views/templates', 'helpers/view_helper'], function (defineComponent, templates, viewHelper) { 'use strict'; return defineComponent(function () { - + this.defaultAttrs({ + 'sinceDate': '#version-date' + }); + this.render = function () { this.$node.html(templates.page.version()); + this.renderCommitDate(); + }; + + this.renderCommitDate = function(){ + var since = this.select('sinceDate').attr('data-since'), + commitDate = viewHelper.sinceDate(since); + this.select('sinceDate').html(commitDate + ' ago'); }; this.after('initialize', function () { -- cgit v1.2.3