212 lines
13 KiB
HTML
212 lines
13 KiB
HTML
<div page-content>
|
|
<div header>
|
|
<admin-tabs tab="template"></admin-tabs>
|
|
<div *ngIf="page" 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 class="uk-h5 uk-margin-remove">{{page.name}}</h1>
|
|
</a>
|
|
</div>
|
|
<ul *ngIf="page" class="uk-subnav uk-subnav-pill uk-margin-medium-top">
|
|
<li [class.uk-active]="filterForm.get('position').value === 'all'" class="uk-margin-small-bottom"><a
|
|
(click)="filterForm.get('position').setValue('all')"><span
|
|
class="title">All placements</span></a></li>
|
|
<li *ngFor="let position of pluginUtils.placementsOptions; let i=index"
|
|
[class.uk-active]="filterForm.get('position').value === position.value" class="uk-margin-small-bottom"><a
|
|
(click)="filterForm.get('position').setValue(position.value)"><span
|
|
class="title">{{position.label}}</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<div actions>
|
|
<div class="uk-section-xsmall">
|
|
<div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
|
|
<!-- <div search-input [disabled]="showLoading" [expandable]="true" [searchControl]="filterForm.get('keyword')" searchInputClass="outer" placeholder="Search class" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>-->
|
|
<div>
|
|
<button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="newPlugin()"
|
|
[disabled]="showLoading" [class.uk-disabled]="showLoading">
|
|
<icon name="add" [flex]="true"></icon>
|
|
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Add plugin template</span>
|
|
</button>
|
|
</div>
|
|
</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">
|
|
<!--<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 templates found</div>
|
|
</div>-->
|
|
<div class="uk-grid uk-child-width-1-1" uk-height-match=".uk-card-body" uk-grid>
|
|
<ng-container *ngFor="let placement of pluginUtils.placementsOptions">
|
|
|
|
<ng-container *ngIf="filterForm.get('position').value == placement.value || filterForm.get('position').value == 'all'">
|
|
<div *ngIf="templatesByPlacement.get(placement.value).length >0 && page"
|
|
class="uk-heading-divider uk-h6 uk-margin-left uk-padding-remove-left uk-text-capitalize ">{{placement.value}}</div>
|
|
<div *ngFor="let template of templatesByPlacement.get(placement.value) ; let i=index">
|
|
<!-- <div *ngIf="this.filter(template)">-->
|
|
<!-- <div *ngFor="let check of checkboxes; let i=index">-->
|
|
<div class="uk-card uk-card-default">
|
|
<div class="uk-card-body uk-flex">
|
|
<!--<div *ngIf="!portal" class="uk-margin-right">
|
|
<input [id]="check.template._id" class="uk-checkbox" type="checkbox"
|
|
name="pagescb[]" value="{{check.page._id}}" [(ngModel)]="check.checked">
|
|
</div>-->
|
|
<div class="uk-width-expand uk-text-small">
|
|
<!-- <h6>{{check.template.name}}</h6>-->
|
|
|
|
<plugin-wrapper [editMode]="false" [wrapperEditMode]="true" [pluginTemplate]="template"></plugin-wrapper>
|
|
<div class="uk-margin-small-bottom">
|
|
<span class="uk-text-meta">Page: </span>{{getPageAsString(template.page)}} -
|
|
<span class="uk-text-meta">Placement: </span>{{template.placement}} -
|
|
<span class="uk-text-meta">Order: </span>{{template.order}}
|
|
|
|
</div>
|
|
<div class="uk-margin-small-bottom">
|
|
<span class="uk-text-meta">Portal type: </span>{{template.portalType}}
|
|
</div>
|
|
<div class="uk-margin-small-bottom">
|
|
<span class="uk-text-meta">Plan: </span>{{template.plan}}
|
|
</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>
|
|
|
|
<ng-container *ngIf="page">
|
|
<div *ngIf="template.order>0">
|
|
<div class="uk-padding-small uk-padding-remove-horizontal">
|
|
<button
|
|
class="uk-button uk-button-link uk-flex uk-flex-middle" (click)="swap(i, i-1, template.placement)">
|
|
<!-- <icon name="" [flex]="true"></icon>-->
|
|
<span class="uk-margin-xsmall-left"> Up</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div *ngIf="template.order < templatesByPlacement.get(placement.value).length -1 ">
|
|
<div class="uk-padding-small uk-padding-remove-horizontal">
|
|
<button
|
|
class="uk-button uk-button-link uk-flex uk-flex-middle" (click)="swap(i+1, i, template.placement)">
|
|
<!-- <icon name="" [flex]="true"></icon>-->
|
|
<span class="uk-margin-xsmall-left"> Down</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</ng-container>
|
|
<div>
|
|
<div class="uk-padding-small uk-padding-remove-horizontal">
|
|
<button
|
|
class="uk-button uk-button-link uk-flex uk-flex-middle" (click)="edit(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(template)">
|
|
<icon name="delete" [flex]="true"></icon>
|
|
<span class="uk-margin-xsmall-left"> Delete</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- </div>-->
|
|
</div>
|
|
<!-- </div>-->
|
|
</ng-container>
|
|
</ng-container>
|
|
</div>
|
|
</ng-container>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<modal-alert #editModal (alertOutput)="saveConfirmed($event)" [large]="true"
|
|
[okDisabled]="templateForm && (templateForm.invalid || !templateForm.dirty)" classTitle="uk-background-primary uk-light">
|
|
<form *ngIf="templateForm" [formGroup]="templateForm" class="uk-grid uk-child-width-1-2" uk-grid>
|
|
<div input [formInput]="templateForm.get('name')" placeholder="Template Name"></div>
|
|
<div input [formInput]="templateForm.get('code')" placeholder="Template Code" [options]="pluginUtils.availablePluginCodes" type="select"></div>
|
|
<div class="uk-width-1-1" input [formInput]="templateForm.get('description')" placeholder="Description" type="textarea"> </div>
|
|
<div input [formInput]="templateForm.get('plan')" placeholder="Plan" [options]="pluginUtils.planOptions" type="select"></div>
|
|
<div input [formInput]="templateForm.get('image')" placeholder="Image"></div>
|
|
<div input [formInput]="templateForm.get('portalType')" placeholder="Portal Type" [options]="portalUtils.portalTypes" type="select"></div>
|
|
<div input [formInput]="templateForm.get('placement')" placeholder="Placement" [options]="pluginUtils.placementsOptions" type="select"></div>
|
|
<div *ngIf="!templateForm.get('portalType').value" input [formInput]="templateForm.get('page')" placeholder="Page" [options]="allPages" type="select" ></div>
|
|
<div *ngIf="templateForm.get('portalType').value" input [formInput]="templateForm.get('page')" placeholder="Page" [options]="allPagesByPortal.get(templateForm.get('portalType').value)" type="select" ></div>
|
|
<plugin-wrapper *ngIf="selectedTemplate " [editMode]="true" [wrapperEditMode]="false" [pluginTemplate]="this.templateForm.getRawValue()"
|
|
class="uk-width-1-1" [editTemplate]="true" (changed)="pluginFieldChanged($event)"></plugin-wrapper>
|
|
<!--<div *ngIf="pluginEditEvent">
|
|
<div *ngIf="pluginEditEvent.type == 'text'" input [value]="this.templateForm.getRawValue().object[pluginEditEvent.field]" [placeholder]="pluginEditEvent.field" [type]="pluginEditEvent.type"
|
|
(valueChange)="pluginFieldChanged($event)"></div>
|
|
<!– <div *ngIf="pluginEditEvent.type == 'URL'" input [formInput]="attrForm.get('value')" placeholder="Default value" [type]="attrForm.get('type').value" [validators]="urlValidator"></div>–>
|
|
<div *ngIf="pluginEditEvent.type == 'boolean'" input [value]="pluginObject[pluginEditEvent.field]" [placeholder]="pluginEditEvent.field" type="select"
|
|
[options]="[{label: 'yes', value:true}, {label: 'no', value:false}]"></div>
|
|
<!– <div *ngIf="pluginEditEvent.type == 'HTML'" class="uk-width-1-1">
|
|
<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>-->
|
|
|
|
<div *ngFor="let attrForm of attrFormArray.controls; let i=index" class="uk-width-1-1 uk-grid uk-child-width-1-2" uk-grid>
|
|
|
|
|
|
<div class="uk-heading-divider uk-text-small uk-width-1-1 uk-margin-bottom uk-text-meta">
|
|
<div class="uk-grid">
|
|
<div>Setting #{{i +1}}</div>
|
|
<div class=" uk-width-expand uk-text-right ">
|
|
<a class=" " (click)="removeAttr(i)">Remove</a>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div input [formInput]="attrForm.get('key')" placeholder="Key"></div>
|
|
<div input [formInput]="attrForm.get('name')" placeholder="Name"></div>
|
|
<div input [formInput]="attrForm.get('type')" placeholder="Type" [options]="pluginUtils.attrTypeOptions" type="select" (valueChange)="attributeTypeChanged(attrForm)"></div>
|
|
|
|
<div *ngIf="attrForm.get('type').value == 'text'" input [formInput]="attrForm.get('value')" placeholder="Default value" [type]="attrForm.get('type').value" ></div>
|
|
<div *ngIf="attrForm.get('type').value == 'URL'" input [formInput]="attrForm.get('value')" placeholder="Default value" [type]="attrForm.get('type').value" [validators]="urlValidator"></div>
|
|
<div *ngIf="attrForm.get('type').value == 'boolean'" input [formInput]="attrForm.get('value')" placeholder="Default value" type="select"
|
|
[options]="[{label: 'yes', value:true}, {label: 'no', value:false}]"></div>
|
|
<div *ngIf="attrForm.get('type').value == 'HTML'" class="uk-width-1-1">
|
|
<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>
|
|
<hr class="uk-width-1-1">
|
|
<div class="uk-width-1-1 uk-text-center ">
|
|
<a (click)="addNewAttr()">Add settings</a>
|
|
</div>
|
|
</form>
|
|
</modal-alert>
|
|
<modal-alert #deleteModal (alertOutput)="confirmedDelete()" classTitle="uk-background-primary uk-light"></modal-alert>
|