From 44ad9da1d7ef8b8dc4a43d9d87d09c0611686997 Mon Sep 17 00:00:00 2001 From: Harvey Kandola Date: Tue, 21 Jun 2016 16:33:53 -0700 Subject: [PATCH 1/6] document name separated from document first page, moved attachments and tags --- app/app/styles/view/document/content.scss | 1 - app/app/styles/widget/widget-tooltip.scss | 2 +- .../components/document/document-toolbar.hbs | 9 +++- .../components/document/document-view.hbs | 52 +++++++++---------- documize/api/endpoint/router.go | 2 +- documize/api/entity/objects.go | 16 +++++- documize/api/request/page.go | 50 +++++++++--------- 7 files changed, 73 insertions(+), 59 deletions(-) diff --git a/app/app/styles/view/document/content.scss b/app/app/styles/view/document/content.scss index b6491edb..c9474bb0 100644 --- a/app/app/styles/view/document/content.scss +++ b/app/app/styles/view/document/content.scss @@ -54,7 +54,6 @@ } .document-tags { - margin: 10px 0; } .is-template { diff --git a/app/app/styles/widget/widget-tooltip.scss b/app/app/styles/widget/widget-tooltip.scss index 54b83a02..c53e7b93 100644 --- a/app/app/styles/widget/widget-tooltip.scss +++ b/app/app/styles/widget/widget-tooltip.scss @@ -27,7 +27,7 @@ color: $color-white; padding: 0.5em; font-size: 0.8em; - line-height: 1.0em; + line-height: 1.1em; &:before { content: ""; display: block; diff --git a/app/app/templates/components/document/document-toolbar.hbs b/app/app/templates/components/document/document-toolbar.hbs index 5ae70459..36c65ca5 100644 --- a/app/app/templates/components/document/document-toolbar.hbs +++ b/app/app/templates/components/document/document-toolbar.hbs @@ -48,7 +48,7 @@ content_copy
-
+
person
@@ -69,7 +69,7 @@
{{/dropdown-dialog}} - {{#dropdown-dialog target="set-meta-button" position="bottom right" button="Save" color="flat-blue" onAction=(action 'saveMeta') selectOn="meta-excerpt"}} + {{#dropdown-dialog target="set-meta-button" position="bottom right" button="Save" color="flat-blue" onAction=(action 'saveMeta') selectOn="document-name"}}
@@ -81,6 +81,11 @@ optionLabelPath="fullname" selection=owner}}
+
+ +
Short title for this document
+ {{input type='text' id="document-name" value=document.name}} +
Provide short summary of the document (max. 250)
diff --git a/app/app/templates/components/document/document-view.hbs b/app/app/templates/components/document/document-view.hbs index abd9a602..9c97f7f8 100644 --- a/app/app/templates/components/document/document-view.hbs +++ b/app/app/templates/components/document/document-view.hbs @@ -1,5 +1,29 @@
+
+ {{document/tag-editor documentTags=document.tags isEditor=isEditor onChange=(action 'onTagChange')}} +
+ + {{#if attachments}} +
+
    + {{#each attachments key="id" as |a index|}} +
  • + + + {{ a.filename }} + + {{#if isEditor}} +
    + delete +
    + {{/if}} +
  • + {{/each}} +
+
+ {{/if}} +
{{#each pages key="id" as |page index|}}
@@ -11,32 +35,6 @@ {{#if document.template}}
TEMPLATE
{{/if}} - -
- - {{document/tag-editor documentTags=document.tags isEditor=isEditor onChange=(action 'onTagChange')}} - - {{#if attachments}} -
-
    - {{#each attachments key="id" as |a index|}} -
  • - - - {{ a.filename }} - - {{#if isEditor}} -
    - delete -
    - {{/if}} -
  • - {{/each}} -
-
- {{/if}} - -
{{/if}} {{section/base-renderer page=page}}
@@ -86,7 +84,7 @@
add
section
-
+
Add a new section to this document
diff --git a/documize/api/endpoint/router.go b/documize/api/endpoint/router.go index 75dbff99..9bb4d255 100644 --- a/documize/api/endpoint/router.go +++ b/documize/api/endpoint/router.go @@ -30,7 +30,7 @@ const ( // AppVersion does what it says // Versioning scheme major.minor where "minor" is optional // e.g. 1, 2, 3, 4.1, 4.2, 5, 6, 7, 7.1, 8, 9, 10, ..... 127, 127.1, 128 - AppVersion = "12.6" + AppVersion = "12.7" ) var port, certFile, keyFile, forcePort2SSL string diff --git a/documize/api/entity/objects.go b/documize/api/entity/objects.go index eafd70ca..ee8622eb 100644 --- a/documize/api/entity/objects.go +++ b/documize/api/entity/objects.go @@ -1,11 +1,11 @@ // Copyright 2016 Documize Inc. . All rights reserved. // -// This software (Documize Community Edition) is licensed under +// 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 . +// by contacting . // // https://documize.com @@ -14,6 +14,7 @@ package entity import ( "fmt" + "strings" "time" ) @@ -152,6 +153,15 @@ type Document struct { Template bool `json:"template"` } +// SetDefaults ensures on blanks and cleans. +func (d *Document) SetDefaults() { + d.Title = strings.TrimSpace(d.Title) + + if len(d.Title) == 0 { + d.Title = "Document" + } +} + // Attachment represents an attachment to a document. type Attachment struct { BaseEntity @@ -183,6 +193,8 @@ func (p *Page) SetDefaults() { if len(p.ContentType) == 0 { p.ContentType = "wysiwyg" } + + p.Title = strings.TrimSpace(p.Title) } // PageMeta holds raw page data that is used to diff --git a/documize/api/request/page.go b/documize/api/request/page.go index d0fac70a..5f327de7 100644 --- a/documize/api/request/page.go +++ b/documize/api/request/page.go @@ -1,11 +1,11 @@ // Copyright 2016 Documize Inc. . All rights reserved. // -// This software (Documize Community Edition) is licensed under +// 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 . +// by contacting . // // https://documize.com @@ -255,35 +255,35 @@ func (p *Persister) UpdatePage(page entity.Page, refID, userID string, skipRevis } } - if page.Level == 1 { // may need to update the document name - var doc entity.Document + //if page.Level == 1 { // may need to update the document name + //var doc entity.Document - stmt4, err := p.Context.Transaction.Preparex("SELECT id, refid, orgid, labelid, job, location, title, excerpt, slug, tags, template, created, revised FROM document WHERE refid=?") - defer utility.Close(stmt4) + //stmt4, err := p.Context.Transaction.Preparex("SELECT id, refid, orgid, labelid, job, location, title, excerpt, slug, tags, template, created, revised FROM document WHERE refid=?") + //defer utility.Close(stmt4) - if err != nil { - log.Error(fmt.Sprintf("Unable to prepare pagemanager doc query for Id %s", page.DocumentID), err) - return err - } + //if err != nil { + //log.Error(fmt.Sprintf("Unable to prepare pagemanager doc query for Id %s", page.DocumentID), err) + //return err + //} - err = stmt4.Get(&doc, page.DocumentID) + //err = stmt4.Get(&doc, page.DocumentID) - if err != nil { - log.Error(fmt.Sprintf("Unable to execute pagemanager document query for Id %s", page.DocumentID), err) - return err - } + //if err != nil { + //log.Error(fmt.Sprintf("Unable to execute pagemanager document query for Id %s", page.DocumentID), err) + //return err + //} - if doc.Title != page.Title { - doc.Title = page.Title - doc.Revised = page.Revised - err = p.UpdateDocument(doc) + //if doc.Title != page.Title { + //doc.Title = page.Title + //doc.Revised = page.Revised + //err = p.UpdateDocument(doc) - if err != nil { - log.Error(fmt.Sprintf("Unable to update document when page 1 altered DocumentId %s", page.DocumentID), err) - return err - } - } - } + //if err != nil { + //log.Error(fmt.Sprintf("Unable to update document when page 1 altered DocumentId %s", page.DocumentID), err) + //return err + //} + //} + //} p.Base.Audit(p.Context, "update-page", page.DocumentID, page.RefID) From fd494b53c8ff5378a6f572e170e38532329b6912 Mon Sep 17 00:00:00 2001 From: Harvey Kandola Date: Tue, 21 Jun 2016 21:01:19 -0700 Subject: [PATCH 2/6] allow for documents with NO SECTIONS this is by design! --- app/app/components/document/document-view.js | 4 ++-- documize/api/endpoint/page_endpoint.go | 5 ++--- documize/api/endpoint/templates_endpoint.go | 21 ++++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/app/components/document/document-view.js b/app/app/components/document/document-view.js index 00fe3abc..084458e5 100644 --- a/app/app/components/document/document-view.js +++ b/app/app/components/document/document-view.js @@ -36,7 +36,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, { }, noSections: Ember.computed('pages', function() { - return this.get('pages.length') === 1; + return this.get('pages.length') === 0; }), didInsertElement() { @@ -159,4 +159,4 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, { this.get('documentService').save(doc); } } -}); \ No newline at end of file +}); diff --git a/documize/api/endpoint/page_endpoint.go b/documize/api/endpoint/page_endpoint.go index 672e513e..14c83ed6 100644 --- a/documize/api/endpoint/page_endpoint.go +++ b/documize/api/endpoint/page_endpoint.go @@ -200,9 +200,8 @@ func GetDocumentPages(w http.ResponseWriter, r *http.Request) { pages, err = p.GetPages(documentID) } - if err == sql.ErrNoRows { - writeNotFoundError(w, method, documentID) - return + if len(pages) == 0 { + pages = []entity.Page{} } if err != nil { diff --git a/documize/api/endpoint/templates_endpoint.go b/documize/api/endpoint/templates_endpoint.go index 9ef80c04..78c6b05b 100644 --- a/documize/api/endpoint/templates_endpoint.go +++ b/documize/api/endpoint/templates_endpoint.go @@ -1,11 +1,11 @@ // Copyright 2016 Documize Inc. . All rights reserved. // -// This software (Documize Community Edition) is licensed under +// 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 . +// by contacting . // // https://documize.com @@ -181,21 +181,22 @@ func StartDocumentFromSavedTemplate(w http.ResponseWriter, r *http.Request) { // Define an empty document just in case user wanted one. var err error var d = entity.Document{} - d.Title = "Empty Document" + d.Title = "New Document" d.Location = fmt.Sprintf("template-%s", templateID) - d.Excerpt = "Created from template" + d.Excerpt = "A new document" d.Slug = utility.MakeSlug(d.Title) d.Tags = "" d.LabelID = folderID documentID := util.UniqueID() d.RefID = documentID - var pages = make([]entity.Page, 1, 1) - pages[0] = entity.Page{} - pages[0].Title = "Heading" - pages[0].Body = "

Some content here.

" - pages[0].Level = 1 - pages[0].Sequence = 1 + var pages = []entity.Page{} + //var pages = make([]entity.Page, 1, 1) + //pages[0] = entity.Page{} + //pages[0].Title = "Heading" + //pages[0].Body = "

Some content here.

" + //pages[0].Level = 1 + //pages[0].Sequence = 1 var attachments = []entity.Attachment{} From db23dc819169e1bcc879ae1f4929ec504c200b97 Mon Sep 17 00:00:00 2001 From: Harvey Kandola Date: Tue, 21 Jun 2016 21:06:22 -0700 Subject: [PATCH 3/6] document has back button to return to folder --- .../templates/components/document/document-toolbar.hbs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/app/templates/components/document/document-toolbar.hbs b/app/app/templates/components/document/document-toolbar.hbs index 36c65ca5..ac815f9e 100644 --- a/app/app/templates/components/document/document-toolbar.hbs +++ b/app/app/templates/components/document/document-toolbar.hbs @@ -38,6 +38,14 @@ {{/if}}