From 831d48f5a3712ee81e43babb146b1fa31bc15aed Mon Sep 17 00:00:00 2001 From: Sercan Yemen Date: Wed, 4 Apr 2018 14:36:33 +0300 Subject: [PATCH] Remove the {navigation} import from the Shortcuts and inject it from the toolbar where we actually use the fuseShortcuts --- src/@fuse/components/shortcuts/shortcuts.component.ts | 11 ++++++----- src/app/main/toolbar/toolbar.component.html | 2 +- src/app/main/toolbar/toolbar.component.ts | 4 ++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/@fuse/components/shortcuts/shortcuts.component.ts b/src/@fuse/components/shortcuts/shortcuts.component.ts index 4f99d938..b8eb24ed 100644 --- a/src/@fuse/components/shortcuts/shortcuts.component.ts +++ b/src/@fuse/components/shortcuts/shortcuts.component.ts @@ -1,4 +1,4 @@ -import { Component, ElementRef, OnDestroy, OnInit, Renderer2, ViewChild } from '@angular/core'; +import { Component, ElementRef, Input, OnDestroy, OnInit, Renderer2, ViewChild } from '@angular/core'; import { Subscription } from 'rxjs/Subscription'; import { ObservableMedia } from '@angular/flex-layout'; import { CookieService } from 'ngx-cookie-service'; @@ -7,8 +7,6 @@ import { FuseMatchMediaService } from '@fuse/services/match-media.service'; import { FuseNavigationService } from '@fuse/components/navigation/navigation.service'; import { FuseConfigService } from '@fuse/services/config.service'; -import { navigation } from 'app/navigation/navigation'; - @Component({ selector : 'fuse-shortcuts', templateUrl: './shortcuts.component.html', @@ -25,6 +23,8 @@ export class FuseShortcutsComponent implements OnInit, OnDestroy matchMediaSubscription: Subscription; onConfigChanged: Subscription; + @Input() navigation: any; + @ViewChild('searchInput') searchInputField; @ViewChild('shortcuts') shortcutsEl: ElementRef; @@ -37,8 +37,6 @@ export class FuseShortcutsComponent implements OnInit, OnDestroy private cookieService: CookieService ) { - this.filteredNavigationItems = this.navigationItems = this.fuseNavigationService.getFlatNavigation(navigation); - this.onConfigChanged = this.fuseConfig.onConfigChanged .subscribe( @@ -50,6 +48,9 @@ export class FuseShortcutsComponent implements OnInit, OnDestroy ngOnInit() { + // Get the navigation items and flatten them + this.filteredNavigationItems = this.navigationItems = this.fuseNavigationService.getFlatNavigation(this.navigation); + const cookieExists = this.cookieService.check('FUSE2.shortcuts'); if ( cookieExists ) diff --git a/src/app/main/toolbar/toolbar.component.html b/src/app/main/toolbar/toolbar.component.html index 07fe27c5..650ad4b5 100644 --- a/src/app/main/toolbar/toolbar.component.html +++ b/src/app/main/toolbar/toolbar.component.html @@ -21,7 +21,7 @@
- +
diff --git a/src/app/main/toolbar/toolbar.component.ts b/src/app/main/toolbar/toolbar.component.ts index 2e26b03e..72550420 100644 --- a/src/app/main/toolbar/toolbar.component.ts +++ b/src/app/main/toolbar/toolbar.component.ts @@ -5,6 +5,8 @@ import { TranslateService } from '@ngx-translate/core'; import { FuseConfigService } from '@fuse/services/config.service'; import { FuseSidebarService } from '@fuse/components/sidebar/sidebar.service'; +import { navigation } from 'app/navigation/navigation'; + @Component({ selector : 'fuse-toolbar', templateUrl: './toolbar.component.html', @@ -19,6 +21,7 @@ export class FuseToolbarComponent showLoadingBar: boolean; horizontalNav: boolean; noNav: boolean; + navigation: any; constructor( private router: Router, @@ -87,6 +90,7 @@ export class FuseToolbarComponent this.noNav = settings.layout.navigation === 'none'; }); + this.navigation = navigation; } toggleSidebarOpened(key)