mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-65135 message: use full date in messaging drawer for old messages.
Messages sent in previous years will now include the year portion of the date string.
This commit is contained in:
parent
ed2400457b
commit
5d778a7646
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -575,8 +575,10 @@ function(
|
||||
var renderAddDays = function(header, body, footer, days, datesCache) {
|
||||
var messagesContainer = getMessagesContainer(body);
|
||||
var daysRenderPromises = days.map(function(data) {
|
||||
var timestampDate = new Date(data.value.timestamp * 1000);
|
||||
return Templates.render(TEMPLATES.DAY, {
|
||||
timestamp: data.value.timestamp,
|
||||
currentyear: timestampDate.getFullYear() === (new Date()).getFullYear(),
|
||||
messages: formatMessagesForTemplate(data.value.messages, datesCache)
|
||||
});
|
||||
});
|
||||
|
@ -27,14 +27,25 @@
|
||||
* All data attributes are required
|
||||
|
||||
Context variables required for this template:
|
||||
* userid The logged in user id
|
||||
* urls The URLs for the popover
|
||||
* timestamp
|
||||
* currentyear
|
||||
* messages
|
||||
|
||||
Example context (json):
|
||||
{}
|
||||
|
||||
{
|
||||
"timestamp": 946684800,
|
||||
"currentyear": false,
|
||||
"messages": []
|
||||
}
|
||||
}}
|
||||
<div class="mt-4" data-region="day-container" data-day-id="{{timestamp}}">
|
||||
<h6 class="text-center mb-4 day">{{#userdate}} {{timestamp}}, {{#str}} strftimedateshort, core_langconfig {{/str}} {{/userdate}}</h6>
|
||||
<h6 class="text-center mb-4 day">
|
||||
{{#currentyear}}
|
||||
{{#userdate}} {{timestamp}}, {{#str}} strftimedateshort, core_langconfig {{/str}} {{/userdate}}
|
||||
{{/currentyear}}
|
||||
{{^currentyear}}
|
||||
{{#userdate}} {{timestamp}}, {{#str}} strftimedate, core_langconfig {{/str}} {{/userdate}}
|
||||
{{/currentyear}}
|
||||
</h6>
|
||||
{{> core_message/message_drawer_view_conversation_body_messages }}
|
||||
</div>
|
Loading…
x
Reference in New Issue
Block a user