mirror of
https://github.com/documize/community.git
synced 2025-07-28 09:39:42 +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) {
|
onAddSection(section) {
|
||||||
|
this.send('showToc');
|
||||||
this.attrs.onAddSection(section);
|
this.attrs.onAddSection(section);
|
||||||
|
|
||||||
this.set('showingSections', false);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
scrollTop() {
|
scrollTop() {
|
||||||
|
|
|
@ -53,6 +53,56 @@ export default Ember.Controller.extend(NotifierMixin, {
|
||||||
this.scrollToPage(pageId);
|
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) {
|
onPageDeleted(deletePage) {
|
||||||
let self = this;
|
let self = this;
|
||||||
let documentId = this.get('model.id');
|
let documentId = this.get('model.id');
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-template {
|
.is-template {
|
||||||
color: $color-gray;
|
color: $color-goldy;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
padding-bottom: 5px;
|
padding-bottom: 5px;
|
||||||
@include border-bottom(1px);
|
border-bottom: 1px dotted $color-goldy;
|
||||||
}
|
}
|
||||||
|
|
||||||
> .pages {
|
> .pages {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<div class="document-view">
|
<div class="document-view">
|
||||||
<div class="wysiwyg">
|
|
||||||
<h1 class="doc-name">{{document.name}}</h1>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{#if document.template}}
|
{{#if document.template}}
|
||||||
<div class="is-template">TEMPLATE</div>
|
<div class="is-template">TEMPLATE</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
<div class="wysiwyg">
|
||||||
|
<h1 class="doc-name">{{document.name}}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{document/tag-editor documentTags=document.tags isEditor=isEditor onChange=(action 'onTagChange')}}
|
{{document/tag-editor documentTags=document.tags isEditor=isEditor onChange=(action 'onTagChange')}}
|
||||||
|
|
||||||
<div class="print-title">
|
<div class="print-title">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue