MOBILE-2726 siteplugins: Let hide menu through Javascript

main
dpalou 2018-11-13 10:02:29 +01:00
parent c50d8bb81d
commit afb07ef97c
4 changed files with 13 additions and 8 deletions

View File

@ -53,9 +53,9 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck {
@ViewChild('dynamicComponent', { read: ViewContainerRef }) container: ViewContainerRef;
loaded: boolean;
componentInstance: any;
protected componentRef: ComponentRef<any>;
protected componentInstance: any;
protected element;
protected differ: any; // To detect changes in the jsData input.

View File

@ -1,11 +1,11 @@
<!-- Buttons to add to the header. -->
<core-navbar-buttons end>
<core-context-menu>
<core-context-menu-item [hidden]="!displayOpenInBrowser || !externalUrl" [priority]="900" [content]="'core.openinbrowser' | translate" [href]="externalUrl" [iconAction]="'open'"></core-context-menu-item>
<core-context-menu-item [hidden]="!displayDescription || !description" [priority]="800" [content]="'core.moduleintro' | translate" (action)="expandDescription()" [iconAction]="'arrow-forward'"></core-context-menu-item>
<core-context-menu-item [hidden]="!displayRefresh" [priority]="700" [content]="'core.refresh' | translate" (action)="doRefresh(null, $event)" [iconAction]="refreshIcon" [closeOnClick]="false"></core-context-menu-item>
<core-context-menu-item [hidden]="!displayPrefetch || !prefetchStatusIcon" [priority]="600" [content]="prefetchText" (action)="prefetch()" [iconAction]="prefetchStatusIcon" [closeOnClick]="false"></core-context-menu-item>
<core-context-menu-item [hidden]="!displaySize || !size" [priority]="500" [content]="size" [iconDescription]="'cube'" (action)="removeFiles()" [iconAction]="'trash'"></core-context-menu-item>
<core-context-menu-item [hidden]="!displayOpenInBrowser || !externalUrl || (content && content.compileComponent && content.compileComponent.componentInstance && content.compileComponent.componentInstance.displayOpenInBrowser === false)" [priority]="900" [content]="'core.openinbrowser' | translate" [href]="externalUrl" [iconAction]="'open'"></core-context-menu-item>
<core-context-menu-item [hidden]="!displayDescription || !description || (content && content.compileComponent && content.compileComponent.componentInstance && content.compileComponent.componentInstance.displayDescription === false)" [priority]="800" [content]="'core.moduleintro' | translate" (action)="expandDescription()" [iconAction]="'arrow-forward'"></core-context-menu-item>
<core-context-menu-item [hidden]="!displayRefresh || (content && content.compileComponent && content.compileComponent.componentInstance && content.compileComponent.componentInstance.displayRefresh === false)" [priority]="700" [content]="'core.refresh' | translate" (action)="doRefresh(null, $event)" [iconAction]="refreshIcon" [closeOnClick]="false"></core-context-menu-item>
<core-context-menu-item [hidden]="!displayPrefetch || !prefetchStatusIcon || (content && content.compileComponent && content.compileComponent.componentInstance && content.compileComponent.componentInstance.displayPrefetch === false)" [priority]="600" [content]="prefetchText" (action)="prefetch()" [iconAction]="prefetchStatusIcon" [closeOnClick]="false"></core-context-menu-item>
<core-context-menu-item [hidden]="!displaySize || !size || (content && content.compileComponent && content.compileComponent.componentInstance && content.compileComponent.componentInstance.displaySize === false)" [priority]="500" [content]="size" [iconDescription]="'cube'" (action)="removeFiles()" [iconAction]="'trash'"></core-context-menu-item>
</core-context-menu>
</core-navbar-buttons>

View File

@ -1,3 +1,3 @@
<core-loading [hideUntil]="dataLoaded">
<core-compile-html [text]="content" [javascript]="javascript" [jsData]="jsData" [forceCompile]="forceCompile"></core-compile-html>
<core-compile-html [text]="content" [javascript]="javascript" [jsData]="jsData" [forceCompile]="forceCompile" #compile></core-compile-html>
</core-loading>

View File

@ -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;