From 322528a9743db839dc904442597a282c3128edff Mon Sep 17 00:00:00 2001 From: Pierre Date: Sat, 23 Dec 2017 18:32:54 +0100 Subject: [PATCH] Display "member since" on the left --- assets/js/common/date.js | 11 +++++++++++ assets/js/pages/userPage/profileInfos.js | 20 +++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/assets/js/common/date.js b/assets/js/common/date.js index 8c1f486a..5a925ddc 100644 --- a/assets/js/common/date.js +++ b/assets/js/common/date.js @@ -83,4 +83,15 @@ ComunicWeb.common.date = { return years + " years"; } }, + + /** + * Get the difference of time from now to a specified + * timestamp and return it as a string + * + * @param {Integer} time The base time + * @return {String} Computed difference + */ + timeDiffToStr: function(time){ + return this.diffToStr(this.time() - time); + }, } \ No newline at end of file diff --git a/assets/js/pages/userPage/profileInfos.js b/assets/js/pages/userPage/profileInfos.js index 7c2a9ed5..a9590f1d 100644 --- a/assets/js/pages/userPage/profileInfos.js +++ b/assets/js/pages/userPage/profileInfos.js @@ -83,7 +83,25 @@ ComunicWeb.pages.userPage.profileInfos = { type: "a", class: "pull-right", innerHTML: infos.number_friends - }) + }); + + //Add user account creation time + var accountCreationLi = createElem2({ + appendTo: listInfos, + type: "li", + class: "list-group-item" + }); + createElem2({ + appendTo: accountCreationLi, + type: "b", + innerHTML: "Member since" + }); + createElem2({ + appendTo: accountCreationLi, + type: "a", + class: "pull-right", + innerHTML: ComunicWeb.common.date.timeDiffToStr(infos.account_creation_time), + }); //Add user status informations (if required) if(signed_in()){