From c50d8bb81d0fd2a8f48304648230702928e2480f Mon Sep 17 00:00:00 2001 From: dpalou Date: Tue, 13 Nov 2018 08:16:38 +0100 Subject: [PATCH 1/2] MOBILE-2726 siteplugins: Let modules hide default menu options --- .../core-siteplugins-module-index.html | 10 +++++----- .../components/module-index/module-index.ts | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 6 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 3c57c372f..9e567b4fa 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 @@ -1,11 +1,11 @@ - - - - - + + + + + diff --git a/src/core/siteplugins/components/module-index/module-index.ts b/src/core/siteplugins/components/module-index/module-index.ts index 5c2e034e5..f24cc0685 100644 --- a/src/core/siteplugins/components/module-index/module-index.ts +++ b/src/core/siteplugins/components/module-index/module-index.ts @@ -15,6 +15,7 @@ import { Component, OnInit, OnDestroy, Input, ViewChild } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { CoreTextUtilsProvider } from '@providers/utils/text'; +import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreSitePluginsProvider } from '../../providers/siteplugins'; import { CoreCourseModuleMainComponent } from '@core/course/providers/module-delegate'; import { CoreCourseModulePrefetchDelegate } from '@core/course/providers/module-prefetch-delegate'; @@ -46,6 +47,12 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C prefetchStatusIcon: string; prefetchText: string; size: string; + displayOpenInBrowser = true; + displayDescription = true; + displayRefresh = true; + displayPrefetch = true; + displaySize = true; + jsData: any; // Data to pass to the component. protected isDestroyed = false; @@ -53,7 +60,7 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C constructor(protected sitePluginsProvider: CoreSitePluginsProvider, protected courseHelper: CoreCourseHelperProvider, protected prefetchDelegate: CoreCourseModulePrefetchDelegate, protected textUtils: CoreTextUtilsProvider, - protected translate: TranslateService) { } + protected translate: TranslateService, protected utils: CoreUtilsProvider) { } /** * Component being initialized. @@ -75,6 +82,12 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C module: this.module, courseId: this.courseId }; + + this.displayOpenInBrowser = !this.utils.isFalseOrZero(handler.handlerSchema.displayopeninbrowser); + this.displayDescription = !this.utils.isFalseOrZero(handler.handlerSchema.displaydescription); + this.displayRefresh = !this.utils.isFalseOrZero(handler.handlerSchema.displayrefresh); + this.displayPrefetch = !this.utils.isFalseOrZero(handler.handlerSchema.displayprefetch); + this.displaySize = !this.utils.isFalseOrZero(handler.handlerSchema.displaysize); } // Get the data for the context menu. From afb07ef97c1fab6e25fc4e23c8f9ba27a602cb6d Mon Sep 17 00:00:00 2001 From: dpalou Date: Tue, 13 Nov 2018 10:02:29 +0100 Subject: [PATCH 2/2] MOBILE-2726 siteplugins: Let hide menu through Javascript --- .../compile/components/compile-html/compile-html.ts | 2 +- .../module-index/core-siteplugins-module-index.html | 10 +++++----- .../core-siteplugins-plugin-content.html | 2 +- .../components/plugin-content/plugin-content.ts | 7 ++++++- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/core/compile/components/compile-html/compile-html.ts b/src/core/compile/components/compile-html/compile-html.ts index 0fafec013..3a843fc91 100644 --- a/src/core/compile/components/compile-html/compile-html.ts +++ b/src/core/compile/components/compile-html/compile-html.ts @@ -53,9 +53,9 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck { @ViewChild('dynamicComponent', { read: ViewContainerRef }) container: ViewContainerRef; loaded: boolean; + componentInstance: any; protected componentRef: ComponentRef; - protected componentInstance: any; protected element; protected differ: any; // To detect changes in the jsData input. 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 9e567b4fa..12b83b5e0 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 @@ -1,11 +1,11 @@ - - - - - + + + + + diff --git a/src/core/siteplugins/components/plugin-content/core-siteplugins-plugin-content.html b/src/core/siteplugins/components/plugin-content/core-siteplugins-plugin-content.html index 7088f7a30..c306b73a7 100644 --- a/src/core/siteplugins/components/plugin-content/core-siteplugins-plugin-content.html +++ b/src/core/siteplugins/components/plugin-content/core-siteplugins-plugin-content.html @@ -1,3 +1,3 @@ - + diff --git a/src/core/siteplugins/components/plugin-content/plugin-content.ts b/src/core/siteplugins/components/plugin-content/plugin-content.ts index 6ddaf6315..e1fa41f17 100644 --- a/src/core/siteplugins/components/plugin-content/plugin-content.ts +++ b/src/core/siteplugins/components/plugin-content/plugin-content.ts @@ -12,7 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, OnInit, Input, Output, EventEmitter, Optional, DoCheck, KeyValueDiffers } from '@angular/core'; +import { + Component, OnInit, Input, Output, EventEmitter, Optional, DoCheck, KeyValueDiffers, ViewChild, ElementRef +} from '@angular/core'; import { NavController } from 'ionic-angular'; import { CoreDomUtilsProvider } from '@providers/utils/dom'; import { CoreSitePluginsProvider } from '../../providers/siteplugins'; @@ -26,6 +28,9 @@ import { Subject } from 'rxjs'; templateUrl: 'core-siteplugins-plugin-content.html', }) export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck { + // Get the compile element. Don't set the right type to prevent circular dependencies. + @ViewChild('compile') compileComponent: ElementRef; + @Input() component: string; @Input() method: string; @Input() args: any;