diff --git a/scripts/langindex.json b/scripts/langindex.json index fb40d9d80..4f962d300 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -2549,6 +2549,7 @@ "core.storingfiles": "local_moodlemobileapp", "core.strftimedate": "langconfig", "core.strftimedatefullshort": "langconfig", + "core.strftimedatemonthabbr": "langconfig", "core.strftimedateshort": "langconfig", "core.strftimedatetime": "langconfig", "core.strftimedatetimeshort": "langconfig", diff --git a/src/addons/mod/data/components/action/addon-mod-data-action.html b/src/addons/mod/data/components/action/addon-mod-data-action.html index af8482d39..af4fb1692 100644 --- a/src/addons/mod/data/components/action/addon-mod-data-action.html +++ b/src/addons/mod/data/components/action/addon-mod-data-action.html @@ -34,8 +34,12 @@ -{{ entry.timecreated * 1000 | coreFormatDate }} -{{ entry.timemodified * 1000 | coreFormatDate }} + + {{ entry.timecreated * 1000 | coreFormatDate: 'strftimedatemonthabbr' }} + + + {{ entry.timemodified * 1000 | coreFormatDate: 'strftimedatemonthabbr' }} + diff --git a/src/addons/mod/data/services/data-helper.ts b/src/addons/mod/data/services/data-helper.ts index 48ab0bbc4..5b75afca8 100644 --- a/src/addons/mod/data/services/data-helper.ts +++ b/src/addons/mod/data/services/data-helper.ts @@ -247,7 +247,7 @@ export class AddonModDataHelperProvider { continue; } - if (action == AddonModDataAction.MOREURL) { + if (action === AddonModDataAction.MOREURL) { // Render more url directly because it can be part of an HTML attribute. template = template.replace( replaceRegex, @@ -255,10 +255,26 @@ export class AddonModDataHelperProvider { ); continue; - } else if (action == 'approvalstatus') { + } else if (action === AddonModDataAction.APPROVALSTATUS) { template = template.replace( replaceRegex, - Translate.instant('addon.mod_data.' + (entry.approved ? 'approved' : 'notapproved')), + entry.approved + ? '' + : `${Translate.instant('addon.mod_data.notapproved')}`, + ); + + continue; + } else if (action === AddonModDataAction.APPROVALSTATUSCLASS) { + template = template.replace( + replaceRegex, + entry.approved ? 'approved' : 'notapproved', + ); + + continue; + } else if (action === AddonModDataAction.ID) { + template = template.replace( + replaceRegex, + entry.id.toString(), ); continue; @@ -460,6 +476,7 @@ export class AddonModDataHelperProvider { timeadded: true, timemodified: true, tags: true, + id: true, edit: entry.canmanageentry && !entry.deleted, // This already checks capabilities and readonly period. delete: entry.canmanageentry, @@ -467,6 +484,7 @@ export class AddonModDataHelperProvider { disapprove: database.approval && accessInfo.canapprove && entry.approved && !entry.deleted, approvalstatus: database.approval, + approvalstatusclass: database.approval, comments: database.comments, actionsmenu: entry.canmanageentry diff --git a/src/addons/mod/data/services/data.ts b/src/addons/mod/data/services/data.ts index 7bffea41d..41dc057fb 100644 --- a/src/addons/mod/data/services/data.ts +++ b/src/addons/mod/data/services/data.ts @@ -61,9 +61,11 @@ export enum AddonModDataAction { TIMEMODIFIED = 'timemodified', TAGS = 'tags', APPROVALSTATUS = 'approvalstatus', + APPROVALSTATUSCLASS = 'approvalstatusclass', DELCHECK = 'delcheck', // Unused. EXPORT = 'export', // Unused. ACTIONSMENU = 'actionsmenu', + ID = 'id', } export enum AddonModDataTemplateType { diff --git a/src/core/lang.json b/src/core/lang.json index 99e49b466..0ba0d5224 100644 --- a/src/core/lang.json +++ b/src/core/lang.json @@ -312,6 +312,7 @@ "startingtime": "Starting time: {{$a}}", "storingfiles": "Storing files", "strftimedate": "%d %B %Y", + "strftimedatemonthabbr": "%d %b %Y", "strftimedatefullshort": "%d/%m/%y", "strftimedateshort": "%d %B", "strftimedatetime": "%d %B %Y, %I:%M %p",