MOBILE-3188 siteplugins: Pass componentId using preSets
parent
838e611dab
commit
16b7f8b696
|
@ -9,4 +9,4 @@
|
|||
</core-context-menu>
|
||||
</core-navbar-buttons>
|
||||
|
||||
<core-site-plugins-plugin-content *ngIf="component && method" [component]="component" [componentId]="componentId" [method]="method" [args]="args" [initResult]="initResult" [data]="jsData" [pageTitle]="pageTitle" (onContentLoaded)="contentLoaded($event)" (onLoadingContent)="contentLoading($event)"></core-site-plugins-plugin-content>
|
||||
<core-site-plugins-plugin-content *ngIf="component && method" [component]="component" [method]="method" [args]="args" [initResult]="initResult" [data]="jsData" [pageTitle]="pageTitle" [preSets]="preSets" (onContentLoaded)="contentLoaded($event)" (onLoadingContent)="contentLoading($event)"></core-site-plugins-plugin-content>
|
||||
|
|
|
@ -21,6 +21,7 @@ import { CoreCourseModuleDelegate, CoreCourseModuleMainComponent } from '@core/c
|
|||
import { CoreCourseModulePrefetchDelegate } from '@core/course/providers/module-prefetch-delegate';
|
||||
import { CoreCourseHelperProvider } from '@core/course/providers/helper';
|
||||
import { CoreSitePluginsPluginContentComponent } from '../plugin-content/plugin-content';
|
||||
import { CoreSiteWSPreSets } from '@classes/site';
|
||||
|
||||
/**
|
||||
* Component that displays the index of a module site plugin.
|
||||
|
@ -37,10 +38,10 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C
|
|||
@ViewChild(CoreSitePluginsPluginContentComponent) content: CoreSitePluginsPluginContentComponent;
|
||||
|
||||
component: string;
|
||||
componentId: number;
|
||||
method: string;
|
||||
args: any;
|
||||
initResult: any;
|
||||
preSets: CoreSiteWSPreSets;
|
||||
|
||||
// Data for context menu.
|
||||
externalUrl: string;
|
||||
|
@ -78,7 +79,7 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C
|
|||
|
||||
if (handler) {
|
||||
this.component = handler.plugin.component;
|
||||
this.componentId = this.module.id;
|
||||
this.preSets = {componentId: this.module.id};
|
||||
this.method = handler.handlerSchema.method;
|
||||
this.args = {
|
||||
courseid: this.courseId,
|
||||
|
|
|
@ -32,7 +32,6 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
|
|||
@ViewChild('compile') compileComponent: ElementRef;
|
||||
|
||||
@Input() component: string;
|
||||
@Input() componentId?: number;
|
||||
@Input() method: string;
|
||||
@Input() args: any;
|
||||
@Input() initResult: any; // Result of the init WS call of the handler.
|
||||
|
@ -94,10 +93,7 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
|
|||
this.forceCompile = false;
|
||||
|
||||
const preSets = Object.assign({}, this.preSets);
|
||||
preSets.component = this.component;
|
||||
if (this.componentId) {
|
||||
preSets.componentId = this.componentId;
|
||||
}
|
||||
preSets.component = preSets.component || this.component;
|
||||
|
||||
return this.sitePluginsProvider.getContent(this.component, this.method, this.args, preSets).then((result) => {
|
||||
this.content = result.templates.length ? result.templates[0].html : ''; // Load first template.
|
||||
|
|
Loading…
Reference in New Issue