diff options
author | Zara Gebru <zgebru@thoughtworks.com> | 2016-04-15 11:27:01 +0200 |
---|---|---|
committer | Zara Gebru <zgebru@thoughtworks.com> | 2016-04-15 11:31:25 +0200 |
commit | f7b9384d261beaa70994340eb83d6b77ac6535af (patch) | |
tree | bdd6e97321d92987fdc1ae9f72eab3a89fe9635c /web-ui/app/js/page | |
parent | cd571f8542566a83e7f95e23859433e09b7df814 (diff) |
Issue #678: added utility converting time passed and dynamically changing version timestamp
Diffstat (limited to 'web-ui/app/js/page')
-rw-r--r-- | web-ui/app/js/page/version.js | 14 |
1 files changed, 12 insertions, 2 deletions
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 <http://www.gnu.org/licenses/>. */ -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 () { |