commit
7c265ae769
|
@ -47,6 +47,9 @@ export class AddonBlockCalendarMonthHandlerService extends CoreBlockBaseHandler
|
|||
component: CoreBlockOnlyTitleComponent,
|
||||
link: AddonCalendar.getMainCalendarPagePath(),
|
||||
linkParams: linkParams,
|
||||
navOptions: {
|
||||
preferCurrentTab: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,9 @@ export class AddonBlockCalendarUpcomingHandlerService extends CoreBlockBaseHandl
|
|||
component: CoreBlockOnlyTitleComponent,
|
||||
link: AddonCalendar.getMainCalendarPagePath(),
|
||||
linkParams: linkParams,
|
||||
navOptions: {
|
||||
preferCurrentTab: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,9 @@ export class AddonBlockLearningPlansHandlerService extends CoreBlockBaseHandler
|
|||
class: 'addon-block-learning-plans',
|
||||
component: CoreBlockOnlyTitleComponent,
|
||||
link: AddonCompetencyMainMenuHandlerService.PAGE_NAME,
|
||||
navOptions: {
|
||||
preferCurrentTab: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,11 @@ export class AddonBlockPrivateFilesHandlerService extends CoreBlockBaseHandler {
|
|||
title: 'addon.block_privatefiles.pluginname',
|
||||
class: 'addon-block-private-files',
|
||||
component: CoreBlockOnlyTitleComponent,
|
||||
link: '/main/' + AddonPrivateFilesMainMenuHandlerService.PAGE_NAME,
|
||||
link: AddonPrivateFilesMainMenuHandlerService.PAGE_NAME,
|
||||
linkParams: { root: 'my' },
|
||||
navOptions: {
|
||||
preferCurrentTab: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import { CoreCourseBlock } from '../../course/services/course';
|
|||
import { IonRefresher } from '@ionic/angular';
|
||||
import { Params } from '@angular/router';
|
||||
import { ContextLevel } from '@/core/constants';
|
||||
import { CoreNavigationOptions } from '@services/navigator';
|
||||
|
||||
/**
|
||||
* Template class to easily create components for blocks.
|
||||
|
@ -36,6 +37,7 @@ export abstract class CoreBlockBaseComponent implements OnInit {
|
|||
@Input() instanceId!: number; // The instance ID associated with the context level.
|
||||
@Input() link?: string; // Link to go when clicked.
|
||||
@Input() linkParams?: Params; // Link params to go when clicked.
|
||||
@Input() navOptions?: CoreNavigationOptions; // Navigation options.
|
||||
|
||||
loaded = false; // If the component has been loaded.
|
||||
protected fetchContentDefaultError = ''; // Default error to show when loading contents.
|
||||
|
|
|
@ -115,6 +115,7 @@ export class CoreBlockComponent implements OnInit, OnDestroy, DoCheck {
|
|||
instanceId: this.instanceId,
|
||||
link: data.link || null,
|
||||
linkParams: data.linkParams || null,
|
||||
navOptions: data.navOptions || null,
|
||||
}, this.extraData || {}, data.componentData || {});
|
||||
} catch {
|
||||
// Ignore errors.
|
||||
|
|
|
@ -43,7 +43,12 @@ export class CoreBlockOnlyTitleComponent extends CoreBlockBaseComponent implemen
|
|||
* Go to the block page.
|
||||
*/
|
||||
gotoBlock(): void {
|
||||
CoreNavigator.navigateToSitePath(this.link!, { params: this.linkParams });
|
||||
const navOptions = this.navOptions || {};
|
||||
if (this.linkParams) {
|
||||
navOptions.params = this.linkParams;
|
||||
}
|
||||
|
||||
CoreNavigator.navigateToSitePath(this.link!, navOptions);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import { CoreCourseBlock } from '@features/course/services/course';
|
|||
import { Params } from '@angular/router';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { CoreBlockDefaultHandler } from './handlers/default-block';
|
||||
import { CoreNavigationOptions } from '@services/navigator';
|
||||
|
||||
/**
|
||||
* Interface that all blocks must implement.
|
||||
|
@ -80,6 +81,11 @@ export interface CoreBlockHandlerData {
|
|||
* Params of the link.
|
||||
*/
|
||||
linkParams?: Params;
|
||||
|
||||
/**
|
||||
* Navigation options.
|
||||
*/
|
||||
navOptions?: CoreNavigationOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -735,7 +735,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate<CoreCo
|
|||
return;
|
||||
}
|
||||
|
||||
result.status = CoreFilepool.determinePackagesStatus(status, modStatus);
|
||||
result.status = CoreFilepool.determinePackagesStatus(result.status, modStatus);
|
||||
result[modStatus].push(module);
|
||||
result.total++;
|
||||
} catch (error) {
|
||||
|
@ -749,7 +749,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate<CoreCo
|
|||
return;
|
||||
}
|
||||
|
||||
result.status = CoreFilepool.determinePackagesStatus(status, cacheStatus);
|
||||
result.status = CoreFilepool.determinePackagesStatus(result.status, cacheStatus);
|
||||
result[cacheStatus].push(module);
|
||||
result.total++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue