1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-02 20:15:26 +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() {

View file

@ -38,6 +38,7 @@ export default Component.extend(Notifier, {
didReceiveAttrs() {
this._super(...arguments);
// Show/allow liking if space allows it and document is published.
this.set('showLikes', this.get('folder.allowLikes') && this.get('document.isLive'));
},

View file

@ -0,0 +1,17 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Component from '@ember/component';
export default Component.extend({
tagName: 'div',
classNames: ['custom-action'],
});