223 lines
12 KiB
HTML
223 lines
12 KiB
HTML
<div page-content>
|
|
<div header>
|
|
<div class="uk-section-xsmall uk-margin-top">
|
|
<div class="uk-flex-middle uk-grid" uk-grid>
|
|
<ng-container *ngIf="editView ">
|
|
<div class="uk-width-expand">
|
|
<a (click)="editView = false; selectedTemplate = null; selectedPlugin = null;" class="uk-flex uk-flex-middle uk-h5 uk-link-reset">
|
|
<span class="uk-margin-right">
|
|
<icon name="west" ratio="1.7" [flex]="true"></icon>
|
|
</span>
|
|
<h1 *ngIf="page" class="uk-h5 uk-margin-remove">{{page.name}} - {{selectedPlugin ? 'Update ' : 'Add new '}} plugin
|
|
<span *ngIf=" templateForm && templateForm.dirty" class="uk-text-large"> (unsaved changes)</span>
|
|
</h1>
|
|
</a>
|
|
</div>
|
|
<div *ngIf="templateForm" class="uk-width-auto">
|
|
<button class="uk-button uk-button-default uk-margin-right"
|
|
(click)="reset()" [class.uk-disabled]="!templateForm.dirty"
|
|
[disabled]="!templateForm.dirty || showLoading">Reset
|
|
</button>
|
|
<button class="uk-button uk-button-primary" [class.uk-disabled]="templateForm.invalid || !templateForm.dirty || templateForm.disabled"
|
|
(click)="saveConfirmed()" [disabled]="templateForm.invalid ||!templateForm.dirty || templateForm.disabled || showLoading">Save
|
|
</button>
|
|
</div>
|
|
</ng-container>
|
|
<ng-container *ngIf="!editView">
|
|
<div *ngIf="!templateView" class="uk-width-expand">
|
|
<a routerLink="../pages" class="uk-flex uk-flex-middle uk-h5 uk-link-reset">
|
|
<span class="uk-margin-right">
|
|
<icon name="west" ratio="1.7" [flex]="true"></icon>
|
|
</span>
|
|
<h1 *ngIf="page" class="uk-h5 uk-margin-remove">{{page.name}}</h1>
|
|
</a>
|
|
</div>
|
|
<div *ngIf="templateView" class="uk-width-expand">
|
|
<a routerLink="../.." class="uk-flex uk-flex-middle uk-h5 uk-link-reset">
|
|
<span class="uk-margin-right">
|
|
<icon name="west" ratio="1.7" [flex]="true"></icon>
|
|
</span>
|
|
<h1 *ngIf="template" class="uk-h5 uk-margin-remove">{{template.name}}</h1>
|
|
</a>
|
|
</div>
|
|
<div search-input [disabled]="showLoading" [expandable]="true" [searchControl]="filterForm.get('keyword')" searchInputClass="outer" placeholder="Search plugins" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1">
|
|
</div>
|
|
<div>
|
|
<button (click)="newPluginSelectTemplate()" [disabled]="showLoading" [class.uk-disabled]="showLoading || this.pluginTemplates.length ==0"
|
|
class="uk-flex uk-flex-middle uk-button uk-button-default" >
|
|
<icon [flex]="true" name="add"></icon>
|
|
<span class="uk-margin-small-left">Add new plugin</span>
|
|
</button>
|
|
</div>
|
|
</ng-container>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div inner>
|
|
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
|
|
|
|
<div *ngIf="showLoading" class="uk-position-center">
|
|
<loading></loading>
|
|
</div>
|
|
<ng-container *ngIf="!showLoading && !editView">
|
|
<div *ngIf="checkboxes.length == 0"
|
|
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
|
<div>No plugins found</div>
|
|
</div>
|
|
<div *ngIf="checkboxes.length > 0" class="uk-grid uk-child-width-1-1" uk-height-match=".uk-card-body" uk-grid>
|
|
<div *ngFor="let check of checkboxes; let i=index">
|
|
<div class="uk-card uk-card-default">
|
|
<div class="uk-card-body uk-flex">
|
|
<div class="uk-width-expand uk-text-small">
|
|
<ng-container *ngIf="check.template && !templateView">
|
|
<h6>{{check.template.name}}</h6>
|
|
<div class="uk-margin-small-bottom">
|
|
{{check.template.description}}
|
|
</div>
|
|
</ng-container>
|
|
<ng-container *ngIf="templateView">
|
|
<h6>Community: {{check.plugin.pid}}</h6>
|
|
</ng-container>
|
|
<ng-container *ngIf="!check.template">
|
|
<h6>{{check.plugin.code}}</h6>
|
|
<div class="uk-margin-small-bottom uk-text-warning">
|
|
Plugin is not supported anymore!
|
|
</div>
|
|
</ng-container>
|
|
<div class="uk-margin-small-bottom">
|
|
<span class="uk-text-meta">Placement: </span>{{check.plugin.placement}}
|
|
</div>
|
|
<div *ngFor="let key of getKeys(check.template.attributes)">
|
|
<div *ngIf="check.template.attributes[key]['type'] =='HTML' ">
|
|
{{check.template.attributes[key]['name']}}:
|
|
<div [innerHTML]="check.plugin.values[key]"></div>
|
|
</div>
|
|
<div *ngIf="check.template.attributes[key]['type'] =='text' ">
|
|
{{check.template.attributes[key]['name']}}:
|
|
<div >{{check.plugin.values[key]}}</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="uk-card-footer uk-padding-remove-vertical">
|
|
<div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid>
|
|
|
|
|
|
<div>
|
|
<div class="uk-padding-small uk-padding-remove-horizontal">
|
|
<button
|
|
class="uk-button uk-button-link uk-flex uk-flex-middle" (click)="edit(check.plugin, check.template)" [class.uk-disabled]="!check.template">
|
|
<icon name="edit" [flex]="true"></icon>
|
|
<span class="uk-margin-xsmall-left"> Edit</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="uk-padding-small uk-padding-remove-horizontal">
|
|
<button class="uk-button uk-button-link uk-flex uk-flex-middle"
|
|
(click)="confirmDelete(check.plugin._id)">
|
|
<icon name="delete" [flex]="true"></icon>
|
|
<span class="uk-margin-xsmall-left"> Delete</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="uk-padding-small uk-padding-remove-horizontal">
|
|
<mat-slide-toggle [checked]="check.plugin.active"
|
|
(change)="($event.source.checked = check.plugin.active);togglePlugin(!check.plugin.active,check.plugin._id)"
|
|
>
|
|
<span class="uk-text-small">Enable</span>
|
|
</mat-slide-toggle>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</ng-container>
|
|
<ng-container *ngIf="editView">
|
|
|
|
<div *ngIf="selectTemplateView">
|
|
<div> Select a Template for your plugin. </div>
|
|
<div *ngIf="pluginTemplates.length > 0" class="uk-grid uk-child-width-1-1" uk-height-match=".uk-card-body" uk-grid>
|
|
<div *ngFor="let template of pluginTemplates; let i=index">
|
|
<div class="uk-card uk-card-default">
|
|
<div class="uk-card-body uk-flex">
|
|
<div class="uk-width-expand uk-text-small">
|
|
<h6>{{template.name}}</h6>
|
|
<div class="uk-margin-small-bottom">
|
|
<span class="uk-text-meta">Placements: </span>{{template.placements.join(", ")}}
|
|
</div>
|
|
<div class="uk-margin-small-bottom">
|
|
{{template.description}}
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="uk-card-footer uk-padding-remove-vertical">
|
|
<div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid>
|
|
|
|
|
|
<div>
|
|
<div class="uk-padding-small uk-padding-remove-horizontal">
|
|
<button
|
|
class="uk-button uk-button-link uk-flex uk-flex-middle" (click)="newPlugin(template)">
|
|
<!-- <icon name="edit" [flex]="true"></icon>-->
|
|
<span class="uk-margin-xsmall-left"> Select Template</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<form *ngIf="!selectTemplateView" [formGroup]="templateForm" class="uk-grid" uk-grid>
|
|
|
|
|
|
<ng-container *ngIf="selectedTemplate || selectedPlugin">
|
|
<div class="uk-text-large ">{{selectedTemplate.name}}</div>
|
|
<div class="uk-text-meta uk-width-1-1">{{selectedTemplate.description}}</div>
|
|
<div input [formInput]="templateForm.get('placement')" placeholder="Placements" [options]="placementsOptions" type="select" class="uk-width-1-2"></div>
|
|
<div class="uk-heading-divider uk-text-small uk-width-1-1 uk-margin-bottom uk-text-meta">
|
|
<div class="uk-grid">
|
|
<div>Plugin Fields</div>
|
|
</div>
|
|
</div>
|
|
<div *ngFor="let attrForm of attrFormArray.controls; let i=index" class="uk-width-1-1 uk-grid uk-child-width-1-2 uk-margin-top" uk-grid>
|
|
<div *ngIf="this.selectedTemplate.attributes[attrForm.get('key').value].type == 'text'" input [formInput]="attrForm.get('value')" [placeholder]="selectedTemplate.attributes[attrForm.get('key').value].name" type="text" ></div>
|
|
<div *ngIf="this.selectedTemplate.attributes[attrForm.get('key').value].type == 'URL'" input [formInput]="attrForm.get('value')" [placeholder]="selectedTemplate.attributes[attrForm.get('key').value].name" type="URL" [validators]="urlValidator"></div>
|
|
<div *ngIf="this.selectedTemplate.attributes[attrForm.get('key').value].type == 'boolean'" input [formInput]="attrForm.get('value')" [placeholder]="selectedTemplate.attributes[attrForm.get('key').value].name" type="select"
|
|
[options]="[{label: 'yes', value:true}, {label: 'no', value:false}]"></div>
|
|
<div *ngIf="this.selectedTemplate.attributes[attrForm.get('key').value].type == 'HTML'" class="uk-width-1-1">
|
|
<label>
|
|
{{selectedTemplate.attributes[attrForm.get('key').value].name}}:
|
|
</label>
|
|
<ckeditor [readonly]="false"
|
|
debounce="500"
|
|
[formControl]="attrForm.get('value')"
|
|
[config]="{ extraAllowedContent: '* [uk-*](*) ; span', disallowedContent: 'script; *[on*]',
|
|
removeButtons: 'Save,NewPage,DocProps,Preview,Print,' +
|
|
'Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,' +
|
|
'CreateDiv,Flash,PageBreak,' +
|
|
'Subscript,Superscript,Anchor,Smiley,Iframe,Styles,Font,About,Language',
|
|
extraPlugins: 'divarea'}">
|
|
</ckeditor>
|
|
</div>
|
|
</div>
|
|
|
|
</ng-container>
|
|
</form>
|
|
</ng-container>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<modal-alert #deleteModal (alertOutput)="confirmedDelete()" classTitle="uk-background-primary uk-light"></modal-alert>
|