mirror of
https://github.com/documize/community.git
synced 2025-08-09 15:35:27 +02:00
allow for documents with NO SECTIONS
this is by design!
This commit is contained in:
parent
44ad9da1d7
commit
fd494b53c8
3 changed files with 15 additions and 15 deletions
|
@ -36,7 +36,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
||||||
},
|
},
|
||||||
|
|
||||||
noSections: Ember.computed('pages', function() {
|
noSections: Ember.computed('pages', function() {
|
||||||
return this.get('pages.length') === 1;
|
return this.get('pages.length') === 0;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
|
|
@ -200,9 +200,8 @@ func GetDocumentPages(w http.ResponseWriter, r *http.Request) {
|
||||||
pages, err = p.GetPages(documentID)
|
pages, err = p.GetPages(documentID)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == sql.ErrNoRows {
|
if len(pages) == 0 {
|
||||||
writeNotFoundError(w, method, documentID)
|
pages = []entity.Page{}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -181,21 +181,22 @@ func StartDocumentFromSavedTemplate(w http.ResponseWriter, r *http.Request) {
|
||||||
// Define an empty document just in case user wanted one.
|
// Define an empty document just in case user wanted one.
|
||||||
var err error
|
var err error
|
||||||
var d = entity.Document{}
|
var d = entity.Document{}
|
||||||
d.Title = "Empty Document"
|
d.Title = "New Document"
|
||||||
d.Location = fmt.Sprintf("template-%s", templateID)
|
d.Location = fmt.Sprintf("template-%s", templateID)
|
||||||
d.Excerpt = "Created from template"
|
d.Excerpt = "A new document"
|
||||||
d.Slug = utility.MakeSlug(d.Title)
|
d.Slug = utility.MakeSlug(d.Title)
|
||||||
d.Tags = ""
|
d.Tags = ""
|
||||||
d.LabelID = folderID
|
d.LabelID = folderID
|
||||||
documentID := util.UniqueID()
|
documentID := util.UniqueID()
|
||||||
d.RefID = documentID
|
d.RefID = documentID
|
||||||
|
|
||||||
var pages = make([]entity.Page, 1, 1)
|
var pages = []entity.Page{}
|
||||||
pages[0] = entity.Page{}
|
//var pages = make([]entity.Page, 1, 1)
|
||||||
pages[0].Title = "Heading"
|
//pages[0] = entity.Page{}
|
||||||
pages[0].Body = "<p>Some content here.</p>"
|
//pages[0].Title = "Heading"
|
||||||
pages[0].Level = 1
|
//pages[0].Body = "<p>Some content here.</p>"
|
||||||
pages[0].Sequence = 1
|
//pages[0].Level = 1
|
||||||
|
//pages[0].Sequence = 1
|
||||||
|
|
||||||
var attachments = []entity.Attachment{}
|
var attachments = []entity.Attachment{}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue