Merge pull request #2300 from dpalou/MOBILE-3348

MOBILE-3348 glossary: Filter concepts and fix divider with HTML
main
Juan Leyva 2020-03-05 13:17:17 +01:00 committed by GitHub
commit b7ffc0042f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -41,7 +41,7 @@
{{ 'addon.mod_glossary.entriestobesynced' | translate }} {{ 'addon.mod_glossary.entriestobesynced' | translate }}
</ion-item-divider> </ion-item-divider>
<a ion-item *ngFor="let entry of offlineEntries" (click)="openNewEntry(entry)" detail-none> <a ion-item *ngFor="let entry of offlineEntries" (click)="openNewEntry(entry)" detail-none>
<p>{{entry.concept}}</p> <p><core-format-text [text]="entry.concept" contextLevel="module" [contextInstanceId]="glossary.coursemodule" [courseId]="courseId"></core-format-text></p>
</a> </a>
</ion-list> </ion-list>
@ -53,7 +53,7 @@
</ion-item-divider> </ion-item-divider>
<a ion-item (click)="openEntry(entry.id)" [class.core-split-item-selected]="entry.id == selectedEntry" detail-none> <a ion-item (click)="openEntry(entry.id)" [class.core-split-item-selected]="entry.id == selectedEntry" detail-none>
<p>{{entry.concept}}</p> <p><core-format-text [text]="entry.concept" contextLevel="module" [contextInstanceId]="glossary.coursemodule" [courseId]="courseId"></core-format-text></p>
</a> </a>
</ng-container> </ng-container>
</ion-list> </ion-list>

View File

@ -320,7 +320,12 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity
this.fetchFunction = this.glossaryProvider.getEntriesByLetter; this.fetchFunction = this.glossaryProvider.getEntriesByLetter;
this.fetchInvalidate = this.glossaryProvider.invalidateEntriesByLetter; this.fetchInvalidate = this.glossaryProvider.invalidateEntriesByLetter;
this.fetchArguments = [this.glossary.id, 'ALL']; this.fetchArguments = [this.glossary.id, 'ALL'];
this.getDivider = (entry: any): string => entry.concept.substr(0, 1).toUpperCase(); this.getDivider = (entry: any): string => {
// Try to get the first letter without HTML tags.
const noTags = this.textUtils.cleanTags(entry.concept);
return (noTags || entry.concept).substr(0, 1).toUpperCase();
};
this.showDivider = (entry?: any, previous?: any): boolean => { this.showDivider = (entry?: any, previous?: any): boolean => {
return !previous || this.getDivider(entry) != this.getDivider(previous); return !previous || this.getDivider(entry) != this.getDivider(previous);
}; };