mirror of
https://github.com/documize/community.git
synced 2025-07-19 13:19:43 +02:00
document sidebar index view
This commit is contained in:
parent
891f0ccd18
commit
3f109a9d1d
18 changed files with 139 additions and 578 deletions
|
@ -18,24 +18,19 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
sectionService: Ember.inject.service('section'),
|
||||
editMode: false,
|
||||
|
||||
init() {
|
||||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
|
||||
let page = this.get('page');
|
||||
|
||||
this.get('documentService').getPageMeta(page.get('documentId'), page.get('id')).then((meta) => {
|
||||
this.set('meta', meta);
|
||||
if (this.get('toEdit') === this.get('page.id') && this.get('isEditor')) {
|
||||
this.send('onEdit');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
|
||||
if (this.get('toEdit') === this.get('page.id') && this.get('isEditor')) {
|
||||
this.send('onEdit');
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
onSavePage(page, meta) {
|
||||
this.set('page', page);
|
||||
|
|
|
@ -1,124 +0,0 @@
|
|||
// 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 Ember from 'ember';
|
||||
import TooltipMixin from '../../mixins/tooltip';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
|
||||
export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
|
||||
documentService: Ember.inject.service('document'),
|
||||
sectionService: Ember.inject.service('section'),
|
||||
document: {},
|
||||
folder: {},
|
||||
showToc: true,
|
||||
showSections: false,
|
||||
showScrollTool: false,
|
||||
showingSections: false,
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.get('sectionService').getSpaceBlocks(this.get('folder.id')).then((b) => {
|
||||
this.set('blocks', b);
|
||||
});
|
||||
},
|
||||
|
||||
didRender() {
|
||||
if (this.session.authenticated) {
|
||||
this.addTooltip(document.getElementById("section-tool"));
|
||||
}
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
this.eventBus.subscribe('resized', this, 'positionTool');
|
||||
this.eventBus.subscribe('scrolled', this, 'positionTool');
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this.eventBus.unsubscribe('resized');
|
||||
this.eventBus.unsubscribe('scrolled');
|
||||
this.destroyTooltips();
|
||||
},
|
||||
|
||||
positionTool() {
|
||||
if (this.get('isDestroyed') || this.get('isDestroying')) {
|
||||
return;
|
||||
}
|
||||
|
||||
let s = $(".scroll-tool");
|
||||
let windowpos = $(window).scrollTop();
|
||||
|
||||
if (windowpos >= 300) {
|
||||
this.set('showScrollTool', true);
|
||||
s.addClass("stuck-tool");
|
||||
s.css('left', parseInt($(".zone-navigation").css('width')) + parseInt($(".zone-sidebar").css('width')) - 16 + 'px');
|
||||
} else {
|
||||
this.set('showScrollTool', false);
|
||||
s.removeClass("stuck-tool");
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
// Page up - above pages shunt down.
|
||||
onPageSequenceChange(pendingChanges) {
|
||||
this.attrs.changePageSequence(pendingChanges);
|
||||
},
|
||||
|
||||
// Move down - pages below shift up.
|
||||
onPageLevelChange(pendingChanges) {
|
||||
this.attrs.changePageLevel(pendingChanges);
|
||||
},
|
||||
|
||||
gotoPage(id) {
|
||||
return this.attrs.gotoPage(id);
|
||||
},
|
||||
|
||||
showToc() {
|
||||
this.set('showToc', true);
|
||||
this.set('showSections', false);
|
||||
this.set('showingSections', false);
|
||||
},
|
||||
|
||||
|
||||
showSections() {
|
||||
this.set('showToc', false);
|
||||
this.set('showSections', true);
|
||||
this.set('showingSections', true);
|
||||
},
|
||||
|
||||
onCancel() {
|
||||
this.send('showToc');
|
||||
this.set('showingSections', false);
|
||||
},
|
||||
|
||||
onAddSection(section) {
|
||||
this.send('showToc');
|
||||
this.attrs.onAddSection(section);
|
||||
},
|
||||
|
||||
onInsertBlock(block) {
|
||||
this.send('showToc');
|
||||
this.attrs.onInsertBlock(block);
|
||||
},
|
||||
|
||||
onDeleteBlock(id) {
|
||||
this.set('blocks', this.get('blocks').filter((item) => item.get('id') !== id));
|
||||
this.attrs.onDeleteBlock(id);
|
||||
},
|
||||
|
||||
scrollTop() {
|
||||
this.set('showScrollTool', false);
|
||||
|
||||
$("html,body").animate({
|
||||
scrollTop: 0
|
||||
}, 500, "linear");
|
||||
}
|
||||
}
|
||||
});
|
|
@ -31,13 +31,18 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
}),
|
||||
|
||||
didReceiveAttrs: function () {
|
||||
this._super(...arguments);
|
||||
|
||||
this.set('showToc', is.not.undefined(this.get('pages')) && this.get('pages').get('length') > 0);
|
||||
|
||||
if (is.not.null(this.get('page'))) {
|
||||
this.send('onEntryClick', this.get('page'));
|
||||
}
|
||||
},
|
||||
|
||||
didRender: function () {
|
||||
this._super(...arguments);
|
||||
|
||||
if (this.session.authenticated) {
|
||||
this.addTooltip(document.getElementById("toc-up-button"));
|
||||
this.addTooltip(document.getElementById("toc-down-button"));
|
||||
|
@ -47,10 +52,14 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
},
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
this.eventBus.subscribe('documentPageAdded', this, 'onDocumentPageAdded');
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
this.eventBus.unsubscribe('documentPageAdded');
|
||||
this.destroyTooltips();
|
||||
},
|
||||
|
@ -89,7 +98,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
let pendingChanges = tocUtil.moveUp(state, pages, page);
|
||||
|
||||
if (pendingChanges.length > 0) {
|
||||
this.attrs.changePageSequence(pendingChanges);
|
||||
this.attrs.onPageSequenceChange(pendingChanges);
|
||||
|
||||
this.send('onEntryClick', this.get('page'));
|
||||
this.audit.record("moved-page-up");
|
||||
|
@ -109,7 +118,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
let pendingChanges = tocUtil.moveDown(state, pages, page);
|
||||
|
||||
if (pendingChanges.length > 0) {
|
||||
this.attrs.changePageSequence(pendingChanges);
|
||||
this.attrs.onPageSequenceChange(pendingChanges);
|
||||
|
||||
this.send('onEntryClick', this.get('page'));
|
||||
this.audit.record("moved-page-down");
|
||||
|
@ -129,7 +138,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
let pendingChanges = tocUtil.indent(state, pages, page);
|
||||
|
||||
if (pendingChanges.length > 0) {
|
||||
this.attrs.changePageLevel(pendingChanges);
|
||||
this.attrs.onPageLevelChange(pendingChanges);
|
||||
|
||||
this.showNotification("Indent");
|
||||
this.audit.record("changed-page-sequence");
|
||||
|
@ -149,7 +158,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
let pendingChanges = tocUtil.outdent(state, pages, page);
|
||||
|
||||
if (pendingChanges.length > 0) {
|
||||
this.attrs.changePageLevel(pendingChanges);
|
||||
this.attrs.onPageLevelChange(pendingChanges);
|
||||
|
||||
this.showNotification("Outdent");
|
||||
this.audit.record("changed-page-sequence");
|
||||
|
@ -159,7 +168,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
|
||||
onEntryClick(id) {
|
||||
this.setState(id);
|
||||
this.attrs.gotoPage(id);
|
||||
this.attrs.onGotoPage(id);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -36,7 +36,7 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
|
|||
this._super(...arguments);
|
||||
|
||||
if (is.empty(this.get('tab'))) {
|
||||
this.set('tab', 'attachments');
|
||||
this.set('tab', 'index');
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -86,6 +86,18 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
|
|||
window.print();
|
||||
},
|
||||
|
||||
onPageSequenceChange(changes) {
|
||||
this.get('onPageSequenceChange')(changes);
|
||||
},
|
||||
|
||||
onPageLevelChange(changes) {
|
||||
this.get('onPageLevelChange')(changes);
|
||||
},
|
||||
|
||||
onGotoPage(id) {
|
||||
this.get('onGotoPage')(id);
|
||||
},
|
||||
|
||||
onUnpin() {
|
||||
this.audit.record('unpinned-document');
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ export default Ember.Component.extend(TooltipMixin, {
|
|||
editMode: true,
|
||||
codeSyntax: null,
|
||||
codeEditor: null,
|
||||
|
||||
editorId: Ember.computed('page', function () {
|
||||
let page = this.get('page');
|
||||
return `markdown-editor-${page.id}`;
|
||||
|
@ -85,7 +84,6 @@ export default Ember.Component.extend(TooltipMixin, {
|
|||
willDestroyElement() {
|
||||
this.set('codeEditor', null);
|
||||
this.destroyTooltips();
|
||||
// $("#" + this.get('editorId')).off("keyup");
|
||||
},
|
||||
|
||||
getBody() {
|
||||
|
|
|
@ -13,315 +13,4 @@ import Ember from 'ember';
|
|||
import NotifierMixin from '../../mixins/notifier';
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
// documentService: Ember.inject.service('document'),
|
||||
// templateService: Ember.inject.service('template'),
|
||||
// sectionService: Ember.inject.service('section'),
|
||||
// page: null,
|
||||
// folder: {},
|
||||
// pages: [],
|
||||
// toggled: false,
|
||||
//
|
||||
// // to test
|
||||
// // to test
|
||||
// // Jump to the right part of the document.
|
||||
// scrollToPage(pageId) {
|
||||
// Ember.run.schedule('afterRender', function () {
|
||||
// let dest;
|
||||
// let target = "#page-title-" + pageId;
|
||||
// let targetOffset = $(target).offset();
|
||||
//
|
||||
// if (is.undefined(targetOffset)) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// dest = targetOffset.top > $(document).height() - $(window).height() ? $(document).height() - $(window).height() : targetOffset.top;
|
||||
// // small correction to ensure we also show page title
|
||||
// dest = dest > 50 ? dest - 74 : dest;
|
||||
//
|
||||
// $("html,body").animate({
|
||||
// scrollTop: dest
|
||||
// }, 500, "linear");
|
||||
// $(".toc-index-item").removeClass("selected");
|
||||
// $("#index-" + pageId).addClass("selected");
|
||||
// });
|
||||
// },
|
||||
//
|
||||
// actions: {
|
||||
// toggleSidebar() {
|
||||
// this.set('toggled', !this.get('toggled'));
|
||||
// },
|
||||
//
|
||||
// onTagChange(tags) {
|
||||
// let doc = this.get('model.document');
|
||||
// doc.set('tags', tags);
|
||||
// this.get('documentService').save(doc);
|
||||
// },
|
||||
//
|
||||
// onSaveDocument(doc) {
|
||||
// this.get('documentService').save(doc);
|
||||
// this.showNotification('Saved');
|
||||
// },
|
||||
//
|
||||
// onCopyPage(pageId, targetDocumentId) {
|
||||
// let documentId = this.get('model.document.id');
|
||||
// this.get('documentService').copyPage(documentId, pageId, targetDocumentId).then(() => {
|
||||
// this.showNotification("Copied");
|
||||
//
|
||||
// // refresh data if copied to same document
|
||||
// if (documentId === targetDocumentId) {
|
||||
// this.get('target.router').refresh();
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
//
|
||||
// onMovePage(pageId, targetDocumentId) {
|
||||
// let documentId = this.get('model.document.id');
|
||||
//
|
||||
// this.get('documentService').copyPage(documentId, pageId, targetDocumentId).then(() => {
|
||||
// this.showNotification("Moved");
|
||||
//
|
||||
// this.send('onPageDeleted', { id: pageId, children: false });
|
||||
// });
|
||||
// },
|
||||
//
|
||||
// onSavePage(page, meta) {
|
||||
// let self = this;
|
||||
// let documentId = this.get('model.document.id');
|
||||
// let model = {
|
||||
// page: page.toJSON({ includeId: true }),
|
||||
// meta: meta.toJSON({ includeId: true })
|
||||
// };
|
||||
//
|
||||
// this.get('documentService').updatePage(documentId, page.get('id'), model).then(function () {
|
||||
// self.audit.record("edited-page");
|
||||
// self.get('documentService').getPages(documentId).then((pages) => {
|
||||
// self.set('model.allPages', pages);
|
||||
// self.set('model.pages', pages.filterBy('pageType', 'section'));
|
||||
// self.set('model.tabs', pages.filterBy('pageType', 'tab'));
|
||||
// });
|
||||
//
|
||||
// });
|
||||
// },
|
||||
//
|
||||
// onPageDeleted(deletePage) {
|
||||
// let documentId = this.get('model.document.id');
|
||||
// let pages = this.get('model.pages');
|
||||
// let deleteId = deletePage.id;
|
||||
// let deleteChildren = deletePage.children;
|
||||
// let page = _.findWhere(pages, {
|
||||
// id: deleteId
|
||||
// });
|
||||
// let pageIndex = _.indexOf(pages, page, false);
|
||||
// let pendingChanges = [];
|
||||
//
|
||||
// this.audit.record("deleted-page");
|
||||
//
|
||||
// // select affected pages
|
||||
// for (var i = pageIndex + 1; i < pages.get('length'); i++) {
|
||||
// if (pages[i].get('level') <= page.get('level')) {
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// pendingChanges.push({
|
||||
// pageId: pages[i].get('id'),
|
||||
// level: pages[i].get('level') - 1
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// if (deleteChildren) {
|
||||
// // nuke of page tree
|
||||
// pendingChanges.push({
|
||||
// pageId: deleteId
|
||||
// });
|
||||
//
|
||||
// this.get('documentService').deletePages(documentId, deleteId, pendingChanges).then(() => {
|
||||
// // update our models so we don't have to reload from db
|
||||
// for (var i = 0; i < pendingChanges.length; i++) {
|
||||
// let pageId = pendingChanges[i].pageId;
|
||||
// this.set('model.pages', _.reject(pages, function (p) { //jshint ignore: line
|
||||
// return p.get('id') === pageId;
|
||||
// }));
|
||||
// }
|
||||
//
|
||||
// this.set('model.pages', _.sortBy(pages, "sequence"));
|
||||
// this.get('target.router').refresh();
|
||||
// });
|
||||
// } else {
|
||||
// // page delete followed by re-leveling child pages
|
||||
// this.get('documentService').deletePage(documentId, deleteId).then(() => {
|
||||
// this.set('model.pages', _.reject(pages, function (p) {
|
||||
// return p.get('id') === deleteId;
|
||||
// }));
|
||||
//
|
||||
// this.send('onPageLevelChange', pendingChanges);
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
//
|
||||
// onInsertSection(data) {
|
||||
// return new Ember.RSVP.Promise((resolve) => {
|
||||
// this.get('documentService').addPage(this.get('model.document.id'), data).then((newPage) => {
|
||||
// let data = this.get('store').normalize('page', newPage);
|
||||
// this.get('store').push(data);
|
||||
//
|
||||
// this.get('documentService').getPages(this.get('model.document.id')).then((pages) => {
|
||||
// this.set('model.allPages', pages);
|
||||
// this.set('model.pages', pages.filterBy('pageType', 'section'));
|
||||
// this.set('model.tabs', pages.filterBy('pageType', 'tab'));
|
||||
//
|
||||
// resolve(newPage.id);
|
||||
//
|
||||
// // this.get('documentService').getPageMeta(this.get('model.document.id'), newPage.id).then(() => {
|
||||
// // console.log("ready to edit");
|
||||
// // // this.transitionToRoute('document.edit',
|
||||
// // // this.get('model.folder.id'),
|
||||
// // // this.get('model.folder.slug'),
|
||||
// // // this.get('model.document.id'),
|
||||
// // // this.get('model.document.slug'),
|
||||
// // // newPage.id);
|
||||
// // });
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
// },
|
||||
//
|
||||
// // to test
|
||||
// onPageSequenceChange(changes) {
|
||||
// this.get('documentService').changePageSequence(this.get('model.document.id'), changes).then(() => {
|
||||
// _.each(changes, (change) => {
|
||||
// let pageContent = _.findWhere(this.get('model.pages'), {
|
||||
// id: change.pageId
|
||||
// });
|
||||
//
|
||||
// if (is.not.undefined(pageContent)) {
|
||||
// pageContent.set('sequence', change.sequence);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// this.set('model.pages', this.get('model.pages').sortBy('sequence'));
|
||||
// this.get('target.router').refresh();
|
||||
// });
|
||||
// },
|
||||
//
|
||||
// // to test
|
||||
// onPageLevelChange(changes) {
|
||||
// this.get('documentService').changePageLevel(this.get('model.document.id'), changes).then(() => {
|
||||
// _.each(changes, (change) => {
|
||||
// let pageContent = _.findWhere(this.get('model.pages'), {
|
||||
// id: change.pageId
|
||||
// });
|
||||
//
|
||||
// if (is.not.undefined(pageContent)) {
|
||||
// pageContent.set('level', change.level);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// let pages = this.get('model.pages');
|
||||
// pages = pages.sortBy('sequence');
|
||||
// this.set('model.pages', []);
|
||||
// this.set('model.pages', pages);
|
||||
// this.get('target.router').refresh();
|
||||
// });
|
||||
// },
|
||||
//
|
||||
// // to test
|
||||
// gotoPage(pageId) {
|
||||
// if (is.null(pageId)) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// this.scrollToPage(pageId);
|
||||
// },
|
||||
//
|
||||
// // to test
|
||||
// onSavePageAsBlock(block) {
|
||||
// this.get('sectionService').addBlock(block).then(() => {
|
||||
// this.showNotification("Published");
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
||||
/*
|
||||
gotoPage(pageId) {
|
||||
if (is.null(pageId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.scrollToPage(pageId);
|
||||
},
|
||||
|
||||
|
||||
onSaveTemplate(name, desc) {
|
||||
this.get('templateService').saveAsTemplate(this.get('model.document.id'), name, desc).then(function () {});
|
||||
},
|
||||
|
||||
onSaveMeta(doc) {
|
||||
this.get('documentService').save(doc).then(() => {
|
||||
this.transitionToRoute('document.index');
|
||||
});
|
||||
},
|
||||
|
||||
onInsertBlock(block) {
|
||||
this.audit.record("added-content-block-" + block.get('contentType'));
|
||||
|
||||
let page = {
|
||||
documentId: this.get('model.document.id'),
|
||||
title: `${block.get('title')}`,
|
||||
level: 1,
|
||||
sequence: 0,
|
||||
body: block.get('body'),
|
||||
contentType: block.get('contentType'),
|
||||
pageType: block.get('pageType'),
|
||||
blockId: block.get('id')
|
||||
};
|
||||
|
||||
let meta = {
|
||||
documentId: this.get('model.document.id'),
|
||||
rawBody: block.get('rawBody'),
|
||||
config: block.get('config'),
|
||||
externalSource: block.get('externalSource')
|
||||
};
|
||||
|
||||
let model = {
|
||||
page: page,
|
||||
meta: meta
|
||||
};
|
||||
|
||||
this.get('documentService').addPage(this.get('model.document.id'), model).then((newPage) => {
|
||||
let data = this.get('store').normalize('page', newPage);
|
||||
this.get('store').push(data);
|
||||
|
||||
this.get('documentService').getPages(this.get('model.document.id')).then((pages) => {
|
||||
this.set('model.pages', pages.filterBy('pageType', 'section'));
|
||||
this.set('model.tabs', pages.filterBy('pageType', 'tab'));
|
||||
|
||||
this.get('documentService').getPageMeta(this.get('model.document.id'), newPage.id).then(() => {
|
||||
this.transitionToRoute('document.edit',
|
||||
this.get('model.folder.id'),
|
||||
this.get('model.folder.slug'),
|
||||
this.get('model.document.id'),
|
||||
this.get('model.document.slug'),
|
||||
newPage.id);
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onDeleteBlock(blockId) {
|
||||
this.get('sectionService').deleteBlock(blockId).then(() => {
|
||||
this.audit.record("deleted-block");
|
||||
this.send("showNotification", "Deleted");
|
||||
this.transitionToRoute('document.index');
|
||||
});
|
||||
},
|
||||
|
||||
onDocumentDelete() {
|
||||
this.get('documentService').deleteDocument(this.get('model.document.id')).then(() => {
|
||||
this.audit.record("deleted-page");
|
||||
this.send("showNotification", "Deleted");
|
||||
this.transitionToRoute('folder', this.get('model.folder.id'), this.get('model.folder.slug'));
|
||||
});
|
||||
}
|
||||
|
||||
*/
|
||||
|
|
|
@ -175,7 +175,6 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
this.get('templateService').saveAsTemplate(this.get('model.document.id'), name, desc).then(function () {});
|
||||
},
|
||||
|
||||
// to test
|
||||
onPageSequenceChange(changes) {
|
||||
this.get('documentService').changePageSequence(this.get('model.document.id'), changes).then(() => {
|
||||
_.each(changes, (change) => {
|
||||
|
@ -193,7 +192,6 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
});
|
||||
},
|
||||
|
||||
// to test
|
||||
onPageLevelChange(changes) {
|
||||
this.get('documentService').changePageLevel(this.get('model.document.id'), changes).then(() => {
|
||||
_.each(changes, (change) => {
|
||||
|
@ -212,6 +210,11 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
this.set('model.pages', pages);
|
||||
this.get('target.router').refresh();
|
||||
});
|
||||
},
|
||||
|
||||
// tbd
|
||||
onGotoPage(id) {
|
||||
this.set('pageId', id);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<div id="sidebar-wrapper">
|
||||
{{document/sidebar-zone folders=model.folders folder=model.folder document=model.document
|
||||
pages=model.pages sections=model.section links=model.links isEditor=model.isEditor tab=tab
|
||||
onDocumentDelete=(action 'onDocumentDelete') onSaveTemplate=(action 'onSaveTemplate')}}
|
||||
onDocumentDelete=(action 'onDocumentDelete') onSaveTemplate=(action 'onSaveTemplate')
|
||||
onPageSequenceChange=(action 'onPageSequenceChange') onPageLevelChange=(action 'onPageLevelChange') onGotoPage=(action 'onGotoPage')}}
|
||||
</div>
|
||||
|
||||
<div id="page-content-wrapper">
|
||||
|
|
|
@ -17,7 +17,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
documentService: Ember.inject.service('document'),
|
||||
folderService: Ember.inject.service('folder'),
|
||||
linkService: Ember.inject.service('link'),
|
||||
|
||||
|
||||
beforeModel(transition) {
|
||||
this.set('pageId', is.not.undefined(transition.queryParams.page) ? transition.queryParams.page : "");
|
||||
this.set('folderId', this.paramsFor('document').folder_id);
|
||||
|
|
|
@ -16,7 +16,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
documentService: Ember.inject.service('document'),
|
||||
folderService: Ember.inject.service('folder'),
|
||||
userService: Ember.inject.service('user'),
|
||||
|
||||
|
||||
model(params) {
|
||||
return Ember.RSVP.hash({
|
||||
folders: this.modelFor('document').folders,
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
@import "inline-editor.scss";
|
||||
@import "layout.scss";
|
||||
@import "section-editor.scss";
|
||||
@import "sidebar-view-attachments.scss";
|
||||
@import "sidebar-view-activity.scss";
|
||||
@import "sidebar-view-attachments.scss";
|
||||
@import "sidebar-view-index.scss";
|
||||
@import "sidebar-zone.scss";
|
||||
@import "view.scss";
|
||||
@import "wysiwyg.scss";
|
||||
|
|
|
@ -83,62 +83,3 @@
|
|||
.delete-page-dialog {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// .document-structure {
|
||||
// > .toc-controls {
|
||||
// margin: 0;
|
||||
// color: $color-gray;
|
||||
|
||||
// > .round-button-mono {
|
||||
// color: $color-green;
|
||||
// border-color: $color-green;
|
||||
|
||||
// > .material-icons {
|
||||
// color: $color-green;
|
||||
// }
|
||||
// }
|
||||
|
||||
// > .disabled {
|
||||
// @extend .cursor-not-allowed;
|
||||
// color: $color-stroke;
|
||||
// border-color: $color-stroke;
|
||||
|
||||
// > .material-icons {
|
||||
// color: $color-stroke;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// .entries {
|
||||
// padding: 0;
|
||||
// list-style: none;
|
||||
// font-size: 13px;
|
||||
// overflow-x: hidden;
|
||||
// list-style-type: none;
|
||||
// margin: 20px 0 0;
|
||||
// font-family: $font-semibold;
|
||||
|
||||
// .item {
|
||||
// padding: 4px 0;
|
||||
// text-overflow: ellipsis;
|
||||
// word-wrap: break-word;
|
||||
// white-space: nowrap;
|
||||
// overflow: hidden;
|
||||
|
||||
// > .link {
|
||||
// color: $color-gray;
|
||||
|
||||
// &:hover {
|
||||
// color: $color-link;
|
||||
// }
|
||||
// }
|
||||
|
||||
// > .selected {
|
||||
// color: $color-link;
|
||||
// font-weight: bold;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
57
app/app/styles/view/document/sidebar-view-index.scss
Normal file
57
app/app/styles/view/document/sidebar-view-index.scss
Normal file
|
@ -0,0 +1,57 @@
|
|||
.document-sidebar-view-index {
|
||||
margin: 0;
|
||||
|
||||
>.structure {
|
||||
> .toc-controls {
|
||||
margin: 0;
|
||||
color: $color-gray;
|
||||
|
||||
> .round-button-mono {
|
||||
> .material-icons {
|
||||
color: $color-link;
|
||||
}
|
||||
}
|
||||
|
||||
> .disabled {
|
||||
@extend .cursor-not-allowed;
|
||||
color: $color-stroke;
|
||||
border-color: $color-stroke;
|
||||
|
||||
> .material-icons {
|
||||
color: $color-stroke;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> .index-list {
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
font-size: 13px;
|
||||
overflow-x: hidden;
|
||||
list-style-type: none;
|
||||
margin: 20px 0 0;
|
||||
font-family: $font-semibold;
|
||||
|
||||
.item {
|
||||
padding: 4px 0;
|
||||
text-overflow: ellipsis;
|
||||
word-wrap: break-word;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
|
||||
> .link {
|
||||
color: $color-gray;
|
||||
|
||||
&:hover {
|
||||
color: $color-link;
|
||||
}
|
||||
}
|
||||
|
||||
> .selected {
|
||||
color: $color-link;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
padding: 0;
|
||||
height: 25px;
|
||||
line-height: 0;
|
||||
margin-right: 5px;
|
||||
margin: 0 5px 10px 0;
|
||||
background-color: $color-chip;
|
||||
color: $color-chip-text;
|
||||
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
<div class="document-structure">
|
||||
{{#if this.session.authenticated}}
|
||||
{{#unless emptyState}}
|
||||
<div id="tocToolbar" class="hidden-xs hidden-sm toc-controls {{if state.actionablePage 'current-page' ''}}">
|
||||
<div id="toc-up-button" class="round-button-mono {{if state.upDisabled 'disabled'}}" data-tooltip="Move up" data-tooltip-position="top center" {{action 'pageUp'}}>
|
||||
<i class="material-icons">arrow_upward</i>
|
||||
</div>
|
||||
<div class="button-gap" />
|
||||
<div id="toc-down-button" class="round-button-mono {{if state.downDisabled 'disabled'}}" data-tooltip="Move down" data-tooltip-position="top center" {{action 'pageDown'}}>
|
||||
<i class="material-icons">arrow_downward</i>
|
||||
</div>
|
||||
<div class="button-gap" />
|
||||
<div id="toc-outdent-button" class="round-button-mono {{if state.outdentDisabled 'disabled'}}" data-tooltip="Outdent" data-tooltip-position="top center" {{action 'pageOutdent'}}>
|
||||
<i class="material-icons">format_indent_decrease</i>
|
||||
</div>
|
||||
<div class="button-gap" />
|
||||
<div id="toc-indent-button" class="round-button-mono {{if state.indentDisabled 'disabled'}}" data-tooltip="Indent" data-tooltip-position="top center" {{action 'pageIndent'}}>
|
||||
<i class="material-icons">format_indent_increase</i>
|
||||
</div>
|
||||
</div>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
|
||||
<ul id="document-index" class="entries">
|
||||
{{#each pages key="id" as |entry index|}}
|
||||
{{document/index-entry page=entry onClick=(action 'onEntryClick')}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
|
@ -1,31 +0,0 @@
|
|||
<div class="document-sidebar">
|
||||
{{back-to-space folder=folder}}
|
||||
<div class="margin-top-40" />
|
||||
|
||||
{{#if isEditor}}
|
||||
<div {{action 'showSections'}} id="section-tool" class="round-button round-button-mono button-white section-tool" data-tooltip="Content" data-tooltip-position="top center">
|
||||
<i class="material-icons color-green">add</i>
|
||||
</div>
|
||||
{{#if showingSections}}
|
||||
<div {{action 'onCancel'}} id="cancel-tool" class="round-button round-button-mono button-white section-tool">
|
||||
<i class="material-icons color-gray">close</i>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{#if showScrollTool}}
|
||||
<div {{action 'scrollTop'}} id="scroll-tool" class="round-button round-button-mono button-white scroll-tool" data-tooltip="Back to top" data-tooltip-position="top center">
|
||||
<i class="material-icons color-gray">vertical_align_top</i>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if showToc}}
|
||||
{{document/document-sidebar-toc document=document folder=folder pages=pages page=page isEditor=isEditor
|
||||
changePageSequence=(action 'onPageSequenceChange') changePageLevel=(action 'onPageLevelChange')
|
||||
gotoPage=(action 'gotoPage')}}
|
||||
{{/if}}
|
||||
{{#if showSections}}
|
||||
{{document/page-wizard display='section' document=document folder=folder sections=sections blocks=blocks
|
||||
onCancel=(action 'onCancel') onAddSection=(action 'onAddSection') onInsertBlock=(action 'onInsertBlock') onDeleteBlock=(action 'onDeleteBlock')}}
|
||||
{{/if}}
|
||||
</div>
|
34
app/app/templates/components/document/sidebar-view-index.hbs
Normal file
34
app/app/templates/components/document/sidebar-view-index.hbs
Normal file
|
@ -0,0 +1,34 @@
|
|||
<div class="document-sidebar-panel">
|
||||
<div class="title">Index</div>
|
||||
<div class="document-sidebar-view-index">
|
||||
<div class="structure">
|
||||
{{#if this.session.authenticated}}
|
||||
{{#unless emptyState}}
|
||||
<div id="tocToolbar" class="hidden-xs hidden-sm toc-controls {{if state.actionablePage 'current-page' ''}}">
|
||||
<div id="toc-up-button" class="round-button-mono {{if state.upDisabled 'disabled'}}" data-tooltip="Move up" data-tooltip-position="top center" {{action 'pageUp'}}>
|
||||
<i class="material-icons">arrow_upward</i>
|
||||
</div>
|
||||
<div class="button-gap" />
|
||||
<div id="toc-down-button" class="round-button-mono {{if state.downDisabled 'disabled'}}" data-tooltip="Move down" data-tooltip-position="top center" {{action 'pageDown'}}>
|
||||
<i class="material-icons">arrow_downward</i>
|
||||
</div>
|
||||
<div class="button-gap" />
|
||||
<div id="toc-outdent-button" class="round-button-mono {{if state.outdentDisabled 'disabled'}}" data-tooltip="Outdent" data-tooltip-position="top center" {{action 'pageOutdent'}}>
|
||||
<i class="material-icons">format_indent_decrease</i>
|
||||
</div>
|
||||
<div class="button-gap" />
|
||||
<div id="toc-indent-button" class="round-button-mono {{if state.indentDisabled 'disabled'}}" data-tooltip="Indent" data-tooltip-position="top center" {{action 'pageIndent'}}>
|
||||
<i class="material-icons">format_indent_increase</i>
|
||||
</div>
|
||||
</div>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
|
||||
<ul class="index-list">
|
||||
{{#each pages key="id" as |p index|}}
|
||||
{{document/index-entry page=p index=index onClick=(action 'onEntryClick')}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -36,6 +36,11 @@
|
|||
</div>
|
||||
|
||||
<div class="document-sidebar-wrapper">
|
||||
{{#if (is-equal tab 'index')}}
|
||||
{{document/sidebar-view-index document=document folder=folder pages=pages page=page isEditor=isEditor
|
||||
onPageSequenceChange=(action 'onPageSequenceChange') onPageLevelChange=(action 'onPageLevelChange') onGotoPage=(action 'onGotoPage')}}
|
||||
{{/if}}
|
||||
|
||||
{{#if (is-equal tab 'attachments')}}
|
||||
{{document/sidebar-view-attachments document=document isEditor=isEditor}}
|
||||
{{/if}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue