mirror of
https://github.com/documize/community.git
synced 2025-07-22 06:39:43 +02:00
document.layout, print.css, content-linker
This commit is contained in:
parent
f24eb5ad42
commit
0539bb332a
10 changed files with 38 additions and 51 deletions
|
@ -114,7 +114,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
||||||
let level = 1;
|
let level = 1;
|
||||||
let beforePage = this.get('beforePage');
|
let beforePage = this.get('beforePage');
|
||||||
|
|
||||||
|
|
||||||
if (is.not.null(beforePage)) {
|
if (is.not.null(beforePage)) {
|
||||||
level = beforePage.get('level');
|
level = beforePage.get('level');
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ export default Model.extend({
|
||||||
userId: attr('string'),
|
userId: attr('string'),
|
||||||
tags: attr('string'),
|
tags: attr('string'),
|
||||||
template: attr('boolean'),
|
template: attr('boolean'),
|
||||||
layout: attr('string'),
|
|
||||||
|
|
||||||
// client-side property
|
// client-side property
|
||||||
selected: attr('boolean', { defaultValue: false }),
|
selected: attr('boolean', { defaultValue: false }),
|
||||||
|
|
|
@ -112,21 +112,13 @@ export default Ember.Service.extend({
|
||||||
let documentSlug = is.null(targetDocument) ? "d" : targetDocument.get('slug');
|
let documentSlug = is.null(targetDocument) ? "d" : targetDocument.get('slug');
|
||||||
|
|
||||||
// handle section link
|
// handle section link
|
||||||
if (link.linkType === "section") {
|
if (link.linkType === "section" || link.linkType === "tab") {
|
||||||
let options = {};
|
let options = {};
|
||||||
options['page'] = link.targetId;
|
options['pageId'] = link.targetId;
|
||||||
router.transitionTo('document', link.folderId, folderSlug, link.documentId, documentSlug, { queryParams: options });
|
router.transitionTo('document', link.folderId, folderSlug, link.documentId, documentSlug, { queryParams: options });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle tab link
|
|
||||||
if (link.linkType === "tab") {
|
|
||||||
let options = {};
|
|
||||||
options['mode'] = 'view';
|
|
||||||
router.transitionTo('document.section', link.targetId, { queryParams: options });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle document link
|
// handle document link
|
||||||
if (link.linkType === "document") {
|
if (link.linkType === "document") {
|
||||||
router.transitionTo('document', link.folderId, folderSlug, link.documentId, documentSlug);
|
router.transitionTo('document', link.folderId, folderSlug, link.documentId, documentSlug);
|
||||||
|
|
|
@ -11,31 +11,30 @@
|
||||||
@media print {
|
@media print {
|
||||||
.non-printable,
|
.non-printable,
|
||||||
.zone-navigation,
|
.zone-navigation,
|
||||||
.zone-sidebar {
|
.zone-sidebar,
|
||||||
|
#sidebar-wrapper,
|
||||||
|
.document-heading,
|
||||||
|
.edit-document-heading,
|
||||||
|
#sidebar-toggle,
|
||||||
|
.back-to-space,
|
||||||
|
.start-section,
|
||||||
|
.new-section-wizard {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zone-content {
|
#page-content-wrapper, #wrapper {
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
}
|
margin: 0 !important;
|
||||||
|
|
||||||
.document-view {
|
|
||||||
.attachment-zone,
|
|
||||||
.document-summary,
|
|
||||||
.document-tags,
|
|
||||||
.page-toolbar {
|
|
||||||
display: none !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.non-printable-message,
|
.non-printable-message,
|
||||||
.print-title {
|
.print-title {
|
||||||
display: block !important;
|
display: block !important;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.doc-layout {
|
.is-a-tab, .is-a-page {
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
box-shadow: none !important;
|
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
|
box-shadow: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@
|
||||||
padding: 0px 50px;
|
padding: 0px 50px;
|
||||||
height: 65px;
|
height: 65px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
cursor: normal;
|
cursor: default;
|
||||||
|
|
||||||
.page-title {
|
.page-title {
|
||||||
> .page-toolbar {
|
> .page-toolbar {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{#unless editMode}}
|
{{#unless editMode}}
|
||||||
<div class="{{if isEditor 'cursor-pointer'}}" onclick={{if isEditor (action 'toggleEdit')}}>
|
<div class="document-heading {{if isEditor 'cursor-pointer'}}" onclick={{if isEditor (action 'toggleEdit')}}>
|
||||||
<h1 class="doc-title">{{document.name}}</h1>
|
<h1 class="doc-title">{{document.name}}</h1>
|
||||||
<div class="doc-excerpt">{{document.excerpt}}</div>
|
<div class="doc-excerpt">{{document.excerpt}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -340,7 +340,6 @@ func StartDocumentFromSavedTemplate(w http.ResponseWriter, r *http.Request) {
|
||||||
d.Excerpt = "A new document"
|
d.Excerpt = "A new document"
|
||||||
d.Slug = utility.MakeSlug(d.Title)
|
d.Slug = utility.MakeSlug(d.Title)
|
||||||
d.Tags = ""
|
d.Tags = ""
|
||||||
d.Layout = "doc"
|
|
||||||
d.LabelID = folderID
|
d.LabelID = folderID
|
||||||
documentID := util.UniqueID()
|
documentID := util.UniqueID()
|
||||||
d.RefID = documentID
|
d.RefID = documentID
|
||||||
|
|
|
@ -153,7 +153,6 @@ type Document struct {
|
||||||
Slug string `json:"-"`
|
Slug string `json:"-"`
|
||||||
Tags string `json:"tags"`
|
Tags string `json:"tags"`
|
||||||
Template bool `json:"template"`
|
Template bool `json:"template"`
|
||||||
Layout string `json:"layout"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetDefaults ensures on blanks and cleans.
|
// SetDefaults ensures on blanks and cleans.
|
||||||
|
@ -163,8 +162,6 @@ func (d *Document) SetDefaults() {
|
||||||
if len(d.Title) == 0 {
|
if len(d.Title) == 0 {
|
||||||
d.Title = "Document"
|
d.Title = "Document"
|
||||||
}
|
}
|
||||||
|
|
||||||
d.Layout = "doc"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attachment represents an attachment to a document.
|
// Attachment represents an attachment to a document.
|
||||||
|
|
|
@ -28,11 +28,8 @@ func (p *Persister) AddDocument(document entity.Document) (err error) {
|
||||||
document.OrgID = p.Context.OrgID
|
document.OrgID = p.Context.OrgID
|
||||||
document.Created = time.Now().UTC()
|
document.Created = time.Now().UTC()
|
||||||
document.Revised = document.Created // put same time in both fields
|
document.Revised = document.Created // put same time in both fields
|
||||||
if document.Layout == "" {
|
|
||||||
document.Layout = "doc"
|
|
||||||
}
|
|
||||||
|
|
||||||
stmt, err := p.Context.Transaction.Preparex("INSERT INTO document (refid, orgid, labelid, userid, job, location, title, excerpt, slug, tags, template, layout, created, revised) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
|
stmt, err := p.Context.Transaction.Preparex("INSERT INTO document (refid, orgid, labelid, userid, job, location, title, excerpt, slug, tags, template, created, revised) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
|
||||||
defer utility.Close(stmt)
|
defer utility.Close(stmt)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -40,7 +37,7 @@ func (p *Persister) AddDocument(document entity.Document) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = stmt.Exec(document.RefID, document.OrgID, document.LabelID, document.UserID, document.Job, document.Location, document.Title, document.Excerpt, document.Slug, document.Tags, document.Template, document.Layout, document.Created, document.Revised)
|
_, err = stmt.Exec(document.RefID, document.OrgID, document.LabelID, document.UserID, document.Job, document.Location, document.Title, document.Excerpt, document.Slug, document.Tags, document.Template, document.Created, document.Revised)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to execute insert for document", err)
|
log.Error("Unable to execute insert for document", err)
|
||||||
|
@ -52,7 +49,7 @@ func (p *Persister) AddDocument(document entity.Document) (err error) {
|
||||||
|
|
||||||
// GetDocument fetches the document record with the given id fromt the document table and audits that it has been got.
|
// GetDocument fetches the document record with the given id fromt the document table and audits that it has been got.
|
||||||
func (p *Persister) GetDocument(id string) (document entity.Document, err error) {
|
func (p *Persister) GetDocument(id string) (document entity.Document, err error) {
|
||||||
stmt, err := Db.Preparex("SELECT id, refid, orgid, labelid, userid, job, location, title, excerpt, slug, tags, template, layout, created, revised FROM document WHERE orgid=? and refid=?")
|
stmt, err := Db.Preparex("SELECT id, refid, orgid, labelid, userid, job, location, title, excerpt, slug, tags, template, created, revised FROM document WHERE orgid=? and refid=?")
|
||||||
defer utility.Close(stmt)
|
defer utility.Close(stmt)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -111,7 +108,7 @@ func (p *Persister) GetDocumentMeta(id string) (meta entity.DocumentMeta, err er
|
||||||
|
|
||||||
// GetDocuments returns a slice containg all of the the documents for the client's organisation, with the most recient first.
|
// GetDocuments returns a slice containg all of the the documents for the client's organisation, with the most recient first.
|
||||||
func (p *Persister) GetDocuments() (documents []entity.Document, err error) {
|
func (p *Persister) GetDocuments() (documents []entity.Document, err error) {
|
||||||
err = Db.Select(&documents, "SELECT id, refid, orgid, labelid, userid, job, location, title, excerpt, slug, tags, template, layout, created, revised FROM document WHERE orgid=? AND template=0 ORDER BY revised DESC", p.Context.OrgID)
|
err = Db.Select(&documents, "SELECT id, refid, orgid, labelid, userid, job, location, title, excerpt, slug, tags, template, created, revised FROM document WHERE orgid=? AND template=0 ORDER BY revised DESC", p.Context.OrgID)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(fmt.Sprintf("Unable to execute select documents for org %s", p.Context.OrgID), err)
|
log.Error(fmt.Sprintf("Unable to execute select documents for org %s", p.Context.OrgID), err)
|
||||||
|
@ -123,7 +120,7 @@ func (p *Persister) GetDocuments() (documents []entity.Document, err error) {
|
||||||
|
|
||||||
// GetDocumentsByFolder returns a slice containing the documents for a given folder, most recient first.
|
// GetDocumentsByFolder returns a slice containing the documents for a given folder, most recient first.
|
||||||
func (p *Persister) GetDocumentsByFolder(folderID string) (documents []entity.Document, err error) {
|
func (p *Persister) GetDocumentsByFolder(folderID string) (documents []entity.Document, err error) {
|
||||||
err = Db.Select(&documents, "SELECT id, refid, orgid, labelid, userid, job, location, title, excerpt, slug, tags, template, layout, created, revised FROM document WHERE orgid=? AND template=0 AND labelid=? ORDER BY revised DESC", p.Context.OrgID, folderID)
|
err = Db.Select(&documents, "SELECT id, refid, orgid, labelid, userid, job, location, title, excerpt, slug, tags, template, created, revised FROM document WHERE orgid=? AND template=0 AND labelid=? ORDER BY revised DESC", p.Context.OrgID, folderID)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(fmt.Sprintf("Unable to execute select documents for org %s", p.Context.OrgID), err)
|
log.Error(fmt.Sprintf("Unable to execute select documents for org %s", p.Context.OrgID), err)
|
||||||
|
@ -139,7 +136,7 @@ func (p *Persister) GetDocumentsByTag(tag string) (documents []entity.Document,
|
||||||
tagQuery := "tags LIKE '%#" + tag + "#%'"
|
tagQuery := "tags LIKE '%#" + tag + "#%'"
|
||||||
|
|
||||||
err = Db.Select(&documents,
|
err = Db.Select(&documents,
|
||||||
`SELECT id, refid, orgid, labelid, userid, job, location, title, excerpt, slug, tags, template, layout, created, revised FROM document WHERE orgid=? AND template=0 AND `+tagQuery+` AND labelid IN
|
`SELECT id, refid, orgid, labelid, userid, job, location, title, excerpt, slug, tags, template, created, revised FROM document WHERE orgid=? AND template=0 AND `+tagQuery+` AND labelid IN
|
||||||
(SELECT refid from label WHERE orgid=? AND type=2 AND userid=?
|
(SELECT refid from label WHERE orgid=? AND type=2 AND userid=?
|
||||||
UNION ALL SELECT refid FROM label a where orgid=? AND type=1 AND refid IN (SELECT labelid from labelrole WHERE orgid=? AND userid='' AND (canedit=1 OR canview=1))
|
UNION ALL SELECT refid FROM label a where orgid=? AND type=1 AND refid IN (SELECT labelid from labelrole WHERE orgid=? AND userid='' AND (canedit=1 OR canview=1))
|
||||||
UNION ALL SELECT refid FROM label a where orgid=? AND type=3 AND refid IN (SELECT labelid from labelrole WHERE orgid=? AND userid=? AND (canedit=1 OR canview=1)))
|
UNION ALL SELECT refid FROM label a where orgid=? AND type=3 AND refid IN (SELECT labelid from labelrole WHERE orgid=? AND userid=? AND (canedit=1 OR canview=1)))
|
||||||
|
@ -164,7 +161,7 @@ func (p *Persister) GetDocumentsByTag(tag string) (documents []entity.Document,
|
||||||
// GetDocumentTemplates returns a slice containing the documents available as templates to the client's organisation, in title order.
|
// GetDocumentTemplates returns a slice containing the documents available as templates to the client's organisation, in title order.
|
||||||
func (p *Persister) GetDocumentTemplates() (documents []entity.Document, err error) {
|
func (p *Persister) GetDocumentTemplates() (documents []entity.Document, err error) {
|
||||||
err = Db.Select(&documents,
|
err = Db.Select(&documents,
|
||||||
`SELECT id, refid, orgid, labelid, userid, job, location, title, excerpt, slug, tags, template, layout, created, revised FROM document WHERE orgid=? AND template=1 AND labelid IN
|
`SELECT id, refid, orgid, labelid, userid, job, location, title, excerpt, slug, tags, template, created, revised FROM document WHERE orgid=? AND template=1 AND labelid IN
|
||||||
(SELECT refid from label WHERE orgid=? AND type=2 AND userid=?
|
(SELECT refid from label WHERE orgid=? AND type=2 AND userid=?
|
||||||
UNION ALL SELECT refid FROM label a where orgid=? AND type=1 AND refid IN (SELECT labelid from labelrole WHERE orgid=? AND userid='' AND (canedit=1 OR canview=1))
|
UNION ALL SELECT refid FROM label a where orgid=? AND type=1 AND refid IN (SELECT labelid from labelrole WHERE orgid=? AND userid='' AND (canedit=1 OR canview=1))
|
||||||
UNION ALL SELECT refid FROM label a where orgid=? AND type=3 AND refid IN (SELECT labelid from labelrole WHERE orgid=? AND userid=? AND (canedit=1 OR canview=1)))
|
UNION ALL SELECT refid FROM label a where orgid=? AND type=3 AND refid IN (SELECT labelid from labelrole WHERE orgid=? AND userid=? AND (canedit=1 OR canview=1)))
|
||||||
|
@ -206,7 +203,7 @@ AND d.template=0`, orgID)
|
||||||
// GetDocumentList returns a slice containing the documents available as templates to the client's organisation, in title order.
|
// GetDocumentList returns a slice containing the documents available as templates to the client's organisation, in title order.
|
||||||
func (p *Persister) GetDocumentList() (documents []entity.Document, err error) {
|
func (p *Persister) GetDocumentList() (documents []entity.Document, err error) {
|
||||||
err = Db.Select(&documents,
|
err = Db.Select(&documents,
|
||||||
`SELECT id, refid, orgid, labelid, userid, job, location, title, excerpt, slug, tags, template, layout, created, revised FROM document WHERE orgid=? AND template=0 AND labelid IN
|
`SELECT id, refid, orgid, labelid, userid, job, location, title, excerpt, slug, tags, template, created, revised FROM document WHERE orgid=? AND template=0 AND labelid IN
|
||||||
(SELECT refid from label WHERE orgid=? AND type=2 AND userid=?
|
(SELECT refid from label WHERE orgid=? AND type=2 AND userid=?
|
||||||
UNION ALL SELECT refid FROM label a where orgid=? AND type=1 AND refid IN (SELECT labelid from labelrole WHERE orgid=? AND userid='' AND (canedit=1 OR canview=1))
|
UNION ALL SELECT refid FROM label a where orgid=? AND type=1 AND refid IN (SELECT labelid from labelrole WHERE orgid=? AND userid='' AND (canedit=1 OR canview=1))
|
||||||
UNION ALL SELECT refid FROM label a where orgid=? AND type=3 AND refid IN (SELECT labelid from labelrole WHERE orgid=? AND userid=? AND (canedit=1 OR canview=1)))
|
UNION ALL SELECT refid FROM label a where orgid=? AND type=3 AND refid IN (SELECT labelid from labelrole WHERE orgid=? AND userid=? AND (canedit=1 OR canview=1)))
|
||||||
|
@ -304,7 +301,7 @@ func (p *Persister) SearchDocument(keywords string) (results []entity.DocumentSe
|
||||||
func (p *Persister) UpdateDocument(document entity.Document) (err error) {
|
func (p *Persister) UpdateDocument(document entity.Document) (err error) {
|
||||||
document.Revised = time.Now().UTC()
|
document.Revised = time.Now().UTC()
|
||||||
|
|
||||||
stmt, err := p.Context.Transaction.PrepareNamed("UPDATE document SET labelid=:labelid, userid=:userid, job=:job, location=:location, title=:title, excerpt=:excerpt, slug=:slug, tags=:tags, template=:template, layout=:layout, revised=:revised WHERE orgid=:orgid AND refid=:refid")
|
stmt, err := p.Context.Transaction.PrepareNamed("UPDATE document SET labelid=:labelid, userid=:userid, job=:job, location=:location, title=:title, excerpt=:excerpt, slug=:slug, tags=:tags, template=:template, revised=:revised WHERE orgid=:orgid AND refid=:refid")
|
||||||
defer utility.Close(stmt)
|
defer utility.Close(stmt)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
5
core/database/to-remove.md
Normal file
5
core/database/to-remove.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
TODO
|
||||||
|
-----
|
||||||
|
|
||||||
|
1. Remove audit table
|
||||||
|
2. Remove document.layout field
|
Loading…
Add table
Add a link
Reference in a new issue