mirror of
https://github.com/documize/community.git
synced 2025-07-24 23:59:47 +02:00
document template
This commit is contained in:
parent
9fe115a9bd
commit
876287bc11
4 changed files with 57 additions and 8 deletions
|
@ -89,9 +89,8 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
|
|||
},
|
||||
|
||||
onAddSection(section) {
|
||||
this.send('showToc');
|
||||
this.attrs.onAddSection(section);
|
||||
|
||||
this.set('showingSections', false);
|
||||
},
|
||||
|
||||
scrollTop() {
|
||||
|
|
|
@ -53,6 +53,56 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
this.scrollToPage(pageId);
|
||||
},
|
||||
|
||||
onPageSequenceChange(changes) {
|
||||
let self = this;
|
||||
|
||||
this.get('documentService').changePageSequence(this.model.get('id'), changes).then(function () {
|
||||
_.each(changes, function (change) {
|
||||
let pageContent = _.findWhere(self.get('pages'), {
|
||||
id: change.pageId
|
||||
});
|
||||
|
||||
if (is.not.undefined(pageContent)) {
|
||||
pageContent.set('sequence', change.sequence);
|
||||
}
|
||||
});
|
||||
|
||||
self.set('pages', self.get('pages').sortBy('sequence'));
|
||||
});
|
||||
},
|
||||
|
||||
onPageLevelChange(changes) {
|
||||
let self = this;
|
||||
|
||||
this.get('documentService').changePageLevel(this.model.get('id'), changes).then(function () {
|
||||
_.each(changes, function (change) {
|
||||
let pageContent = _.findWhere(self.get('pages'), {
|
||||
id: change.pageId
|
||||
});
|
||||
|
||||
if (is.not.undefined(pageContent)) {
|
||||
pageContent.set('level', change.level);
|
||||
}
|
||||
});
|
||||
|
||||
let pages = self.get('pages');
|
||||
pages = pages.sortBy('sequence');
|
||||
self.set('pages', []);
|
||||
self.set('pages', pages);
|
||||
});
|
||||
},
|
||||
|
||||
// onSaveTemplate(name, desc) {
|
||||
// this.get('templateService').saveAsTemplate(this.model.get('id'), name, desc).then(function () {});
|
||||
// },
|
||||
//
|
||||
// onDocumentChange(doc) {
|
||||
// let self = this;
|
||||
// this.get('documentService').save(doc).then(function () {
|
||||
// self.set('model', doc);
|
||||
// });
|
||||
// },
|
||||
|
||||
onPageDeleted(deletePage) {
|
||||
let self = this;
|
||||
let documentId = this.get('model.id');
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
}
|
||||
|
||||
.is-template {
|
||||
color: $color-gray;
|
||||
color: $color-goldy;
|
||||
font-weight: bold;
|
||||
font-size: 1.5em;
|
||||
margin-bottom: 30px;
|
||||
padding-bottom: 5px;
|
||||
@include border-bottom(1px);
|
||||
border-bottom: 1px dotted $color-goldy;
|
||||
}
|
||||
|
||||
> .pages {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<div class="document-view">
|
||||
<div class="wysiwyg">
|
||||
<h1 class="doc-name">{{document.name}}</h1>
|
||||
</div>
|
||||
|
||||
{{#if document.template}}
|
||||
<div class="is-template">TEMPLATE</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="wysiwyg">
|
||||
<h1 class="doc-name">{{document.name}}</h1>
|
||||
</div>
|
||||
|
||||
{{document/tag-editor documentTags=document.tags isEditor=isEditor onChange=(action 'onTagChange')}}
|
||||
|
||||
<div class="print-title">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue