Navigation Bar: Remove link and routes from parent items in mobile-menu. Add search-input in mobile menu.

This commit is contained in:
Konstantinos Triantafyllou 2023-07-06 16:57:40 +03:00
parent 2c7e3794c5
commit 87e75bca00
2 changed files with 11 additions and 5 deletions

View File

@ -41,12 +41,12 @@
*ngIf="isAtleastOneEnabled(menu.entitiesRequired,showEntity) && isAtleastOneEnabled(menu.routeRequired, showPage)">
<!--a routerLink="{{menu.rootItem.route}}" [queryParams]=menu.rootItem.params class="uk-offcanvas-close custom-offcanvas-close">{{menu.rootItem.title}}</a-->
<a *ngIf="menu.route && (isEnabled([menu.route], showPage) || !menu.routeRequired)"
routerLink="{{menu.route}}" (click)="menu.items.length === 0?closeCanvas(canvas):null"
[routerLink]="menu.items.length === 0?menu.route:null" (click)="menu.items.length === 0?closeCanvas(canvas):null"
[queryParams]="menu.params"
[fragment]="menu.fragment">{{menu.title}}</a>
<a *ngIf="!menu.route && menu.url"
href="{{menu.url}}" (click)="menu.items.length === 0?closeCanvas(canvas):null" [class.custom-external]="menu.target != '_self'"
target="{{menu.target}}">{{menu.title}}</a>
[href]="menu.items.length === 0?menu.url:null" (click)="menu.items.length === 0?closeCanvas(canvas):null"
[class.custom-external]="menu.target != '_self'" [target]="menu.target">{{menu.title}}</a>
<a *ngIf="(!menu.route && !menu.url) ||
(menu.route && menu.routeRequired && !isEnabled([menu.route], showPage)
&& isAtleastOneEnabled(menu.routeRequired, showPage))"
@ -144,6 +144,9 @@
<ng-content select="[extra-s]"></ng-content>
</ng-container>
</ul>
<div *ngIf="hasSearchBar" search-input [(value)]="keyword" placeholder="Search"
[searchInputClass]="'flat background small-vertical'" (searchEmitter)="goTo(canvas)"
class="uk-width-1-1 uk-padding-small uk-margin-medium-top"></div>
</div>
</div>
</div>
@ -170,7 +173,7 @@
<ng-container *ngIf="!activeHeader.menuPosition || activeHeader.menuPosition === 'center'">
<ng-container *ngTemplateOutlet="mainMenu"></ng-container>
</ng-container>
<div *ngIf="searchMode" #search_input search-input [(value)]="keyword" placeholder="Search in Explore"
<div *ngIf="searchMode" #search_input search-input [(value)]="keyword" placeholder="Search"
[searchInputClass]="'flat background small-vertical'" (searchEmitter)="goTo()"
class="uk-width-large@l uk-width-medium uk-width-xlarge@xl"></div>
</div>

View File

@ -243,7 +243,7 @@ export class NavigationBarComponent implements OnInit, OnDestroy, OnChanges {
this.search_input.input.focus(true);
}
goTo() {
goTo(canvas = null) {
let parameterNames = [];
let parameterValues = [];
@ -259,5 +259,8 @@ export class NavigationBarComponent implements OnInit, OnDestroy, OnChanges {
parameterValues.push("q");
}
this.router.navigate([this.properties.searchLinkToAll], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)});
if(canvas) {
this.closeCanvas(canvas);
}
}
}