1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-20 05:39:42 +02:00

Enable doc section expand/collapse

Closes #170
This commit is contained in:
HarveyKandola 2019-06-05 11:09:24 +01:00
parent 99a5418dba
commit 8baad7e2f0
22 changed files with 229 additions and 102 deletions

View file

@ -18,17 +18,23 @@ export default Component.extend({
editMode: false,
editPage: null,
editMeta: null,
expanded: true,
didReceiveAttrs() {
this._super(...arguments);
if (this.get('isDestroyed') || this.get('isDestroying')) return;
let pageId = this.get('page.id');
if (this.get('session.authenticated')) {
this.workflow();
}
if (this.get('toEdit') === this.get('page.id') && this.get('permissions.documentEdit')) this.send('onEdit');
if (this.get('toEdit') === pageId && this.get('permissions.documentEdit')) this.send('onEdit');
// Work out if this section is expanded by default (state stored in browser local storage).
this.set('expanded', !_.includes(this.get('expandState'), pageId));
},
workflow() {