MOBILE-2342 glossary: PR fixes
parent
5f6fabc531
commit
2fc339a055
|
@ -229,7 +229,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity
|
|||
this.fetchArguments = [this.glossary.id, 'ALL', 'LASTNAME', 'ASC'];
|
||||
this.getDivider = (entry: any): string => entry.userfullname;
|
||||
this.showDivider = (entry: any, previous?: any): boolean => {
|
||||
return previous === 'undefined' || entry.userid != previous.userid;
|
||||
return typeof previous === 'undefined' || entry.userid != previous.userid;
|
||||
};
|
||||
break;
|
||||
case 'cat_all':
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
<ion-header>
|
||||
<ion-navbar>
|
||||
<ion-title *ngIf="entry"><core-format-text [text]="entry.concept"></core-format-text></ion-title>
|
||||
<ion-buttons end>
|
||||
<!-- The context menu will be added in here. -->
|
||||
</ion-buttons>
|
||||
</ion-navbar>
|
||||
</ion-header>
|
||||
<ion-content>
|
||||
|
|
|
@ -609,7 +609,7 @@ export class AddonModGlossaryProvider {
|
|||
|
||||
/**
|
||||
* Invalidate the prefetched content for a given glossary, except files.
|
||||
* To invalidate files, use $mmaModGlossary#invalidateFiles.
|
||||
* To invalidate files, use AddonModGlossaryProvider#invalidateFiles.
|
||||
*
|
||||
* @param {any} glossary The glossary object.
|
||||
* @param {boolean} [onlyEntriesList] If true, entries won't be invalidated.
|
||||
|
@ -705,7 +705,8 @@ export class AddonModGlossaryProvider {
|
|||
* @param {string} definition Glossary entry concept definition.
|
||||
* @param {number} courseId Course ID of the glossary.
|
||||
* @param {any} [options] Array of options for the entry.
|
||||
* @param {any} [attach] Attachments ID if sending online, result of $mmFileUploader#storeFilesToUpload otherwise.
|
||||
* @param {any} [attach] Attachments ID if sending online, result of CoreFileUploaderProvider#storeFilesToUpload
|
||||
* otherwise.
|
||||
* @param {number} [timeCreated] The time the entry was created. If not defined, current time.
|
||||
* @param {string} [siteId] Site ID. If not defined, current site.
|
||||
* @param {any} [discardEntry] The entry provided will be discarded if found.
|
||||
|
|
|
@ -39,7 +39,7 @@ export class AddonModGlossaryHelperProvider {
|
|||
*/
|
||||
deleteStoredFiles(glossaryId: number, entryName: string, timeCreated: number, siteId?: string): Promise<any> {
|
||||
return this.glossaryOffline.getEntryFolder(glossaryId, entryName, timeCreated, siteId).then((folderPath) => {
|
||||
this.fileProvider.removeDir(folderPath).catch(() => {
|
||||
return this.fileProvider.removeDir(folderPath).catch(() => {
|
||||
// Ignore any errors, CoreFileProvider.removeDir fails if folder doesn't exists.
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,7 +16,6 @@ import { Injectable, Injector } from '@angular/core';
|
|||
import { CoreCourseModulePrefetchHandlerBase } from '@core/course/classes/module-prefetch-handler';
|
||||
import { CoreUserProvider } from '@core/user/providers/user';
|
||||
import { AddonModGlossaryProvider } from './glossary';
|
||||
import { CoreConstants } from '@core/constants';
|
||||
|
||||
/**
|
||||
* Handler to prefetch forums.
|
||||
|
@ -34,25 +33,6 @@ export class AddonModGlossaryPrefetchHandler extends CoreCourseModulePrefetchHan
|
|||
super(injector);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the status to show based on current status. E.g. a module might want to show outdated instead of downloaded.
|
||||
* If not implemented, the original status will be returned.
|
||||
*
|
||||
* @param {any} module Module.
|
||||
* @param {string} status The current status.
|
||||
* @param {boolean} canCheck Whether the site allows checking for updates.
|
||||
* @return {string} Status to display.
|
||||
*/
|
||||
determineStatus(module: any, status: string, canCheck: boolean): string {
|
||||
if (!canCheck && status === CoreConstants.DOWNLOADED) {
|
||||
/* Glossary are always marked as outdated if updates cannot be checked because we can't tell if there's something
|
||||
new without having to call all the WebServices. */
|
||||
return CoreConstants.OUTDATED;
|
||||
} else {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the module.
|
||||
*
|
||||
|
|
|
@ -49,7 +49,7 @@ export class AddonModGlossarySyncProvider extends CoreSyncBaseProvider {
|
|||
textUtils: CoreTextUtilsProvider,
|
||||
private uploaderProvider: CoreFileUploaderProvider,
|
||||
private utils: CoreUtilsProvider,
|
||||
private glossaruProvider: AddonModGlossaryProvider,
|
||||
private glossaryProvider: AddonModGlossaryProvider,
|
||||
private glossaryHelper: AddonModGlossaryHelperProvider,
|
||||
private glossaryOffline: AddonModGlossaryOfflineProvider) {
|
||||
|
||||
|
@ -181,7 +181,7 @@ export class AddonModGlossarySyncProvider extends CoreSyncBaseProvider {
|
|||
// First of all upload the attachments (if any).
|
||||
promise = this.uploadAttachments(glossaryId, data, siteId).then((itemId) => {
|
||||
// Now try to add the entry.
|
||||
return this.glossaruProvider.addEntryOnline(
|
||||
return this.glossaryProvider.addEntryOnline(
|
||||
glossaryId, data.concept, data.definition, data.options, itemId, siteId);
|
||||
});
|
||||
|
||||
|
@ -213,8 +213,8 @@ export class AddonModGlossarySyncProvider extends CoreSyncBaseProvider {
|
|||
}).then(() => {
|
||||
if (result.updated && courseId) {
|
||||
// Data has been sent to server. Now invalidate the WS calls.
|
||||
return this.glossaruProvider.getGlossaryById(courseId, glossaryId).then((glossary) => {
|
||||
return this.glossaruProvider.invalidateGlossaryEntries(glossary, true);
|
||||
return this.glossaryProvider.getGlossaryById(courseId, glossaryId).then((glossary) => {
|
||||
return this.glossaryProvider.invalidateGlossaryEntries(glossary, true);
|
||||
}).catch(() => {
|
||||
// Ignore errors.
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue