mirror of
https://github.com/documize/community.git
synced 2025-08-09 15:35:27 +02:00
Merge pull request #12 from documize/customer-improvements
Customer improvements
This commit is contained in:
commit
6dbf074a50
19 changed files with 204 additions and 99 deletions
|
@ -27,8 +27,11 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
this.addTooltip(document.getElementById("attachment-button"));
|
||||
this.addTooltip(document.getElementById("save-template-button"));
|
||||
this.addTooltip(document.getElementById("set-meta-button"));
|
||||
this.addTooltip(document.getElementById("delete-document-button"));
|
||||
}
|
||||
|
||||
this.addTooltip(document.getElementById("print-document-button"));
|
||||
|
||||
if (this.session.authenticated) {
|
||||
this.addTooltip(document.getElementById("owner-avatar"));
|
||||
}
|
||||
|
@ -87,6 +90,14 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
},
|
||||
|
||||
actions: {
|
||||
deleteDocument() {
|
||||
this.attrs.onDocumentDelete();
|
||||
},
|
||||
|
||||
printDocument() {
|
||||
window.print();
|
||||
},
|
||||
|
||||
saveTemplate() {
|
||||
var templateName = this.get('saveTemplate.name');
|
||||
var templateDescription = this.get('saveTemplate.description');
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -188,6 +188,17 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
self.get('model.slug'),
|
||||
newPage.id);
|
||||
});
|
||||
},
|
||||
|
||||
onDocumentDelete() {
|
||||
console.log("deleting " + this.get('model.id'));
|
||||
let self = this;
|
||||
|
||||
this.get('documentService').deleteDocument(this.get('model.id')).then(function() {
|
||||
self.audit.record("deleted-page");
|
||||
self.send("showNotification", "Deleted");
|
||||
self.transitionToRoute('folders.folder', self.get('folder.id'), self.get('folder.slug'));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
|
@ -3,7 +3,7 @@
|
|||
{{/header/page-navigation}}
|
||||
|
||||
{{document/document-toolbar document=model pages=pages meta=meta folder=folder isEditor=isEditor users=users owner=owner onSaveTemplate=(action 'onDocumentChange') onDocumentChange=(action 'onDocumentChange') onAttachmentUpload=(action
|
||||
'onAttachmentUpload')}}
|
||||
'onAttachmentUpload') onDocumentDelete=(action 'onDocumentDelete')}}
|
||||
|
||||
<div class="container-fluid background-color-white">
|
||||
<div class="row">
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
@import "view/document/wizard.scss";
|
||||
@import "vendor.scss";
|
||||
@import "responsive.scss";
|
||||
@import "print.scss";
|
||||
|
||||
@import "section/trello.scss";
|
||||
@import "section/gemini.scss";
|
||||
|
|
30
app/app/styles/print.scss
Normal file
30
app/app/styles/print.scss
Normal file
|
@ -0,0 +1,30 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// 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 <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
@media print {
|
||||
.header, .sidebar, .non-printable {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.document-container {
|
||||
> .content {
|
||||
padding: 20px 0 !important;
|
||||
|
||||
.page-toolbar {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.print-title, .non-printable-message, .document-summary, .attachment-zone {
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,6 +2,22 @@
|
|||
> .content {
|
||||
padding: 40px 40px 40px 20px;
|
||||
|
||||
.print-title {
|
||||
display: none;
|
||||
font-size: 2.3em;
|
||||
font-weight: bold;
|
||||
color:$color-off-black;
|
||||
margin-bottom: 20px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.non-printable-message {
|
||||
display: none;
|
||||
font-size: 1em;
|
||||
font-style: italic;
|
||||
color: $color-gray;
|
||||
}
|
||||
|
||||
.attachment-zone {
|
||||
margin: 20px 0 30px 0;
|
||||
|
||||
|
@ -34,7 +50,6 @@
|
|||
color: $color-stroke;
|
||||
}
|
||||
|
||||
|
||||
&:hover {
|
||||
.file {
|
||||
text-decoration: underline;
|
||||
|
@ -53,20 +68,17 @@
|
|||
display: none;
|
||||
}
|
||||
|
||||
.document-tags {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.is-template {
|
||||
color: $color-green;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
> .pages {
|
||||
margin: 20px 0 50px 0;
|
||||
|
||||
> .wysiwyg {
|
||||
> .is-a-page {
|
||||
.page-title {
|
||||
|
||||
> .page-toolbar {
|
||||
opacity: 0.3;
|
||||
@extend .transition-all;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -38,7 +38,19 @@
|
|||
{{/if}}
|
||||
|
||||
<div class="actions pull-right hidden-xs hidden-sm">
|
||||
|
||||
{{#link-to 'folders.folder' folder.id folder.slug}}
|
||||
<div class="regular-button button-blue" id="add-section-button">
|
||||
<i class="material-icons">arrow_back</i>
|
||||
<div class="name">space</div>
|
||||
</div>
|
||||
{{/link-to}}
|
||||
|
||||
{{#if isEditor}}
|
||||
<div class="button-gap"></div>
|
||||
<div class="square-button button-gray" id="set-meta-button" data-tooltip="Set meta" data-tooltip-position="top center">
|
||||
<i class="material-icons">settings</i>
|
||||
</div>
|
||||
<div class="button-gap"></div>
|
||||
<div class="square-button button-gray" id="attachment-button" data-tooltip="Attach file" data-tooltip-position="top center">
|
||||
<i class="material-icons">attach_file</i>
|
||||
|
@ -47,14 +59,25 @@
|
|||
<div class="square-button button-gray" id="save-template-button" data-tooltip="Save as template" data-tooltip-position="top center">
|
||||
<i class="material-icons">content_copy</i>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="button-gap"></div>
|
||||
<div class="square-button button-gray" id="set-meta-button" data-tooltip="Set owner & excerpt" data-tooltip-position="top center">
|
||||
<i class="material-icons">person</i>
|
||||
<div class="square-button button-gray" id="print-document-button" data-tooltip="Print document" data-tooltip-position="top center" {{action 'printDocument'}}>
|
||||
<i class="material-icons">print</i>
|
||||
</div>
|
||||
|
||||
{{#if isEditor}}
|
||||
<div class="button-gap"></div>
|
||||
<div class="square-button button-red" id="delete-document-button" data-tooltip="Delete document" data-tooltip-position="top center">
|
||||
<i class="material-icons">delete</i>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if isEditor}}
|
||||
{{#dropdown-dialog target="delete-document-button" position="bottom right" button="Delete" color="flat-red" onAction=(action 'deleteDocument')}}
|
||||
<p>Are you sure you want to delete this document?</p>
|
||||
<p>There is no undo!</p>
|
||||
{{/dropdown-dialog}}
|
||||
{{#dropdown-dialog target="save-template-button" position="bottom right" button="Save" color="flat-green" onAction=(action 'saveTemplate') focusOn="new-template-name"}}
|
||||
<div>
|
||||
<div class="input-control">
|
||||
|
@ -69,7 +92,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{{/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"}}
|
||||
<div>
|
||||
<div class="input-control">
|
||||
<label>Owner</label>
|
||||
|
@ -81,6 +104,11 @@
|
|||
optionLabelPath="fullname"
|
||||
selection=owner}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Name</label>
|
||||
<div class="tip">Short title for this document</div>
|
||||
{{input type='text' id="document-name" value=document.name}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Excerpt</label>
|
||||
<div class="tip">Provide short summary of the document (max. 250)</div>
|
||||
|
|
|
@ -1,20 +1,12 @@
|
|||
<div class="document-container">
|
||||
<div class="content">
|
||||
<div class="pages">
|
||||
{{#each pages key="id" as |page index|}}
|
||||
<div class="wysiwyg">
|
||||
<div id="page-{{ page.id }}" class="is-a-page" data-id="{{ page.id }}" data-type="{{ page.contentType }}">
|
||||
|
||||
{{document/page-heading tagName=page.tagName document=document folder=folder page=page isEditor=isEditor onDeletePage=(action 'onDeletePage') }}
|
||||
|
||||
{{#if page.firstPage }}
|
||||
{{#if document.template}}
|
||||
<div class="is-template">TEMPLATE</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="document-summary">
|
||||
|
||||
{{document/tag-editor documentTags=document.tags isEditor=isEditor onChange=(action 'onTagChange')}}
|
||||
</div>
|
||||
|
||||
<div class="print-title">
|
||||
{{document.name}}
|
||||
</div>
|
||||
|
||||
{{#if attachments}}
|
||||
<div class="attachment-zone">
|
||||
|
@ -36,7 +28,15 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
</div>
|
||||
<div class="pages">
|
||||
{{#each pages key="id" as |page index|}}
|
||||
<div class="wysiwyg">
|
||||
<div id="page-{{ page.id }}" class="is-a-page" data-id="{{ page.id }}" data-type="{{ page.contentType }}">
|
||||
{{document/page-heading tagName=page.tagName document=document folder=folder page=page isEditor=isEditor onDeletePage=(action 'onDeletePage') }}
|
||||
{{#if page.firstPage }}
|
||||
{{#if document.template}}
|
||||
<div class="is-template">TEMPLATE</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{section/base-renderer page=page}}
|
||||
</div>
|
||||
|
|
|
@ -708,7 +708,7 @@ func InviteToFolder(w http.ResponseWriter, r *http.Request) {
|
|||
a.UserID = user.RefID
|
||||
a.OrgID = p.Context.OrgID
|
||||
a.Admin = false
|
||||
a.Editor = true
|
||||
a.Editor = false
|
||||
accountID := util.UniqueID()
|
||||
a.RefID = accountID
|
||||
|
||||
|
@ -808,7 +808,7 @@ func inviteNewUserToSharedFolder(p request.Persister, email string, invitedBy en
|
|||
a.UserID = userID
|
||||
a.OrgID = p.Context.OrgID
|
||||
a.Admin = false
|
||||
a.Editor = true
|
||||
a.Editor = false
|
||||
accountID := util.UniqueID()
|
||||
a.RefID = accountID
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 = "<p>Some content here.</p>"
|
||||
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 = "<p>Some content here.</p>"
|
||||
//pages[0].Level = 1
|
||||
//pages[0].Sequence = 1
|
||||
|
||||
var attachments = []entity.Attachment{}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@ package trello
|
|||
import "strings"
|
||||
|
||||
const renderTemplate = `
|
||||
<div class="section-trello-render">
|
||||
<p class="non-printable-message">Non-printable</p>
|
||||
<div class="section-trello-render non-printable">
|
||||
<p>There are {{ .CardCount }} cards across {{ .ListCount }} lists for board <a href="{{ .Board.URL }}">{{.Board.Name}}.</a></p>
|
||||
<div class="trello-board" style="background-color: {{.Board.Prefs.BackgroundColor}}">
|
||||
<a href="{{ .Board.URL }}"><div class="trello-board-title">{{.Board.Name}}</div></a>
|
||||
|
|
|
@ -129,7 +129,6 @@ func (*Provider) Command(w http.ResponseWriter, r *http.Request) {
|
|||
AppKey string `json:"appKey"`
|
||||
}
|
||||
|
||||
fmt.Println(appKey)
|
||||
config.AppKey = appKey
|
||||
provider.WriteJSON(w, config)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue