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 { 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 )

View File

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

View File

@ -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)