1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-23 15:19:42 +02:00

Provide view density switcher for spaces & space view

Closes #218
This commit is contained in:
McMatts 2019-03-13 15:17:15 +00:00
parent b89a297c70
commit 9a41e82aa3
5 changed files with 105 additions and 41 deletions

View file

@ -9,8 +9,27 @@
//
// https://documize.com
import { inject as service } from '@ember/service';
import AuthMixin from '../../mixins/auth';
import Component from '@ember/component';
export default Component.extend(AuthMixin, {
localStorage: service(),
viewDensity: "1",
didReceiveAttrs() {
this._super(...arguments);
let viewDensity = this.get('localStorage').getSessionItem('spaces.density');
if (!_.isNull(viewDensity) && !_.isUndefined(viewDensity)) {
this.set('viewDensity', viewDensity);
}
},
actions: {
onSwitchView(v) {
this.set('viewDensity', v);
this.get('localStorage').storeSessionItem('spaces.density', v);
}
}
});