1
0
mirror of https://github.com/flarum/core.git synced 2025-08-10 18:35:56 +02:00

Refactor index pane

So that it only loads when needed, and caches results so things are
nice and snappy
This commit is contained in:
Toby Zerner
2015-02-06 10:32:45 +10:30
parent 0365ae6c71
commit 9ddc622929
10 changed files with 142 additions and 228 deletions

View File

@@ -17,7 +17,25 @@ export default Ember.Mixin.create({
// Whether or not the pane is always visible on screen, even when the
// mouse is taken away.
panePinned: false,
panePinned: localStorage.getItem('panePinned'),
// Disable the paneable behaviour completely, regardless of if it is
// paned, showing, or pinned.
paneDisabled: false,
paneIsShowing: function() {
return this.get('paned') && this.get('paneShowing') && !this.get('paneDisabled');
}.property('paned', 'paneShowing', 'paneDisabled'),
paneIsPinned: function() {
return this.get('paned') && this.get('panePinned') && !this.get('paneDisabled');
}.property('paned', 'panePinned', 'paneDisabled'),
// Tell the application controller when we pin/unpin the pane so that
// other parts of the interface can respond appropriately.
paneIsPinnedChanged: function() {
this.set('controllers.application.panePinned', this.get('paneIsPinned'));
}.observes('paneIsPinned'),
actions: {
showPane: function() {
@@ -35,13 +53,7 @@ export default Ember.Mixin.create({
},
togglePinned: function() {
this.toggleProperty('panePinned');
localStorage.setItem('panePinned', this.toggleProperty('panePinned') || '');
}
},
// Tell the application controller when we pin/unpin the pane so that
// other parts of the interface can respond appropriately.
panePinnedChanged: function() {
this.set('controllers.application.panePinned', this.get('paned') && this.get('panePinned'));
}.observes('paned', 'panePinned')
});
}
});