Commit e1d93ea9 authored by Jérome Perrin's avatar Jérome Perrin

support_request_ui: display relative time

including https://github.com/moment/moment version 2.22.2 Copyright (c)
JS Foundation and other contributors
parent 5a41f560
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1538885951.97</float> <float>1538971816.32</float>
<string>GMT+9</string> <string>GMT+9</string>
</tuple> </tuple>
</state> </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 */ /*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, calculatePageTitle) { (function (window, rJS, RSVP, calculatePageTitle, moment) {
"use strict"; "use strict";
rJS(window) rJS(window)
...@@ -152,6 +152,16 @@ ...@@ -152,6 +152,16 @@
page_title: all_result[7] 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 () { .push(function () {
return gadget.jio_getAttachment( return gadget.jio_getAttachment(
'post_module', 'post_module',
...@@ -181,7 +191,7 @@ ...@@ -181,7 +191,7 @@
for (i = 0; i < post_list.length; i += 1) { for (i = 0; i < post_list.length; i += 1) {
s += '<li>' + s += '<li>' +
'By <strong>' + post_list[i][0] + '</strong>' + '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) { if (post_list[i][3] !== null && result_list[i] !== null) {
post_list[i][3] = result_list[i]; post_list[i][3] = result_list[i];
} }
...@@ -269,4 +279,4 @@ ...@@ -269,4 +279,4 @@
.onEvent('submit', function () { .onEvent('submit', function () {
this.submitPostComment(); this.submitPostComment();
}); });
}(window, rJS, RSVP, calculatePageTitle)); }(window, rJS, RSVP, calculatePageTitle, moment));
\ No newline at end of file \ No newline at end of file
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1538886067.22</float> <float>1538972059.78</float>
<string>GMT+9</string> <string>GMT+9</string>
</tuple> </tuple>
</state> </state>
......
...@@ -53,7 +53,7 @@ if successor_list: ...@@ -53,7 +53,7 @@ if successor_list:
portal.portal_sessions[ portal.portal_sessions[
'%s.latest_comment' % follow_up_value.getRelativeUrl()]['comment_post_list'] = ( '%s.latest_comment' % follow_up_value.getRelativeUrl()]['comment_post_list'] = (
post.Base_getOwnerTitle(), post.Base_getOwnerTitle(),
post.getStartDate().rfc822(), post.getStartDate().ISO8601(),
post.asStrippedHTML(), post.asStrippedHTML(),
successor_link, successor_link,
successor_name, successor_name,
......
...@@ -23,7 +23,7 @@ for event in event_list: ...@@ -23,7 +23,7 @@ for event in event_list:
comment_list.append(( comment_list.append((
event.getSourceTitle(), event.getSourceTitle(),
event.getStartDate().rfc822(), event.getStartDate().ISO8601(),
event.asStrippedHTML(), event.asStrippedHTML(),
attachment_link, attachment_link,
attachment_name, 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