diff --git a/domain/category/endpoint.go b/domain/category/endpoint.go index 4c93131b..ef54ab40 100644 --- a/domain/category/endpoint.go +++ b/domain/category/endpoint.go @@ -279,7 +279,7 @@ func (h *Handler) Delete(w http.ResponseWriter, r *http.Request) { } /* - 7. link/unlink document to category 6. add category view permission !!! + 7. link/unlink document to category 8. filter space documents by category -- URL param? nested route? */ diff --git a/gui/app/components/document/tab-heading.js b/gui/app/components/document/tab-heading.js index e560f7e9..435d4dbb 100644 --- a/gui/app/components/document/tab-heading.js +++ b/gui/app/components/document/tab-heading.js @@ -77,7 +77,7 @@ export default Ember.Component.extend(TooltipMixin, { let permissions = this.get('permissions'); return permissions.get('documentDelete') || permissions.get('documentCopy') || - permissions.get('documentMove') || permissions.get('documentTemplate');; + permissions.get('documentMove') || permissions.get('documentTemplate'); }), didRender() { diff --git a/gui/app/components/layout/zone-navigation.js b/gui/app/components/layout/zone-navigation.js deleted file mode 100644 index e0cf20c6..00000000 --- a/gui/app/components/layout/zone-navigation.js +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2016 Documize Inc. . 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 . -// -// https://documize.com - -import Ember from 'ember'; -import netUtil from '../../utils/net'; -import constants from '../../utils/constants'; -import TooltipMixin from '../../mixins/tooltip'; - -const { - inject: { service } -} = Ember; - -export default Ember.Component.extend(TooltipMixin, { - folderService: service('folder'), - appMeta: service(), - session: service(), - store: service(), - folder: null, - view: { - folder: false, - search: false, - settings: false, - profile: false - }, - pinned: service(), - pins: [], - enableLogout: true, - - init() { - this._super(...arguments); - - if (this.get("session.authenticated") && this.get("session.user.id") !== '0') { - this.get("session.accounts").forEach((account) => { - // TODO: do not mutate account.active here - account.active = account.orgId === this.get("appMeta.orgId"); - }); - } - - this.set('pins', this.get('pinned').get('pins')); - - if (this.get('appMeta.authProvider') === constants.AuthProvider.Keycloak) { - let config = this.get('appMeta.authConfig'); - config = JSON.parse(config); - this.set('enableLogout', !config.disableLogout); - } - }, - - didReceiveAttrs() { - if (this.get('folder') === null) { - this.set("folder", this.get('folderService.currentFolder')); - } - - let route = this.get('router.currentRouteName'); - this.set('view.folder', (is.startWith(route, 'folder')) ? true : false); - this.set('view.settings', (is.startWith(route, 'customize')) ? true : false); - this.set('view.profile', (route === 'profile') ? true : false); - this.set('view.search', (route === 'search') ? true : false); - }, - - didInsertElement() { - this._super(...arguments); - - // Size the pinned items zone - if (this.get("session.authenticated")) { - this.eventBus.subscribe('resized', this, 'sizePinnedZone'); - this.eventBus.subscribe('pinChange', this, 'setupPins'); - this.sizePinnedZone(); - this.setupPins(); - - let self = this; - - var sortable = Sortable.create(document.getElementById('pinned-zone'), { - animation: 150, - onEnd: function () { - self.get('pinned').updateSequence(this.toArray()).then((pins) => { - self.set('pins', pins); - }); - } - }); - - this.set('sortable', sortable); - } - }, - - didRender() { - if (this.get('session.isAdmin')) { - this.addTooltip(document.getElementById("workspace-settings")); - } - if (this.get("session.authenticated") && this.get('enableLogout')) { - this.addTooltip(document.getElementById("workspace-logout")); - } else { - this.addTooltip(document.getElementById("workspace-login")); - } - if (this.get("session.authenticated")) { - this.addTooltip(document.getElementById("user-profile-button")); - } - if (this.get('session.hasAccounts')) { - this.addTooltip(document.getElementById("accounts-button")); - } - - this.addTooltip(document.getElementById("home-button")); - this.addTooltip(document.getElementById("search-button")); - }, - - setupPins() { - if (this.get('isDestroyed') || this.get('isDestroying')) { - return; - } - - this.get('pinned').getUserPins().then((pins) => { - if (this.get('isDestroyed') || this.get('isDestroying')) { - return; - } - - this.set('pins', pins); - - pins.forEach((pin) => { - this.addTooltip(document.getElementById(`pin-${pin.id}`)); - }); - }); - }, - - // set height for pinned zone so ti scrolls on spill - sizePinnedZone() { - let topofBottomZone = parseInt($('#bottom-zone').css("top").replace("px", "")); - let heightOfTopZone = parseInt($('#top-zone').css("height").replace("px", "")); - let size = topofBottomZone - heightOfTopZone - 40; - $('#pinned-zone').css('height', size + "px"); - }, - - willDestroyElement() { - let sortable = this.get('sortable'); - - if (!_.isUndefined(sortable)) { - sortable.destroy(); - } - - this.eventBus.unsubscribe('resized'); - this.eventBus.unsubscribe('pinChange'); - - this.destroyTooltips(); - }, - - actions: { - switchAccount(domain) { - window.location.href = netUtil.getAppUrl(domain); - }, - - jumpToPin(pin) { - let folderId = pin.get('folderId'); - let documentId = pin.get('documentId'); - - if (_.isEmpty(documentId)) { - // jump to space - let folder = this.get('store').peekRecord('folder', folderId); - this.get('router').transitionTo('folder', folderId, folder.get('slug')); - } else { - // jump to doc - let folder = this.get('store').peekRecord('folder', folderId); - this.get('router').transitionTo('document', folderId, folder.get('slug'), documentId, 'document'); - } - } - } -}); diff --git a/gui/app/components/layout/zone-sidebar.js b/gui/app/components/layout/zone-sidebar.js index cb25c125..3a698cb9 100644 --- a/gui/app/components/layout/zone-sidebar.js +++ b/gui/app/components/layout/zone-sidebar.js @@ -10,6 +10,74 @@ // https://documize.com import Ember from 'ember'; +import constants from '../../utils/constants'; + +const { + computed, + inject: { service } +} = Ember; export default Ember.Component.extend({ + folderService: service('folder'), + appMeta: service(), + session: service(), + store: service(), + pinned: service(), + enableLogout: true, + pins: [], + hasPins: computed.notEmpty('pins'), + + init() { + this._super(...arguments); + + if (this.get('appMeta.authProvider') === constants.AuthProvider.Keycloak) { + let config = this.get('appMeta.authConfig'); + config = JSON.parse(config); + this.set('enableLogout', !config.disableLogout); + } + }, + + didInsertElement() { + this._super(...arguments); + + if (this.get("session.authenticated")) { + this.eventBus.subscribe('pinChange', this, 'setupPins'); + this.setupPins(); + } + }, + + setupPins() { + if (this.get('isDestroyed') || this.get('isDestroying')) { + return; + } + + this.get('pinned').getUserPins().then((pins) => { + if (this.get('isDestroyed') || this.get('isDestroying')) { + return; + } + + this.set('pins', pins); + }); + }, + + willDestroyElement() { + this.eventBus.unsubscribe('pinChange'); + }, + + actions: { + jumpToPin(pin) { + let folderId = pin.get('folderId'); + let documentId = pin.get('documentId'); + + if (_.isEmpty(documentId)) { + // jump to space + let folder = this.get('store').peekRecord('folder', folderId); + this.get('router').transitionTo('folder', folderId, folder.get('slug')); + } else { + // jump to doc + let folder = this.get('store').peekRecord('folder', folderId); + this.get('router').transitionTo('document', folderId, folder.get('slug'), documentId, 'document'); + } + } + } }); diff --git a/gui/app/pods/customize/template.hbs b/gui/app/pods/customize/template.hbs index cf815854..396789b8 100644 --- a/gui/app/pods/customize/template.hbs +++ b/gui/app/pods/customize/template.hbs @@ -1,4 +1,3 @@ -{{layout/zone-navigation}} {{#layout/zone-container}} {{#layout/zone-sidebar}}