diff --git a/gui/app/components/document/block-editor.js b/gui/app/components/document/block-editor.js index a4575f68..99f97b2e 100644 --- a/gui/app/components/document/block-editor.js +++ b/gui/app/components/document/block-editor.js @@ -10,7 +10,6 @@ // https://documize.com import { inject as service } from '@ember/service'; - import Component from '@ember/component'; export default Component.extend({ diff --git a/gui/app/components/document/content-linker.js b/gui/app/components/document/content-linker.js index b6558130..a1e3a9b5 100644 --- a/gui/app/components/document/content-linker.js +++ b/gui/app/components/document/content-linker.js @@ -12,7 +12,6 @@ import { debounce } from '@ember/runloop'; import { computed, set } from '@ember/object'; import { inject as service } from '@ember/service'; -import { A } from '@ember/array'; import Component from '@ember/component'; import TooltipMixin from '../../mixins/tooltip'; import ModalMixin from '../../mixins/modal'; diff --git a/gui/app/components/document/page-heading.js b/gui/app/components/document/page-heading.js index bde8c3ae..4ed00ffc 100644 --- a/gui/app/components/document/page-heading.js +++ b/gui/app/components/document/page-heading.js @@ -38,6 +38,8 @@ export default Component.extend(ModalMixin, { return; } + this.modalInputFocus('#publish-page-modal-' + this.get('page.id'), '#block-title-' + this.get('page.id')); + this.load(); }, @@ -49,6 +51,10 @@ export default Component.extend(ModalMixin, { i.set('selected', false); }); + if (this.get('isDestroyed') || this.get('isDestroying')) { + return; + } + this.set('documentList', A(d)); this.set('documentListOthers', A(d.filter((item) => item.get('id') !== me.get('id')))); }); diff --git a/gui/app/components/section/base-editor-inline.js b/gui/app/components/section/base-editor-inline.js index f12578d8..0f9f9b5c 100644 --- a/gui/app/components/section/base-editor-inline.js +++ b/gui/app/components/section/base-editor-inline.js @@ -20,10 +20,12 @@ export default Component.extend(TooltipMixin, ModalMixin, { mousetrap: null, showLinkModal: false, hasNameError: empty('page.title'), + hasDescError: empty('page.excerpt'), pageId: computed('page', function () { let page = this.get('page'); return `page-editor-${page.id}`; }), + previewText: 'Preview', didRender() { let msContainer = document.getElementById('section-editor-' + this.get('containerId')); @@ -91,6 +93,8 @@ export default Component.extend(TooltipMixin, ModalMixin, { }, onPreview() { + let pt = this.get('previewText'); + this.set('previewText', pt === 'Preview' ? 'Edit Mode' : 'Preview'); return this.get('onPreview')(); }, diff --git a/gui/app/components/section/base-editor.js b/gui/app/components/section/base-editor.js index d8811b85..5994e5a9 100644 --- a/gui/app/components/section/base-editor.js +++ b/gui/app/components/section/base-editor.js @@ -9,19 +9,16 @@ // // https://documize.com -import { computed } from '@ember/object'; - +import { empty } from '@ember/object/computed'; import Component from '@ember/component'; +import ModalMixin from '../../mixins/modal'; -export default Component.extend({ - drop: null, +export default Component.extend(ModalMixin, { cancelLabel: "Close", actionLabel: "Save", - tip: "Short and concise title", busy: false, - hasExcerpt: computed('page', function () { - return is.not.undefined(this.get('page.excerpt')); - }), + hasNameError: empty('page.title'), + hasDescError: empty('page.excerpt'), didRender() { let self = this; @@ -34,8 +31,8 @@ export default Component.extend({ return false; }); - $("#page-title").removeClass("error"); - $("#page-excerpt").removeClass("error"); + $("#page-title").removeClass("is-invalid"); + $("#page-excerpt").removeClass("is-invalid"); $("#page-title").focus(function() { $(this).select(); @@ -45,65 +42,38 @@ export default Component.extend({ }); }, - willDestroyElement() { - let drop = this.get('drop'); - - if (is.not.null(drop)) { - drop.destroy(); - } - }, - actions: { onCancel() { if (this.attrs.isDirty() !== null && this.attrs.isDirty()) { - $(".discard-edits-dialog").css("display", "block"); - - let drop = new Drop({ - target: $("#editor-cancel")[0], - content: $(".cancel-edits-dialog")[0], - classes: 'drop-theme-basic', - position: "bottom right", - openOn: "always", - tetherOptions: { - offset: "5px 0", - targetOffset: "10px 0" - }, - remove: false - }); - - this.set('drop', drop); - + this.modalOpen('#discard-modal', {show: true}); return; } this.attrs.onCancel(); }, + onDiscard() { + this.modalClose('#discard-modal'); + this.attrs.onCancel(); + }, + + onAction() { if (this.get('busy')) { return; } if (is.empty(this.get('page.title'))) { - $("#page-title").addClass("error").focus(); + $("#page-title").addClass("is-invalid").focus(); return; } if (this.get('hasExcerpt') && is.empty(this.get('page.excerpt'))) { - $("#page-excerpt").addClass("error").focus(); + $("#page-excerpt").addClass("is-invalid").focus(); return; } this.attrs.onAction(this.get('page.title')); - }, - - keepEditing() { - let drop = this.get('drop'); - drop.close(); - }, - - discardEdits() { - this.attrs.onCancel(); } } }); diff --git a/gui/app/components/toolbar/for-document.js b/gui/app/components/toolbar/for-document.js index b7a9a7db..5eb981df 100644 --- a/gui/app/components/toolbar/for-document.js +++ b/gui/app/components/toolbar/for-document.js @@ -29,6 +29,8 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, { name: '', description: '' }, + showTools: true, // show document related tools? favourite, delete, make template... + showDocumentLink: false, // show link to document in breadcrumbs didReceiveAttrs() { this._super(...arguments); diff --git a/gui/app/pods/document/block/controller.js b/gui/app/pods/document/block/controller.js index 86bc2569..170f301d 100644 --- a/gui/app/pods/document/block/controller.js +++ b/gui/app/pods/document/block/controller.js @@ -10,7 +10,6 @@ // https://documize.com import { inject as service } from '@ember/service'; - import Controller from '@ember/controller'; export default Controller.extend({ diff --git a/gui/app/pods/document/block/route.js b/gui/app/pods/document/block/route.js index e1cd49c0..33f12b29 100644 --- a/gui/app/pods/document/block/route.js +++ b/gui/app/pods/document/block/route.js @@ -10,7 +10,6 @@ // https://documize.com import { hash } from 'rsvp'; - import { inject as service } from '@ember/service'; import Route from '@ember/routing/route'; import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; @@ -29,12 +28,4 @@ export default Route.extend(AuthenticatedRouteMixin, { block: self.get('sectionService').getBlock(params.block_id), }); }, - - activate() { - $('body').addClass('background-color-off-white'); - }, - - deactivate() { - $('body').removeClass('background-color-off-white'); - } }); diff --git a/gui/app/pods/document/block/template.hbs b/gui/app/pods/document/block/template.hbs index d4bd7258..1a423f02 100644 --- a/gui/app/pods/document/block/template.hbs +++ b/gui/app/pods/document/block/template.hbs @@ -1,18 +1,7 @@ -
-
-
-
-
- {{#link-to 'document.index' model.folder.id model.folder.slug model.document.id model.document.slug}} - arrow_back {{model.document.name}} - {{/link-to}} -
- {{document/document-heading document=model.document}} - {{document/block-editor document=model.document folder=model.folder block=model.block onCancel=(action 'onCancel') onAction=(action 'onAction')}} -
-
-
+{{layout/nav-bar}} + +
+ {{toolbar/for-document document=model.document spaces=model.folders space=model.folder permissions=model.permissions showTools=false showDocumentLink=true}} + + {{document/block-editor document=model.document folder=model.folder block=model.block onCancel=(action 'onCancel') onAction=(action 'onAction')}}
- - - diff --git a/gui/app/pods/document/section/controller.js b/gui/app/pods/document/section/controller.js index c518224b..5b0acf70 100644 --- a/gui/app/pods/document/section/controller.js +++ b/gui/app/pods/document/section/controller.js @@ -10,11 +10,9 @@ // https://documize.com import { inject as service } from '@ember/service'; - import Controller from '@ember/controller'; -import NotifierMixin from '../../../mixins/notifier'; -export default Controller.extend(NotifierMixin, { +export default Controller.extend({ documentService: service('document'), actions: { @@ -28,8 +26,6 @@ export default Controller.extend(NotifierMixin, { }, onAction(page, meta) { - this.showNotification("Saved"); - let model = { page: page.toJSON({ includeId: true }), meta: meta.toJSON({ includeId: true }) @@ -43,7 +39,7 @@ export default Controller.extend(NotifierMixin, { this.get('model.folder.id'), this.get('model.folder.slug'), this.get('model.document.id'), - this.get('model.document.slug'), + this.get('model.document.slug'), { queryParams: { pageId: page.get('id')}}); }); }, diff --git a/gui/app/pods/document/section/route.js b/gui/app/pods/document/section/route.js index a9fafead..f23d7f98 100644 --- a/gui/app/pods/document/section/route.js +++ b/gui/app/pods/document/section/route.js @@ -31,13 +31,5 @@ export default Route.extend(AuthenticatedRouteMixin, { page: this.get('documentService').getPage(this.modelFor('document').document.get('id'), params.page_id), meta: this.get('documentService').getPageMeta(this.modelFor('document').document.get('id'), params.page_id) }); - }, - - activate() { - $('body').addClass('background-color-off-white'); - }, - - deactivate() { - $('body').removeClass('background-color-off-white'); } }); diff --git a/gui/app/pods/document/section/template.hbs b/gui/app/pods/document/section/template.hbs index 138b7ec7..60487a95 100644 --- a/gui/app/pods/document/section/template.hbs +++ b/gui/app/pods/document/section/template.hbs @@ -1,15 +1,9 @@ -
-
-
-
-
- {{#link-to 'document.index' model.folder.id model.folder.slug model.document.id model.document.slug}} - arrow_back {{model.document.name}} - {{/link-to}} -
- {{document/document-heading document=model.document permissions=model.permissions}} - {{document/document-editor document=model.document folder=model.folder page=model.page meta=model.meta onCancel=(action 'onCancel') onAction=(action 'onAction')}} -
-
+{{layout/nav-bar}} + +
+ {{toolbar/for-document document=model.document spaces=model.folders space=model.folder permissions=model.permissions showTools=false showDocumentLink=true}} + +
+ {{document/document-editor document=model.document folder=model.folder page=model.page meta=model.meta onCancel=(action 'onCancel') onAction=(action 'onAction')}}
diff --git a/gui/app/styles/section/trello.scss b/gui/app/styles/section/trello.scss index 20bba3e8..444919b5 100644 --- a/gui/app/styles/section/trello.scss +++ b/gui/app/styles/section/trello.scss @@ -23,14 +23,15 @@ font-weight: bold; color: #4c4c4c; font-size: 14px; - margin: 5px; + display: inline-block; + vertical-align: text-top; } .section-trello-list-checkbox { - vertical-align: text-bottom; + vertical-align: text-top; + margin-right: 10px; } - .section-trello-render { > .trello-board { width: 100%; @@ -44,7 +45,7 @@ font-weight: bold; color: #fff; font-size: 16px; - } + } } > .trello-list { @@ -65,7 +66,7 @@ font-size: 14px; margin: 0 10px 10px 0; } - + > a { > .trello-card { color: #4c4c4c; @@ -82,8 +83,8 @@ white-space: normal; cursor: pointer; vertical-align: top; - } + } } } } -} \ No newline at end of file +} diff --git a/gui/app/styles/view/document/doc-structure.scss b/gui/app/styles/view/document/doc-structure.scss index b51635e8..62041623 100644 --- a/gui/app/styles/view/document/doc-structure.scss +++ b/gui/app/styles/view/document/doc-structure.scss @@ -7,7 +7,7 @@ > .page-number { color: $color-dark; background-color: $color-gray-light2; - padding: 0.4rem 1rem; + padding: 0.2rem 1rem; font-size: 1.8rem; margin: 0 1.5rem 0 0; font-weight: normal; diff --git a/gui/app/styles/view/document/section-editor.scss b/gui/app/styles/view/document/section-editor.scss index d53f2602..a7a4229c 100644 --- a/gui/app/styles/view/document/section-editor.scss +++ b/gui/app/styles/view/document/section-editor.scss @@ -4,7 +4,9 @@ } > .canvas { - margin: 34px 0 0 0; + // margin: 34px 0 0 0; + padding: 30px 20px; + box-shadow: 0 0 0 0.75pt $color-stroke,0 0 3pt 0.75pt $color-stroke; } } @@ -19,41 +21,7 @@ } } - - - -.section-editor-fullscreen { - @extend .transition-all; - @include border-radius(2px); - @include ease-in(); - position: relative; - padding: 25px 50px; - box-shadow: 0 0 0 0.75pt $color-stroke,0 0 3pt 0.75pt $color-stroke; - background-color: $color-white; +.block-editor { + margin-top: 3rem; } -.zone-section-editor { - margin-left: 60px; - padding: 20px 60px; - z-index: 777; - position: relative; - - .section-editor { - @extend .transition-all; - @include border-radius(2px); - @include ease-in(); - position: relative; - padding: 25px 50px; - box-shadow: 0 0 0 0.75pt $color-stroke,0 0 3pt 0.75pt $color-stroke; - background-color: $color-white; - - > .buttons { - margin-top: 17px; - float: right; - } - - .cancel-edits-dialog { - display: none; - } - } -} diff --git a/gui/app/templates/components/document/block-editor.hbs b/gui/app/templates/components/document/block-editor.hbs index f6265f8f..2f56ca07 100644 --- a/gui/app/templates/components/document/block-editor.hbs +++ b/gui/app/templates/components/document/block-editor.hbs @@ -1 +1,4 @@ -{{component editorType document=document folder=folder page=page meta=meta blockMode=true onCancel=(action 'onCancel') onAction=(action 'onAction')}} +
+ {{component editorType document=document folder=folder page=page meta=meta blockMode=true onCancel=(action 'onCancel') onAction=(action 'onAction')}} +
+ diff --git a/gui/app/templates/components/section/airtable/type-editor.hbs b/gui/app/templates/components/section/airtable/type-editor.hbs index 92756a57..4555cac4 100644 --- a/gui/app/templates/components/section/airtable/type-editor.hbs +++ b/gui/app/templates/components/section/airtable/type-editor.hbs @@ -1,8 +1,7 @@ -{{#section/base-editor document=document folder=folder page=page isDirty=(action 'isDirty') onCancel=(action 'onCancel') - onAction=(action 'onAction')}} -
- -
Paste the Airtable embed code snippet
- {{textarea value=data rows="3" id="airtable-embed-code" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"}} +{{#section/base-editor document=document folder=folder page=page isDirty=(action 'isDirty') onCancel=(action 'onCancel') onAction=(action 'onAction')}} +
+ + {{textarea value=data rows="3" id="airtable-embed-code" class="form-control mousetrap" placeholder="Enter code" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"}} + Paste the Airtable embed code snippet
{{/section/base-editor}} diff --git a/gui/app/templates/components/section/base-editor-inline.hbs b/gui/app/templates/components/section/base-editor-inline.hbs index 14759d80..e0f9b079 100644 --- a/gui/app/templates/components/section/base-editor-inline.hbs +++ b/gui/app/templates/components/section/base-editor-inline.hbs @@ -1,24 +1,22 @@ -
+
-
+
{{#if blockMode}}
- - {{focus-input id="page-id-{{pageId}}" value=page.title class="form-control mousetrap"}} + {{focus-input id="page-id-{{pageId}}" value=page.title class=(if hasNameError 'form-control mousetrap form-control-lg edit-title is-invalid' 'form-control form-control-lg edit-title mousetrap') placeholder="Enter name"}}
- - {{textarea id="page-excerpt-{{pageId}}" value=page.excerpt class="form-control mousetrap" rows="3"}} + {{textarea id="page-excerpt-{{pageId}}" value=page.excerpt rows="2" class=(if hasDescError 'form-control mousetrap form-control-lg edit-title is-invalid' 'form-control form-control-lg edit-title mousetrap') placeholder="Enter description"}}
{{else}}
- {{focus-input type="text" id=pageId value=page.title class=(if hasNameError 'form-control mousetrap form-control-lg edit-title is-invalid' 'form-control form-control-lg edit-title mousetrap') placeholder="Name"}} + {{focus-input type="text" id=pageId value=page.title class=(if hasNameError 'form-control mousetrap form-control-lg edit-title is-invalid' 'form-control form-control-lg edit-title mousetrap') placeholder="Enter name"}}
{{/if}}
-
+
{{#if busy}} @@ -29,7 +27,7 @@ {{/if}} {{#if previewButton}} -
Preview
+
{{previewText}}
{{/if}}
Save
@@ -40,7 +38,7 @@
-
+
{{yield}}
diff --git a/gui/app/templates/components/section/base-editor.hbs b/gui/app/templates/components/section/base-editor.hbs index 1b7b7121..4a280a44 100644 --- a/gui/app/templates/components/section/base-editor.hbs +++ b/gui/app/templates/components/section/base-editor.hbs @@ -1,45 +1,50 @@ -
-
- {{#if busy}} - - {{/if}} -
{{cancelLabel}}
-
-
{{actionLabel}}
-
-
-
-
- -
{{tip}}
- {{focus-input type='text' id="page-title" value=page.title class="mousetrap"}} -
- {{#if hasExcerpt}} -
-
- -
Short description
- {{textarea rows="3" id="page-excerpt" value=page.excerpt class="mousetrap"}} -
+
+ +
+
+
+ {{focus-input type="text" id="page-title" value=page.title class=(if hasNameError 'form-control mousetrap form-control-lg edit-title is-invalid' 'form-control form-control-lg edit-title mousetrap') placeholder="Enter name"}}
- {{/if}} -
- + +
+
+
+ {{yield}} +
+
-
- {{yield}} -
-
+
+ + \ No newline at end of file diff --git a/gui/app/templates/components/section/trello/type-editor.hbs b/gui/app/templates/components/section/trello/type-editor.hbs index d98540dc..ed249fd9 100644 --- a/gui/app/templates/components/section/trello/type-editor.hbs +++ b/gui/app/templates/components/section/trello/type-editor.hbs @@ -3,51 +3,33 @@ isDirty=(action 'isDirty') onCancel=(action 'onCancel') onAction=(action 'onAction')}} {{#if authenticated}} - -
- {{#if noBoards}} -
-
You have no team boards to share - personal boards are never shown.
+ {{#if noBoards}} +

You have no team boards to share - personal boards are never shown

+ {{else}} +
+ + {{ui-select id="boards-dropdown" content=boards action=(action 'onBoardChange') optionValuePath="id" optionLabelPath="name" selection=config.board}} +
+
+ +
+
{{config.board.name}}
+ {{#each config.lists as |list|}} +
+ {{#if list.included}} + check_box + {{else}} + check_box_outline_blank + {{/if}} + {{list.name}} +
+ {{/each}} +
- {{else}} -
- -
Choose lists to include from board
- {{ui-select id="boards-dropdown" content=boards action=(action 'onBoardChange') optionValuePath="id" optionLabelPath="name" selection=config.board}} -
-
- -
Select lists to include
-
-
{{config.board.name}}
- {{#each config.lists as |list|}} -
- {{#if list.included}} - check_box - {{else}} - check_box_outline_blank - {{/if}} - {{list.name}} -
- {{/each}} -
-
-
- {{/if}} -
- +
+ {{/if}} {{else}} - -
-
-
-
Authentication
-
Click to authenticate with Trello
-
-
Authenticate
-
-
- +
Authenticate
{{/if}} {{/section/base-editor}} \ No newline at end of file diff --git a/gui/app/templates/components/toolbar/for-document.hbs b/gui/app/templates/components/toolbar/for-document.hbs index fa3e16cf..f6fde5c7 100644 --- a/gui/app/templates/components/toolbar/for-document.hbs +++ b/gui/app/templates/components/toolbar/for-document.hbs @@ -3,80 +3,85 @@ {{#toolbar/t-links}} {{#link-to "folders" class="link" tagName="li"}}Spaces{{/link-to}} {{#link-to "folder" space.id space.slug class="link" tagName="li"}}{{space.name}}{{/link-to}} + {{#if showDocumentLink}} + {{#link-to 'document.index' space.id space.slug document.id document.slug class="link"}}{{document.name}}{{/link-to}} + {{/if}} {{/toolbar/t-links}} - {{#toolbar/t-actions}} - {{#if session.authenticated}} - {{#if permissions.documentAdd}} -
- content_copy + {{#if showTools}} + {{#toolbar/t-actions}} + {{#if session.authenticated}} + {{#if permissions.documentAdd}} +
+ content_copy +
+
+ + {{/if}} + {{/if}} + +
+ print +
+
+ + {{#if pinState.isPinned}} +
+ star
-