Remove the {navigation} import from the Shortcuts and inject it from the toolbar where we actually use the fuseShortcuts

This commit is contained in:
Sercan Yemen 2018-04-04 14:36:33 +03:00
parent ca42f71b0e
commit 831d48f5a3
3 changed files with 11 additions and 6 deletions

View File

@ -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 { Subscription } from 'rxjs/Subscription';
import { ObservableMedia } from '@angular/flex-layout'; import { ObservableMedia } from '@angular/flex-layout';
import { CookieService } from 'ngx-cookie-service'; 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 { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
import { FuseConfigService } from '@fuse/services/config.service'; import { FuseConfigService } from '@fuse/services/config.service';
import { navigation } from 'app/navigation/navigation';
@Component({ @Component({
selector : 'fuse-shortcuts', selector : 'fuse-shortcuts',
templateUrl: './shortcuts.component.html', templateUrl: './shortcuts.component.html',
@ -25,6 +23,8 @@ export class FuseShortcutsComponent implements OnInit, OnDestroy
matchMediaSubscription: Subscription; matchMediaSubscription: Subscription;
onConfigChanged: Subscription; onConfigChanged: Subscription;
@Input() navigation: any;
@ViewChild('searchInput') searchInputField; @ViewChild('searchInput') searchInputField;
@ViewChild('shortcuts') shortcutsEl: ElementRef; @ViewChild('shortcuts') shortcutsEl: ElementRef;
@ -37,8 +37,6 @@ export class FuseShortcutsComponent implements OnInit, OnDestroy
private cookieService: CookieService private cookieService: CookieService
) )
{ {
this.filteredNavigationItems = this.navigationItems = this.fuseNavigationService.getFlatNavigation(navigation);
this.onConfigChanged = this.onConfigChanged =
this.fuseConfig.onConfigChanged this.fuseConfig.onConfigChanged
.subscribe( .subscribe(
@ -50,6 +48,9 @@ export class FuseShortcutsComponent implements OnInit, OnDestroy
ngOnInit() ngOnInit()
{ {
// Get the navigation items and flatten them
this.filteredNavigationItems = this.navigationItems = this.fuseNavigationService.getFlatNavigation(this.navigation);
const cookieExists = this.cookieService.check('FUSE2.shortcuts'); const cookieExists = this.cookieService.check('FUSE2.shortcuts');
if ( cookieExists ) if ( cookieExists )

View File

@ -21,7 +21,7 @@
</div> </div>
<div class="px-8 px-mat-16"> <div class="px-8 px-mat-16">
<fuse-shortcuts></fuse-shortcuts> <fuse-shortcuts [navigation]="navigation"></fuse-shortcuts>
</div> </div>
</div> </div>

View File

@ -5,6 +5,8 @@ import { TranslateService } from '@ngx-translate/core';
import { FuseConfigService } from '@fuse/services/config.service'; import { FuseConfigService } from '@fuse/services/config.service';
import { FuseSidebarService } from '@fuse/components/sidebar/sidebar.service'; import { FuseSidebarService } from '@fuse/components/sidebar/sidebar.service';
import { navigation } from 'app/navigation/navigation';
@Component({ @Component({
selector : 'fuse-toolbar', selector : 'fuse-toolbar',
templateUrl: './toolbar.component.html', templateUrl: './toolbar.component.html',
@ -19,6 +21,7 @@ export class FuseToolbarComponent
showLoadingBar: boolean; showLoadingBar: boolean;
horizontalNav: boolean; horizontalNav: boolean;
noNav: boolean; noNav: boolean;
navigation: any;
constructor( constructor(
private router: Router, private router: Router,
@ -87,6 +90,7 @@ export class FuseToolbarComponent
this.noNav = settings.layout.navigation === 'none'; this.noNav = settings.layout.navigation === 'none';
}); });
this.navigation = navigation;
} }
toggleSidebarOpened(key) toggleSidebarOpened(key)