diff --git a/gui/app/components/document/page-heading.js b/gui/app/components/document/page-heading.js index 4ed00ffc..a1c4d699 100644 --- a/gui/app/components/document/page-heading.js +++ b/gui/app/components/document/page-heading.js @@ -39,7 +39,6 @@ export default Component.extend(ModalMixin, { } this.modalInputFocus('#publish-page-modal-' + this.get('page.id'), '#block-title-' + this.get('page.id')); - this.load(); }, diff --git a/gui/app/components/document/view-content.js b/gui/app/components/document/view-content.js index c3d4a988..d2650de7 100644 --- a/gui/app/components/document/view-content.js +++ b/gui/app/components/document/view-content.js @@ -26,6 +26,8 @@ export default Component.extend(TooltipMixin, { newSectionLocation: '', beforePage: null, toEdit: '', + showDeleteBlockDialog: false, + deleteBlockId: '', didReceiveAttrs() { this._super(...arguments); @@ -139,10 +141,6 @@ export default Component.extend(TooltipMixin, { this.set('blocks', blocks); this.set('hasBlocks', blocks.get('length') > 0); - - blocks.forEach((b) => { - b.set('deleteId', `delete-block-button-${b.id}`); - }); }); }, @@ -288,10 +286,19 @@ export default Component.extend(TooltipMixin, { }); }, - onDeleteBlock(id) { + onShowDeleteBlockModal(id) { + this.set('deleteBlockId', id); + this.set('showDeleteBlockDialog', true); + }, + + onDeleteBlock() { + this.set('showDeleteBlockDialog', false); + + let id = this.get('deleteBlockId'); const promise = this.attrs.onDeleteBlock(id); promise.then(() => { + this.set('deleteBlockId', ''); this.loadBlocks(); }); diff --git a/gui/app/pods/document/index/controller.js b/gui/app/pods/document/index/controller.js index 8c2d6e08..dd461fcb 100644 --- a/gui/app/pods/document/index/controller.js +++ b/gui/app/pods/document/index/controller.js @@ -186,18 +186,6 @@ export default Controller.extend(TooltipMixin, { this.get('documentService').getPages(this.get('document.id')).then( (pages) => { this.set('pages', pages); }); - // _.each(changes, (change) => { - // let pageContent = _.findWhere(this.get('pages'), { - // id: change.pageId - // }); - - // if (is.not.undefined(pageContent)) { - // pageContent.set('sequence', change.sequence); - // } - // }); - - // this.set('pages', this.get('pages').sortBy('sequence')); - // this.get('target._routerMicrolib').refresh(); }); }, @@ -206,22 +194,6 @@ export default Controller.extend(TooltipMixin, { this.get('documentService').getPages(this.get('document.id')).then( (pages) => { this.set('pages', pages); }); - // _.each(changes, (change) => { - // let pageContent = _.findWhere(this.get('pages'), { - // id: change.pageId - // }); - - // if (is.not.undefined(pageContent)) { - // pageContent.set('level', change.level); - // } - // }); - - // let pages = this.get('pages'); - // pages = pages.sortBy('sequence'); - - // this.set('pages', []); - // this.set('pages', pages); - // this.get('target._routerMicrolib').refresh(); }); }, @@ -233,7 +205,7 @@ export default Controller.extend(TooltipMixin, { if (!$(jumpTo).inView()) { $(jumpTo).velocity("scroll", { duration: 250, offset: -100 }); } - } + } }, onTagChange(tags) { diff --git a/gui/app/styles/view/document/add-section.scss b/gui/app/styles/view/document/add-section.scss index 6cb2a887..68c532a8 100644 --- a/gui/app/styles/view/document/add-section.scss +++ b/gui/app/styles/view/document/add-section.scss @@ -116,17 +116,11 @@ } } - > .block-actions { + > .actions { @include ease-in(); - display: none; position: absolute; top: 10px; right: 8px; - - .material-icons { - color: $color-stroke; - font-size: 1rem; - } } > .details { diff --git a/gui/app/templates/components/document/view-content.hbs b/gui/app/templates/components/document/view-content.hbs index a1b0d8db..7d4cce9c 100644 --- a/gui/app/templates/components/document/view-content.hbs +++ b/gui/app/templates/components/document/view-content.hbs @@ -78,11 +78,16 @@