Commit 480729e3 authored by Jérome Perrin's avatar Jérome Perrin

support_request_ui: display relative time

using momentjs that's already bundled in jiodev.js
parent 5a41f560
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1538885951.97</float>
<float>1538971816.32</float>
<string>GMT+9</string>
</tuple>
</state>
......
/*global window, rJS, RSVP, calculatePageTitle, FormData, URI, jIO*/
/*global window, rJS, RSVP, calculatePageTitle, FormData, URI, jIO, moment */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, calculatePageTitle) {
(function (window, rJS, RSVP, calculatePageTitle, moment) {
"use strict";
rJS(window)
......@@ -152,6 +152,16 @@
page_title: all_result[7]
});
})
.push(function () {
// set locale for momentjs
return gadget.jio_getAttachment(
'post_module',
gadget.hateoas_url + "/Localizer/get_selected_language",
{format:'text'}
).push(function(lang){
moment.locale(lang);
})
})
.push(function () {
return gadget.jio_getAttachment(
'post_module',
......@@ -181,7 +191,7 @@
for (i = 0; i < post_list.length; i += 1) {
s += '<li>' +
'By <strong>' + post_list[i][0] + '</strong>' +
' - <time>' + post_list[i][1] + '</time><br/>';
' - <time datetime="' + post_list[i][1] + '" title="' + moment(post_list[i][1]).format('LLLL') + '">' + moment(post_list[i][1]).fromNow() + '</time><br/>';
if (post_list[i][3] !== null && result_list[i] !== null) {
post_list[i][3] = result_list[i];
}
......@@ -269,4 +279,4 @@
.onEvent('submit', function () {
this.submitPostComment();
});
}(window, rJS, RSVP, calculatePageTitle));
\ No newline at end of file
}(window, rJS, RSVP, calculatePageTitle, moment));
\ No newline at end of file
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1538886067.22</float>
<float>1538972059.78</float>
<string>GMT+9</string>
</tuple>
</state>
......
......@@ -53,7 +53,7 @@ if successor_list:
portal.portal_sessions[
'%s.latest_comment' % follow_up_value.getRelativeUrl()]['comment_post_list'] = (
post.Base_getOwnerTitle(),
post.getStartDate().rfc822(),
post.getStartDate().ISO8601(),
post.asStrippedHTML(),
successor_link,
successor_name,
......
......@@ -23,7 +23,7 @@ for event in event_list:
comment_list.append((
event.getSourceTitle(),
event.getStartDate().rfc822(),
event.getStartDate().ISO8601(),
event.asStrippedHTML(),
attachment_link,
attachment_name,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment