commit
4d22792e79
|
@ -639,6 +639,8 @@
|
|||
"addon.mod_forum.erroremptysubject": "forum",
|
||||
"addon.mod_forum.errorgetforum": "local_moodlemobileapp",
|
||||
"addon.mod_forum.errorgetgroups": "local_moodlemobileapp",
|
||||
"addon.mod_forum.errorloadingsortingorder": "local_moodlemobileapp",
|
||||
"addon.mod_forum.errorloadingsortingorderdetails": "local_moodlemobileapp",
|
||||
"addon.mod_forum.errorposttoallgroups": "local_moodlemobileapp",
|
||||
"addon.mod_forum.favourites": "forum",
|
||||
"addon.mod_forum.favouriteupdated": "forum",
|
||||
|
|
|
@ -62,14 +62,14 @@
|
|||
|
||||
<!-- Reset search. -->
|
||||
<ng-container *ngIf="search.searching && !isEmpty">
|
||||
<ion-item (click)="searchReset()" button detail="false" *ngIf="!foundRecordsTranslationData">
|
||||
<ion-item (click)="searchReset($event)" button detail="false" *ngIf="!foundRecordsTranslationData">
|
||||
<ion-label color="info">
|
||||
{{ 'addon.mod_data.resetsettings' | translate}}
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
|
||||
<ion-card class="core-success-card" *ngIf="foundRecordsTranslationData">
|
||||
<ion-item (click)="searchReset()" button detail="false">
|
||||
<ion-item (click)="searchReset($event)" button detail="false">
|
||||
<ion-label>
|
||||
<p [innerHTML]="'addon.mod_data.foundrecords' | translate:{$a: foundRecordsTranslationData}"></p>
|
||||
</ion-label>
|
||||
|
@ -105,7 +105,7 @@
|
|||
|
||||
<core-empty-box *ngIf="isEmpty && search.searching" icon="fas-database" [message]="'addon.mod_data.nomatch' | translate"
|
||||
class="core-empty-box-clickable">
|
||||
<button class="as-link" (click)="searchReset()">{{ 'addon.mod_data.resetsettings' | translate}}</button>
|
||||
<button class="as-link" (click)="searchReset($event)">{{ 'addon.mod_data.resetsettings' | translate}}</button>
|
||||
</core-empty-box>
|
||||
|
||||
</core-loading>
|
||||
|
|
|
@ -426,8 +426,13 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
|
|||
|
||||
/**
|
||||
* Reset all search filters and closes the modal.
|
||||
*
|
||||
* @param ev Event.
|
||||
*/
|
||||
searchReset(): void {
|
||||
searchReset(ev: Event): void {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
|
||||
this.search.sortBy = '0';
|
||||
this.search.sortDirection = 'DESC';
|
||||
this.search.text = '';
|
||||
|
|
|
@ -44,6 +44,7 @@ export class AddonModForumDiscussionsSource extends CoreRoutedItemsManagerSource
|
|||
groupInfo?: CoreGroupInfo;
|
||||
allPartsPermissions?: AddonModForumCanAddDiscussion;
|
||||
canAddDiscussionToGroup = true;
|
||||
errorLoadingDiscussions = false;
|
||||
|
||||
constructor(courseId: number, cmId: number, discussionsPathPrefix: string) {
|
||||
super();
|
||||
|
@ -222,13 +223,27 @@ export class AddonModForumDiscussionsSource extends CoreRoutedItemsManagerSource
|
|||
throw new Error('Can\'t load discussions without a forum or selected sort order');
|
||||
}
|
||||
|
||||
const response = await AddonModForum.getDiscussions(this.forum.id, {
|
||||
cmId: this.forum.cmid,
|
||||
sortOrder: this.selectedSortOrder.value,
|
||||
page,
|
||||
groupId: this.groupId,
|
||||
});
|
||||
let discussions = response.discussions;
|
||||
let discussions: AddonModForumDiscussion[] = [];
|
||||
let canLoadMore = false;
|
||||
try {
|
||||
const response = await AddonModForum.getDiscussions(this.forum.id, {
|
||||
cmId: this.forum.cmid,
|
||||
sortOrder: this.selectedSortOrder.value,
|
||||
page,
|
||||
groupId: this.groupId,
|
||||
});
|
||||
|
||||
discussions = response.discussions;
|
||||
canLoadMore = response.canLoadMore;
|
||||
this.errorLoadingDiscussions = false;
|
||||
} catch (error) {
|
||||
if (page > 0 || CoreUtils.isWebServiceError(error)) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
// Error loading first discussions, use an empty list.
|
||||
this.errorLoadingDiscussions = true;
|
||||
}
|
||||
|
||||
if (this.usesGroups) {
|
||||
discussions = await AddonModForum.formatDiscussionsGroups(this.forum.cmid, discussions);
|
||||
|
@ -254,7 +269,7 @@ export class AddonModForumDiscussionsSource extends CoreRoutedItemsManagerSource
|
|||
}
|
||||
}
|
||||
|
||||
return { discussions, canLoadMore: response.canLoadMore };
|
||||
return { discussions, canLoadMore };
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,17 +54,22 @@
|
|||
</ion-card>
|
||||
|
||||
<ng-container *ngIf="forum">
|
||||
<core-empty-box *ngIf="!discussions || !discussions.hasDiscussions" icon="far-comments"
|
||||
[message]="'addon.mod_forum.forumnodiscussionsyet' | translate">
|
||||
</core-empty-box>
|
||||
|
||||
<div *ngIf="discussions?.hasDiscussions && sortingAvailable && selectedSortOrder" class="ion-text-wrap">
|
||||
<div *ngIf="discussions && sortingAvailable && selectedSortOrder" class="ion-text-wrap">
|
||||
<core-combobox [modalOptions]="sortOrderSelectorModalOptions" listboxId="addon-mod-forum-sort-selector"
|
||||
[label]="('core.sort' | translate)" (onChange)="setSortOrder($event)" [selection]="selectedSortOrder.label | translate"
|
||||
interface="modal">
|
||||
</core-combobox>
|
||||
</div>
|
||||
|
||||
<core-empty-box *ngIf="!discussions || (!discussions.hasDiscussions && !errorLoadingDiscussions)" icon="far-comments"
|
||||
[message]="'addon.mod_forum.forumnodiscussionsyet' | translate">
|
||||
</core-empty-box>
|
||||
|
||||
<core-empty-box *ngIf="errorLoadingDiscussions" icon="fas-exclamation-triangle"
|
||||
[message]="'addon.mod_forum.errorloadingsortingorder' | translate">
|
||||
<p>{{ 'addon.mod_forum.errorloadingsortingorderdetails' | translate }}</p>
|
||||
</core-empty-box>
|
||||
|
||||
<ion-item *ngFor="let discussion of discussionsItems" class="addon-mod-forum-discussion" detail="true"
|
||||
[lines]="discussion.groupname && 'none'" [attr.aria-current]="discussions?.getItemAriaCurrent(discussion)"
|
||||
(click)="discussions?.select(discussion)" button>
|
||||
|
|
|
@ -152,6 +152,10 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom
|
|||
return !!(this.forum && this.canAddDiscussion && this.discussions?.getSource().canAddDiscussionToGroup);
|
||||
}
|
||||
|
||||
get errorLoadingDiscussions(): boolean {
|
||||
return !!this.discussions?.getSource().errorLoadingDiscussions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a discussion is online.
|
||||
*
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
"erroremptysubject": "Post subject cannot be empty.",
|
||||
"errorgetforum": "Error getting forum data.",
|
||||
"errorgetgroups": "Error getting group settings.",
|
||||
"errorloadingsortingorder": "Forum not available in this sorting order",
|
||||
"errorloadingsortingorderdetails": "Try changing the sorting order or going online to view this forum.",
|
||||
"errorposttoallgroups": "Could not create new discussion in all groups.",
|
||||
"favourites": "Starred",
|
||||
"favouriteupdated": "Your star option has been updated.",
|
||||
|
|
|
@ -811,13 +811,13 @@ export class AddonModLessonProvider {
|
|||
const matches = studentAnswer.match(new RegExp(expectedAnswer, 'g' + ignoreCase));
|
||||
if (matches) {
|
||||
isMatch = true;
|
||||
const nb = matches[0].length;
|
||||
const nb = matches.length;
|
||||
const original: string[] = [];
|
||||
const marked: string[] = [];
|
||||
|
||||
for (let j = 0; j < nb; j++) {
|
||||
original.push(matches[0][j]);
|
||||
marked.push('<span class="incorrect matches">' + matches[0][j] + '</span>');
|
||||
original.push(matches[j]);
|
||||
marked.push('<span class="incorrect matches">' + matches[j] + '</span>');
|
||||
}
|
||||
|
||||
for (let j = 0; j < original.length; j++) {
|
||||
|
|
Loading…
Reference in New Issue