MOBILE-2344 links: Fix link handlers constructors

main
Dani Palou 2018-01-31 10:12:11 +01:00
parent b1a2a46217
commit f2a5bc0eb6
2 changed files with 20 additions and 28 deletions

View File

@ -24,31 +24,28 @@ import { CoreCourseHelperProvider } from '../../course/providers/helper';
*/ */
export class CoreContentLinksModuleGradeHandler extends CoreContentLinksHandlerBase { export class CoreContentLinksModuleGradeHandler extends CoreContentLinksHandlerBase {
/**
* Name of the addon as it's registered in course delegate. It'll be used to check if it's disabled.
* @type {string}
*/
addon: string;
/**
* Name of the module (assign, book, ...).
* @type {string}
*/
modName: string;
/** /**
* Whether the module can be reviewed in the app. If true, the handler needs to implement the goToReview function. * Whether the module can be reviewed in the app. If true, the handler needs to implement the goToReview function.
* @type {boolean} * @type {boolean}
*/ */
canReview: boolean; canReview: boolean;
/**
* Construct the handler.
*
* @param {CoreCourseHelperProvider} courseHelper The CoreCourseHelperProvider instance.
* @param {CoreDomUtilsProvider} domUtils The CoreDomUtilsProvider instance.
* @param {CoreSitesProvider} sitesProvider The CoreSitesProvider instance.
* @param {string} addon Name of the addon as it's registered in course delegate. It'll be used to check if it's disabled.
* @param {string} modName Name of the module (assign, book, ...).
*/
constructor(protected courseHelper: CoreCourseHelperProvider, protected domUtils: CoreDomUtilsProvider, constructor(protected courseHelper: CoreCourseHelperProvider, protected domUtils: CoreDomUtilsProvider,
protected sitesProvider: CoreSitesProvider) { protected sitesProvider: CoreSitesProvider, public addon: string, public modName: string) {
super(); super();
// Match the grade.php URL with an id param. // Match the grade.php URL with an id param.
this.pattern = new RegExp('\/mod\/' + this.modName + '\/grade\.php.*([\&\?]id=\\d+)'); this.pattern = new RegExp('\/mod\/' + modName + '\/grade\.php.*([\&\?]id=\\d+)');
this.featureName = '$mmCourseDelegate_' + this.addon; this.featureName = '$mmCourseDelegate_' + addon;
} }
/** /**

View File

@ -22,23 +22,18 @@ import { CoreCourseHelperProvider } from '../../course/providers/helper';
export class CoreContentLinksModuleIndexHandler extends CoreContentLinksHandlerBase { export class CoreContentLinksModuleIndexHandler extends CoreContentLinksHandlerBase {
/** /**
* Name of the addon as it's registered in course delegate. It'll be used to check if it's disabled. * Construct the handler.
* @type {string} *
* @param {CoreCourseHelperProvider} courseHelper The CoreCourseHelperProvider instance.
* @param {string} addon Name of the addon as it's registered in course delegate. It'll be used to check if it's disabled.
* @param {string} modName Name of the module (assign, book, ...).
*/ */
addon: string; constructor(protected courseHelper: CoreCourseHelperProvider, public addon: string, public modName: string) {
/**
* Name of the module (assign, book, ...).
* @type {string}
*/
modName: string;
constructor(private courseHelper: CoreCourseHelperProvider) {
super(); super();
// Match the view.php URL with an id param. // Match the view.php URL with an id param.
this.pattern = new RegExp('\/mod\/' + this.modName + '\/view\.php.*([\&\?]id=\\d+)'); this.pattern = new RegExp('\/mod\/' + modName + '\/view\.php.*([\&\?]id=\\d+)');
this.featureName = '$mmCourseDelegate_' + this.addon; this.featureName = '$mmCourseDelegate_' + addon;
} }
/** /**