MOBILE-4600 data: Add missing actions

main
Pau Ferrer Ocaña 2024-05-23 22:31:47 +02:00
parent e40426d454
commit 671bb39807
5 changed files with 31 additions and 5 deletions

View File

@ -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",

View File

@ -34,8 +34,12 @@
<core-comments *ngIf="action === 'comments' && mode === 'list'" contextLevel="module" [instanceId]="database.coursemodule"
component="mod_data" [itemId]="entry.id" area="database_entry" [courseId]="database.course" />
<span *ngIf="action === 'timeadded'">{{ entry.timecreated * 1000 | coreFormatDate }}</span>
<span *ngIf="action === 'timemodified'">{{ entry.timemodified * 1000 | coreFormatDate }}</span>
<span *ngIf="action === 'timeadded'" [title]="entry.timecreated * 1000 | coreFormatDate">
{{ entry.timecreated * 1000 | coreFormatDate: 'strftimedatemonthabbr' }}
</span>
<span *ngIf="action === 'timemodified'" [title]="entry.timemodified * 1000 | coreFormatDate">
{{ entry.timemodified * 1000 | coreFormatDate: 'strftimedatemonthabbr' }}
</span>
<core-user-avatar *ngIf="action === 'userpicture'" [user]="entry" slot="start" [courseId]="database.course" [userId]="entry.userid"
[profileUrl]="userPicture" />

View File

@ -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
? ''
: `<ion-badge color="warning">${Translate.instant('addon.mod_data.notapproved')}</ion-badge>`,
);
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

View File

@ -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 {

View File

@ -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",