From 481110e5d22452c2ff7a719424293e5daaaea46b Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 8 Nov 2019 08:32:11 +0100 Subject: [PATCH] MOBILE-3211 siteplugins: Use current page title if not defined --- .../components/module-index/core-siteplugins-module-index.html | 2 +- src/core/siteplugins/components/module-index/module-index.ts | 1 + .../siteplugins/components/plugin-content/plugin-content.ts | 1 + src/core/siteplugins/directives/call-ws-new-content.ts | 2 +- src/core/siteplugins/directives/new-content.ts | 2 +- src/core/siteplugins/pages/module-index/module-index.html | 2 +- src/core/siteplugins/pages/plugin-page/plugin-page.html | 2 +- 7 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/siteplugins/components/module-index/core-siteplugins-module-index.html b/src/core/siteplugins/components/module-index/core-siteplugins-module-index.html index 12b83b5e0..aa12f7959 100644 --- a/src/core/siteplugins/components/module-index/core-siteplugins-module-index.html +++ b/src/core/siteplugins/components/module-index/core-siteplugins-module-index.html @@ -9,4 +9,4 @@ - + diff --git a/src/core/siteplugins/components/module-index/module-index.ts b/src/core/siteplugins/components/module-index/module-index.ts index a9f9dfeed..586bd5203 100644 --- a/src/core/siteplugins/components/module-index/module-index.ts +++ b/src/core/siteplugins/components/module-index/module-index.ts @@ -32,6 +32,7 @@ import { CoreSitePluginsPluginContentComponent } from '../plugin-content/plugin- export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, CoreCourseModuleMainComponent { @Input() module: any; // The module. @Input() courseId: number; // Course ID the module belongs to. + @Input() pageTitle: string; // Current page title. It can be used by the "new-content" directives. @ViewChild(CoreSitePluginsPluginContentComponent) content: CoreSitePluginsPluginContentComponent; diff --git a/src/core/siteplugins/components/plugin-content/plugin-content.ts b/src/core/siteplugins/components/plugin-content/plugin-content.ts index 57598e495..aebf88e59 100644 --- a/src/core/siteplugins/components/plugin-content/plugin-content.ts +++ b/src/core/siteplugins/components/plugin-content/plugin-content.ts @@ -37,6 +37,7 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck { @Input() initResult: any; // Result of the init WS call of the handler. @Input() data: any; // Data to pass to the component. @Input() preSets: any; // The preSets for the WS call. + @Input() pageTitle: string; // Current page title. It can be used by the "new-content" directives. @Output() onContentLoaded?: EventEmitter; // Emits an event when the content is loaded. @Output() onLoadingContent?: EventEmitter; // Emits an event when starts to load the content. diff --git a/src/core/siteplugins/directives/call-ws-new-content.ts b/src/core/siteplugins/directives/call-ws-new-content.ts index 8bc307951..fc65d5573 100644 --- a/src/core/siteplugins/directives/call-ws-new-content.ts +++ b/src/core/siteplugins/directives/call-ws-new-content.ts @@ -96,7 +96,7 @@ export class CoreSitePluginsCallWSNewContentDirective extends CoreSitePluginsCal } this.navCtrl.push('CoreSitePluginsPluginPage', { - title: this.title, + title: this.title || (this.parentContent && this.parentContent.pageTitle), component: this.component || (this.parentContent && this.parentContent.component), method: this.method || (this.parentContent && this.parentContent.method), args: args, diff --git a/src/core/siteplugins/directives/new-content.ts b/src/core/siteplugins/directives/new-content.ts index 7981e49a0..d95b34bae 100644 --- a/src/core/siteplugins/directives/new-content.ts +++ b/src/core/siteplugins/directives/new-content.ts @@ -93,7 +93,7 @@ export class CoreSitePluginsNewContentDirective implements OnInit { } this.navCtrl.push('CoreSitePluginsPluginPage', { - title: this.title, + title: this.title || (this.parentContent && this.parentContent.pageTitle), component: this.component || (this.parentContent && this.parentContent.component), method: this.method || (this.parentContent && this.parentContent.method), args: args, diff --git a/src/core/siteplugins/pages/module-index/module-index.html b/src/core/siteplugins/pages/module-index/module-index.html index 99b109494..8d83a46b7 100644 --- a/src/core/siteplugins/pages/module-index/module-index.html +++ b/src/core/siteplugins/pages/module-index/module-index.html @@ -11,5 +11,5 @@ - + diff --git a/src/core/siteplugins/pages/plugin-page/plugin-page.html b/src/core/siteplugins/pages/plugin-page/plugin-page.html index bb0676458..be1566304 100644 --- a/src/core/siteplugins/pages/plugin-page/plugin-page.html +++ b/src/core/siteplugins/pages/plugin-page/plugin-page.html @@ -11,5 +11,5 @@ - +