2016-04-21 21:49:53 +03:00
|
|
|
import {Component, ViewEncapsulation} from 'angular2/core';
|
2016-04-29 12:32:37 +03:00
|
|
|
import {Subscription} from 'rxjs/Subscription';
|
2016-04-21 21:49:53 +03:00
|
|
|
|
2016-04-25 19:33:47 +03:00
|
|
|
import {MsgCenter} from '../msgCenter';
|
2016-04-27 11:06:16 +03:00
|
|
|
import {ProfilePicturePipe} from '../pipes/image/profile-picture.pipe';
|
2016-04-27 18:21:52 +03:00
|
|
|
import {ScrollPosition} from '../directives/scrollPosition.directive';
|
2016-04-29 12:32:37 +03:00
|
|
|
import {SidebarStateService} from '../sidebar/sidebarState.service'
|
2016-04-25 19:33:47 +03:00
|
|
|
|
2016-04-21 21:49:53 +03:00
|
|
|
@Component({
|
2016-04-29 17:27:19 +03:00
|
|
|
selector: 'page-top',
|
|
|
|
|
styles: [require('./pageTop.scss')],
|
|
|
|
|
template: require('./pageTop.html'),
|
|
|
|
|
directives: [MsgCenter, ScrollPosition],
|
|
|
|
|
pipes: [ProfilePicturePipe]
|
2016-04-21 21:49:53 +03:00
|
|
|
})
|
2016-04-27 18:21:52 +03:00
|
|
|
export class PageTop {
|
2016-04-29 17:27:19 +03:00
|
|
|
isScrolled:Boolean = false;
|
|
|
|
|
isMenuCollapsed:boolean = false;
|
2016-04-29 12:32:37 +03:00
|
|
|
|
2016-04-29 17:27:19 +03:00
|
|
|
private _sidebarStateSubscription:Subscription;
|
2016-04-29 12:32:37 +03:00
|
|
|
|
2016-04-29 17:27:19 +03:00
|
|
|
constructor(private _sidebarStateService:SidebarStateService) {
|
|
|
|
|
this._sidebarStateSubscription = this._sidebarStateService.getStateStream().subscribe((isCollapsed) => this.isMenuCollapsed = isCollapsed);
|
|
|
|
|
}
|
2016-04-29 12:32:37 +03:00
|
|
|
|
2016-04-29 17:27:19 +03:00
|
|
|
toggleMenu() {
|
|
|
|
|
this.isMenuCollapsed = !this.isMenuCollapsed;
|
|
|
|
|
this._sidebarStateService.stateChanged(this.isMenuCollapsed);
|
|
|
|
|
}
|
2016-04-27 18:21:52 +03:00
|
|
|
|
2016-04-29 17:27:19 +03:00
|
|
|
scrolledChanged(isScrolled) {
|
|
|
|
|
this.isScrolled = isScrolled;
|
|
|
|
|
}
|
2016-04-27 18:21:52 +03:00
|
|
|
}
|