[plugins-functionality | DONE | Changed ] improvements in manage menu items

This commit is contained in:
argirok 2024-07-01 16:46:55 +03:00
parent e463080109
commit 3077b9b493
2 changed files with 22 additions and 15 deletions

View File

@ -7,8 +7,13 @@
<div class="uk-flex uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid <div class="uk-flex uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid
[class]="isPortalAdministrator ? 'uk-flex-between@m':'uk-flex-right@m'"> [class]="isPortalAdministrator ? 'uk-flex-between@m':'uk-flex-right@m'">
<div> <div>
<div input inputClass="border-bottom" type="select" [options]="menuTypes" [(value)]="selectedMenuType" (valueChange)="valueChange()" <!--<div input inputClass="border-bottom" type="select" [options]="menuTypes" [(value)]="selectedMenuType" (valueChange)="valueChange()"
*ngIf="isPortalAdministrator"></div> *ngIf="isPortalAdministrator"></div>-->
<ul *ngIf="isPortalAdministrator" class="uk-subnav uk-subnav-pill uk-margin-medium-top">
<li *ngFor="let type of menuTypes; let i=index"
[class.uk-active]="selectedMenuType === type.value"><a
(click)="selectedMenuType = type.value"><span>{{type.label}}</span></a></li>
</ul>
</div> </div>
<div> <div>
<button class="uk-button uk-button-default uk-flex uk-flex-middle" <button class="uk-button uk-button-default uk-flex uk-flex-middle"
@ -163,9 +168,9 @@
<span class="uk-margin-small-left">Hidden</span> <span class="uk-margin-small-left">Hidden</span>
</label> </label>
</div> </div>
<ng-container *ngIf="selectedMenuType == 'customMenu'">
<h6 class="uk-margin-medium-top">Menu alignment</h6> <h6 class="uk-margin-medium-top">Menu alignment</h6>
<div *ngIf="selectedMenuType == 'customMenu'"> <div >
<div> <div>
<label (click)="alignMenu('LEFT')"> <label (click)="alignMenu('LEFT')">
<input class="uk-radio" type="radio" name="menuAlign" [checked]="(featuredAlignment == 'LEFT')"> <input class="uk-radio" type="radio" name="menuAlign" [checked]="(featuredAlignment == 'LEFT')">
@ -185,6 +190,7 @@
</label> </label>
</div> </div>
</div> </div>
</ng-container>
</div> </div>
</div> </div>
<div *ngIf="displayMenuItems && displayMenuItems.length == 0" <div *ngIf="displayMenuItems && displayMenuItems.length == 0"

View File

@ -46,8 +46,9 @@ export class MenuComponent implements OnInit {
public menuItemForm: FormGroup; public menuItemForm: FormGroup;
public pageForm: FormGroup; public pageForm: FormGroup;
public menuTypes = [ public menuTypes = [
{label: 'Normal Menu', value: 'normalMenu'}, {label: 'Custom', value: 'customMenu'},
{label: 'Custom Menu', value: 'customMenu'} {label: 'Main', value: 'normalMenu'}
]; ];
public selectedMenuType = this.menuTypes[0].value; public selectedMenuType = this.menuTypes[0].value;
public normalMenuItems: MenuItemExtended[] = []; public normalMenuItems: MenuItemExtended[] = [];
@ -126,8 +127,8 @@ export class MenuComponent implements OnInit {
} else { } else {
this.title.setTitle('Administrator Dashboard | Menu'); this.title.setTitle('Administrator Dashboard | Menu');
} }
this.isPortalAdministrator = Session.isPortalAdministrator(user); this.isPortalAdministrator = false;//Session.isPortalAdministrator(user);
this.selectedMenuType = this.isPortalAdministrator ? this.menuTypes[0].value : this.menuTypes[1].value; this.selectedMenuType = this.menuTypes[0].value
}); });
} }
@ -271,7 +272,7 @@ export class MenuComponent implements OnInit {
this.deleteMenuItemFromArray(this.selectedMenuItem, this.isChild); this.deleteMenuItemFromArray(this.selectedMenuItem, this.isChild);
NotificationHandler.rise("Menu item have been <b>successfully deleted</b>"); NotificationHandler.rise("Menu item have been <b>successfully deleted</b>");
this.showLoading = false; this.showLoading = false;
this._clearCacheService.clearCacheInRoute("Menu item deleted",this.portal, "/"); this._clearCacheService.purgeBrowserCache("Menu item deleted",this.portal);
}, },
error => this.handleError("Server error deleting menu item", error) error => this.handleError("Server error deleting menu item", error)
@ -313,7 +314,7 @@ export class MenuComponent implements OnInit {
menuItem => { menuItem => {
this.menuItemSavedSuccessfully(menuItem, true); this.menuItemSavedSuccessfully(menuItem, true);
NotificationHandler.rise('Menu item <b>' + menuItem.title + '</b> has been <b>successfully created</b>'); NotificationHandler.rise('Menu item <b>' + menuItem.title + '</b> has been <b>successfully created</b>');
this._clearCacheService.clearCacheInRoute("Menu item saved",this.portal, "/"); this._clearCacheService.purgeBrowserCache("Menu item saved",this.portal);
}, },
error => this.handleError("System error creating menu item", error) error => this.handleError("System error creating menu item", error)
) )
@ -324,7 +325,7 @@ export class MenuComponent implements OnInit {
menuItem => { menuItem => {
this.menuItemSavedSuccessfully(menuItem, false); this.menuItemSavedSuccessfully(menuItem, false);
NotificationHandler.rise('Menu item <b>' + menuItem.title + '</b> has been <b>successfully updated</b>'); NotificationHandler.rise('Menu item <b>' + menuItem.title + '</b> has been <b>successfully updated</b>');
this._clearCacheService.clearCacheInRoute("Menu item updated",this.portal, "/"); this._clearCacheService.purgeBrowserCache("Menu item updated",this.portal);
}, },
error => this.handleError("System error updating menu item", error) error => this.handleError("System error updating menu item", error)
) )
@ -390,7 +391,7 @@ export class MenuComponent implements OnInit {
HelperFunctions.swap(temp, index, newIndex); HelperFunctions.swap(temp, index, newIndex);
this._helpContentService.reorderMenuItems(temp, this.portal).subscribe(() => { this._helpContentService.reorderMenuItems(temp, this.portal).subscribe(() => {
HelperFunctions.swap(this.featuredMenuItems, index, newIndex); HelperFunctions.swap(this.featuredMenuItems, index, newIndex);
this._clearCacheService.clearCacheInRoute("Menu items reordered",this.portal, "/"); this._clearCacheService.purgeBrowserCache("Menu items reordered",this.portal);
}, error => { }, error => {
this.handleError("System error reordering menu items", error); this.handleError("System error reordering menu items", error);
}); });
@ -402,7 +403,7 @@ export class MenuComponent implements OnInit {
HelperFunctions.swap(temp, index, newIndex); HelperFunctions.swap(temp, index, newIndex);
this._helpContentService.reorderMenuItems(temp, this.portal).subscribe(() => { this._helpContentService.reorderMenuItems(temp, this.portal).subscribe(() => {
HelperFunctions.swap(children && children.length ? children : this.normalMenuItems, index, newIndex); HelperFunctions.swap(children && children.length ? children : this.normalMenuItems, index, newIndex);
this._clearCacheService.clearCacheInRoute("Menu items reordered",this.portal, "/"); this._clearCacheService.purgeBrowserCache("Menu items reordered",this.portal);
}, error => { }, error => {
this.handleError("System error reordering menu items", error); this.handleError("System error reordering menu items", error);
}); });
@ -417,7 +418,7 @@ export class MenuComponent implements OnInit {
} else { } else {
this.showNormalMenu = status; this.showNormalMenu = status;
} }
this._clearCacheService.clearCacheInRoute("Menu toggled",this.portal, "/"); this._clearCacheService.purgeBrowserCache("Menu toggled",this.portal);
NotificationHandler.rise("Menu has been <b>successfully toggled to be "+(status?"visible":"hidden")+"</b>"); NotificationHandler.rise("Menu has been <b>successfully toggled to be "+(status?"visible":"hidden")+"</b>");
}, error => { }, error => {
this.handleError("System error toggling menu", error); this.handleError("System error toggling menu", error);
@ -429,7 +430,7 @@ export class MenuComponent implements OnInit {
this.subscriptions.push( this.subscriptions.push(
this._helpContentService.alignMenu(MenuAlignment[alignment], this.portal).subscribe(() => { this._helpContentService.alignMenu(MenuAlignment[alignment], this.portal).subscribe(() => {
this.featuredAlignment = alignment; this.featuredAlignment = alignment;
this._clearCacheService.clearCacheInRoute("Menu aligned",this.portal, "/"); this._clearCacheService.purgeBrowserCache("Menu aligned",this.portal);
NotificationHandler.rise("Menu has been <b>successfully "+alignment.toLowerCase()+" aligned</b>"); NotificationHandler.rise("Menu has been <b>successfully "+alignment.toLowerCase()+" aligned</b>");
}, error => { }, error => {
this.handleError("System error aligning menu to the "+alignment.toLowerCase(), error); this.handleError("System error aligning menu to the "+alignment.toLowerCase(), error);