2016-05-12 13:53:13 +03:00
|
|
|
import {Component, ViewEncapsulation} from '@angular/core';
|
2016-04-21 21:49:53 +03:00
|
|
|
|
2016-05-13 13:34:55 +03:00
|
|
|
import {AppState} from '../../../app.state';
|
2016-05-04 11:49:36 +03:00
|
|
|
import {ProfilePicturePipe} from '../../pipes';
|
|
|
|
|
import {MsgCenter} from '../../components/msgCenter';
|
2016-05-18 16:45:01 +03:00
|
|
|
import {BaScrollPosition} from '../../directives';
|
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'),
|
2016-05-18 16:45:01 +03:00
|
|
|
directives: [MsgCenter, BaScrollPosition],
|
2016-05-12 13:53:13 +03:00
|
|
|
pipes: [ProfilePicturePipe],
|
|
|
|
|
encapsulation: ViewEncapsulation.None
|
2016-04-21 21:49:53 +03:00
|
|
|
})
|
2016-04-27 18:21:52 +03:00
|
|
|
export class PageTop {
|
2016-05-18 15:02:23 +03:00
|
|
|
|
2016-04-29 17:27:19 +03:00
|
|
|
isScrolled:Boolean = false;
|
|
|
|
|
isMenuCollapsed:boolean = false;
|
2016-04-29 12:32:37 +03:00
|
|
|
|
2016-05-13 13:34:55 +03:00
|
|
|
constructor(private _state:AppState) {
|
2016-05-18 15:02:23 +03:00
|
|
|
this._state.subscribe('menu.isCollapsed', (isCollapsed) => {
|
|
|
|
|
this.isMenuCollapsed = isCollapsed;
|
|
|
|
|
});
|
2016-04-29 17:27:19 +03:00
|
|
|
}
|
2016-04-29 12:32:37 +03:00
|
|
|
|
2016-04-29 17:27:19 +03:00
|
|
|
toggleMenu() {
|
|
|
|
|
this.isMenuCollapsed = !this.isMenuCollapsed;
|
2016-05-13 13:34:55 +03:00
|
|
|
this._state.notifyDataChanged('menu.isCollapsed', this.isMenuCollapsed);
|
2016-04-29 17:27:19 +03:00
|
|
|
}
|
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
|
|
|
}
|