diff --git a/gui/app/components/document/document-page.js b/gui/app/components/document/document-page.js index f8d65d72..fee95178 100644 --- a/gui/app/components/document/document-page.js +++ b/gui/app/components/document/document-page.js @@ -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() { diff --git a/gui/app/components/document/view-content.js b/gui/app/components/document/view-content.js index 00d3d49c..bf943120 100644 --- a/gui/app/components/document/view-content.js +++ b/gui/app/components/document/view-content.js @@ -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')); }, diff --git a/gui/app/components/layout/grid/sidebar-custom-action.js b/gui/app/components/layout/grid/sidebar-custom-action.js new file mode 100644 index 00000000..1d3fcca1 --- /dev/null +++ b/gui/app/components/layout/grid/sidebar-custom-action.js @@ -0,0 +1,17 @@ +// 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 Component from '@ember/component'; + +export default Component.extend({ + tagName: 'div', + classNames: ['custom-action'], +}); diff --git a/gui/app/constants/constants.js b/gui/app/constants/constants.js index 0695241d..14b09bf7 100644 --- a/gui/app/constants/constants.js +++ b/gui/app/constants/constants.js @@ -228,6 +228,7 @@ let constants = EmberObject.extend({ Delete: 'dicon-bin', Edit: 'dicon-pen-2', Email: 'dicon-email', + Expand: 'dicon-enlarge', Export: 'dicon-data-upload', Export2: 'dicon-upload', Filter: 'dicon-sort-tool', @@ -254,6 +255,7 @@ let constants = EmberObject.extend({ Send: 'dicon-send', Settings: 'dicon-settings-gear', Share: 'dicon-network-connection', + Sort: 'dicon-alpha-order', Split: 'dicon-split-37', Tag: 'dicon-delete-key', Tick: 'dicon-check', diff --git a/gui/app/pods/document/index/controller.js b/gui/app/pods/document/index/controller.js index f526c749..4777c3f9 100644 --- a/gui/app/pods/document/index/controller.js +++ b/gui/app/pods/document/index/controller.js @@ -19,6 +19,7 @@ export default Controller.extend(Notifier, { templateService: service('template'), sectionService: service('section'), linkService: service('link'), + localStore: service('local-storage'), appMeta: service(), router: service(), sidebarTab: 'toc', @@ -263,6 +264,36 @@ export default Controller.extend(Notifier, { }); }); }); + }, + + // Expand all if nothing is expanded at the moment. + // Collapse all if something is expanded at the moment. + onExpandAll() { + let expandState = this.get('localStore').getDocSectionHide(this.get('document.id')); + + if (expandState.length === 0) { + let pages = this.get('pages'); + pages.forEach((item) => { + expandState.push(item.get('page.id')); + }) + } else { + expandState = []; + } + + this.get('localStore').setDocSectionHide(this.get('document.id'), expandState); + this.set('expandState', expandState); + }, + + onExpand(pageId, show) { + let expandState = this.get('localStore').getDocSectionHide(this.get('document.id')); + + if (show) { + expandState = _.without(expandState, pageId) + } else { + expandState.push(pageId); + } + + this.get('localStore').setDocSectionHide(this.get('document.id'), expandState); } } }); diff --git a/gui/app/pods/document/index/route.js b/gui/app/pods/document/index/route.js index 4f9f10ce..51d46731 100644 --- a/gui/app/pods/document/index/route.js +++ b/gui/app/pods/document/index/route.js @@ -19,6 +19,7 @@ export default Route.extend(AuthenticatedRouteMixin, { linkService: service('link'), folderService: service('folder'), userService: service('user'), + localStore: service('local-storage'), contributionStatus: '', approvalStatus: '', @@ -69,6 +70,9 @@ export default Route.extend(AuthenticatedRouteMixin, { controller.set('blocks', model.blocks); controller.set('versions', model.versions); controller.set('attachments', model.attachments); + + // For persistence of section expand/collapse state. + controller.set('expandState', this.get('localStore').getDocSectionHide(model.document.id)); }, activate: function () { diff --git a/gui/app/pods/document/index/template.hbs b/gui/app/pods/document/index/template.hbs index 46fc1255..5a00c085 100644 --- a/gui/app/pods/document/index/template.hbs +++ b/gui/app/pods/document/index/template.hbs @@ -25,6 +25,11 @@ {{document/view-content + expandState=expandState roles=roles links=links pages=pages @@ -84,6 +90,7 @@ attachments=attachments currentPageId=currentPageId refresh=(action "refresh") + onExpand=(action "onExpand") onSavePage=(action "onSavePage") onCopyPage=(action "onCopyPage") onMovePage=(action "onMovePage") diff --git a/gui/app/services/local-storage.js b/gui/app/services/local-storage.js index 15f6dfdf..70b07736 100644 --- a/gui/app/services/local-storage.js +++ b/gui/app/services/local-storage.js @@ -26,5 +26,24 @@ export default Service.extend({ clearAll() { localStorage.clear(); - } + }, + + getDocSectionHide(docId) { + let state = localStorage[`doc-hide-${docId}`]; + if (_.isUndefined(state) || _.isEmpty(state)) { + return []; + } + + return _.split(state, '|'); + }, + + setDocSectionHide(docId, state) { + let key = `doc-hide-${docId}`; + + if (state.length === 0) { + delete localStorage[key]; + } else { + localStorage[key] = _.join(state, '|'); + } + }, }); diff --git a/gui/app/styles/core/icon-ui.scss b/gui/app/styles/core/icon-ui.scss index d82178ff..1aff655a 100644 --- a/gui/app/styles/core/icon-ui.scss +++ b/gui/app/styles/core/icon-ui.scss @@ -438,3 +438,11 @@ icons .dicon-move-layer-up::before { content: "\ea5d"; } + +.dicon-alpha-order::before { + content: "\ea5e"; +} + +.dicon-enlarge::before { + content: "\ea5f"; +} diff --git a/gui/app/styles/core/layout/sidebar.scss b/gui/app/styles/core/layout/sidebar.scss index f461e937..af5095c6 100644 --- a/gui/app/styles/core/layout/sidebar.scss +++ b/gui/app/styles/core/layout/sidebar.scss @@ -20,6 +20,21 @@ } } + // Allows for icon to be placed top right corner of sidebar zone. + // Expects icon to be placed in the zone. + > .custom-action { + position: absolute; + top: 10px; + right: 10px; + cursor: pointer; + color: map-get($gray-shades, 500); + font-size: 1rem; + + &:hover { + color: map-get($gray-shades, 800); + } + } + > .section { margin: 0; padding: 0 7px; diff --git a/gui/app/styles/core/view/document/section.scss b/gui/app/styles/core/view/document/section.scss index cd8d66fb..8b76e643 100644 --- a/gui/app/styles/core/view/document/section.scss +++ b/gui/app/styles/core/view/document/section.scss @@ -55,6 +55,14 @@ color: map-get($yellow-shades, 700); } } + + > i.expand { + color: map-get($green-shades, 500); + + &:hover { + color: map-get($green-shades, 700); + } + } } } diff --git a/gui/app/templates/components/document/document-page.hbs b/gui/app/templates/components/document/document-page.hbs index 5c7db2af..0195af8a 100644 --- a/gui/app/templates/components/document/document-page.hbs +++ b/gui/app/templates/components/document/document-page.hbs @@ -12,6 +12,7 @@ {{else}} {{document/page-heading + expanded=expanded page=page meta=meta pages=pages @@ -24,6 +25,7 @@ permissions=permissions onEdit=(action "onEdit") refresh=(action refresh) + onExpand=(action onExpand) onCopyPage=(action "onCopyPage") onMovePage=(action "onMovePage") onDeletePage=(action "onDeletePage") @@ -32,12 +34,14 @@ onPageSequenceChange=(action onPageSequenceChange) onShowSectionWizard=(action onShowSectionWizard)}} + {{#if expanded}}
{{section/base-renderer page=page}}
{{/if}} + {{/if}} - {{document/section-attachment uploadLabel="Upload Attachments" + {{document/section-attachment uploadLabel="Upload Attachments" editMode=editMode page=page document=document files=attachments onAttachmentUpload=(action onAttachmentUpload) onAttachmentDelete=(action onAttachmentDelete)}} diff --git a/gui/app/templates/components/document/page-heading.hbs b/gui/app/templates/components/document/page-heading.hbs index c925c052..4d59f4e9 100644 --- a/gui/app/templates/components/document/page-heading.hbs +++ b/gui/app/templates/components/document/page-heading.hbs @@ -8,10 +8,14 @@
- {{#unless (eq document.protection constants.ProtectionType.Lock)}}
+ + {{#attach-tooltip showDelay=1000}}Show/hide{{/attach-tooltip}} + + {{#unless (eq document.protection constants.ProtectionType.Lock)}} {{#if canEdit}} +
{{#attach-tooltip showDelay=1000}}Insert section above{{/attach-tooltip}} @@ -57,9 +61,9 @@ {{/attach-popover}} {{/if}} + {{/unless}}
- {{/unless}}
diff --git a/gui/app/templates/components/document/view-content.hbs b/gui/app/templates/components/document/view-content.hbs index 118360b6..1a53c3fb 100644 --- a/gui/app/templates/components/document/view-content.hbs +++ b/gui/app/templates/components/document/view-content.hbs @@ -1,7 +1,8 @@ {{#if hasPages}} {{#each pages key="id" as |item|}} - + {{document/document-page + expandState=expandState roles=roles pages=pages folder=folder @@ -14,6 +15,7 @@ permissions=permissions attachments=attachments refresh=(action refresh) + onExpand=(action onExpand) onAttachmentUpload=(action onAttachmentUpload) onAttachmentDelete=(action onAttachmentDelete) onSavePage=(action "onSavePage") diff --git a/gui/app/templates/components/folder/documents-list.hbs b/gui/app/templates/components/folder/documents-list.hbs index 8202d26c..b5d6e52e 100644 --- a/gui/app/templates/components/folder/documents-list.hbs +++ b/gui/app/templates/components/folder/documents-list.hbs @@ -4,61 +4,57 @@ {{#ui/ui-toolbar dark=false light=false raised=false large=false bordered=false}} {{ui/ui-toolbar-icon icon=constants.Icon.Blocks color=constants.Color.Gray tooltip="Complete" selected=(eq viewDensity "1") onClick=(action "onSwitchView" "1")}} + {{ui/ui-toolbar-icon icon=constants.Icon.All color=constants.Color.Gray tooltip="Comfort" selected=(eq viewDensity "2") onClick=(action "onSwitchView" "2")}} + {{ui/ui-toolbar-label label="—" color=constants.Color.Gray tooltip="Compact" selected=(eq viewDensity "3") onClick=(action "onSwitchView" "3")}} + + {{#ui/ui-toolbar-icon icon=constants.Icon.Sort color=constants.Color.Gray tooltip="Sort"}} + {{#attach-popover class="ember-attacher-popper" hideOn="click" showOn="click" isShown=false placement="bottom-end" as |attacher|}} + +
+ + +
+
    +
  • +
    Name
    +
  • +
  • +
    Created date
    +
  • +
  • +
    Last updated
    +
  • +
+
+ + + +
+
    +
  • +
    Ascending
    +
  • +
  • +
    Descending
    +
  • +
+
+ + + + {{ui/ui-button + light=true + color=constants.Color.Yellow + label=constants.Label.Sort + onClick=(action "onSortBy" attacher)}} +
+ {{/attach-popover}} + {{/ui/ui-toolbar-icon}} {{/ui/ui-toolbar}} - - {{#ui/ui-button - light=false - outline=true - uppercase=false - color=constants.Color.Gray - label=constants.Label.Sort}} - - {{#attach-popover class="ember-attacher-popper" hideOn="click" showOn="click" isShown=false placement="bottom-end" as |attacher|}} - -
- - -
-
    -
  • -
    Name
    -
  • -
  • -
    Created date
    -
  • -
  • -
    Last updated
    -
  • -
-
- - - -
-
    -
  • -
    Ascending
    -
  • -
  • -
    Descending
    -
  • -
-
- - - - {{ui/ui-button - light=true - color=constants.Color.Yellow - label=constants.Label.Sort - onClick=(action "onSortBy" attacher)}} -
- {{/attach-popover}} - {{/ui/ui-button}} diff --git a/gui/app/templates/components/layout/grid/sidebar-custom-action.hbs b/gui/app/templates/components/layout/grid/sidebar-custom-action.hbs new file mode 100644 index 00000000..889d9eea --- /dev/null +++ b/gui/app/templates/components/layout/grid/sidebar-custom-action.hbs @@ -0,0 +1 @@ +{{yield}} diff --git a/gui/app/templates/components/search/search-results.hbs b/gui/app/templates/components/search/search-results.hbs index dc010a96..2d6d2505 100644 --- a/gui/app/templates/components/search/search-results.hbs +++ b/gui/app/templates/components/search/search-results.hbs @@ -2,55 +2,51 @@ {{#if documents}}
- {{#ui/ui-button - light=false - outline=true - uppercase=false - color=constants.Color.Gray - label=constants.Label.Sort}} + {{#ui/ui-toolbar dark=false light=false raised=false large=false bordered=false}} + {{#ui/ui-toolbar-icon icon=constants.Icon.Sort color=constants.Color.Gray tooltip="Sort"}} + {{#attach-popover class="ember-attacher-popper" hideOn="click" showOn="click" isShown=false placement="bottom-end" as |attacher|}} + +
+ - {{#attach-popover class="ember-attacher-popper" hideOn="click" showOn="click" isShown=false placement="bottom-end" as |attacher|}} - -
- +
+
    +
  • +
    Name
    +
  • +
  • +
    Created date
    +
  • +
  • +
    Last updated
    +
  • +
+
-
-
    -
  • -
    Name
    -
  • -
  • -
    Created date
    -
  • -
  • -
    Last updated
    -
  • -
+ + +
+
    +
  • +
    Ascending
    +
  • +
  • +
    Descending
    +
  • +
+
+ + + + {{ui/ui-button + light=true + color=constants.Color.Yellow + label=constants.Label.Sort + onClick=(action "onSortBy" attacher)}}
- - - -
-
    -
  • -
    Ascending
    -
  • -
  • -
    Descending
    -
  • -
-
- - - - {{ui/ui-button - light=true - color=constants.Color.Yellow - label=constants.Label.Sort - onClick=(action "onSortBy" attacher)}} -
- {{/attach-popover}} - {{/ui/ui-button}} + {{/attach-popover}} + {{/ui/ui-toolbar-icon}} + {{/ui/ui-toolbar}}
diff --git a/gui/public/assets/font/dmzui.eot b/gui/public/assets/font/dmzui.eot index 262d1001..20de93c4 100644 Binary files a/gui/public/assets/font/dmzui.eot and b/gui/public/assets/font/dmzui.eot differ diff --git a/gui/public/assets/font/dmzui.svg b/gui/public/assets/font/dmzui.svg index 6a2e7171..8764f669 100644 --- a/gui/public/assets/font/dmzui.svg +++ b/gui/public/assets/font/dmzui.svg @@ -217,6 +217,12 @@ + + diff --git a/gui/public/assets/font/dmzui.ttf b/gui/public/assets/font/dmzui.ttf index 778514ff..224db835 100644 Binary files a/gui/public/assets/font/dmzui.ttf and b/gui/public/assets/font/dmzui.ttf differ diff --git a/gui/public/assets/font/dmzui.woff b/gui/public/assets/font/dmzui.woff index b31d3de8..4a969092 100644 Binary files a/gui/public/assets/font/dmzui.woff and b/gui/public/assets/font/dmzui.woff differ diff --git a/gui/public/assets/font/dmzui.woff2 b/gui/public/assets/font/dmzui.woff2 index da545caf..abfb58fa 100644 Binary files a/gui/public/assets/font/dmzui.woff2 and b/gui/public/assets/font/dmzui.woff2 differ