diff --git a/app/app/components/document/document-toolbar.js b/app/app/components/document/document-toolbar.js index 5caf1462..bbd26949 100644 --- a/app/app/components/document/document-toolbar.js +++ b/app/app/components/document/document-toolbar.js @@ -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 @@ -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'); @@ -137,4 +148,4 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, { return true; }, } -}); \ No newline at end of file +}); 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/app/app/pods/document/index/controller.js b/app/app/pods/document/index/controller.js index 04b86079..fb3712e3 100644 --- a/app/app/pods/document/index/controller.js +++ b/app/app/pods/document/index/controller.js @@ -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')); + }); + } } -}); \ No newline at end of file +}); diff --git a/app/app/pods/document/index/template.hbs b/app/app/pods/document/index/template.hbs index 00596de4..7673b41f 100644 --- a/app/app/pods/document/index/template.hbs +++ b/app/app/pods/document/index/template.hbs @@ -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')}}
diff --git a/app/app/styles/app.scss b/app/app/styles/app.scss index f0837c73..237930c0 100644 --- a/app/app/styles/app.scss +++ b/app/app/styles/app.scss @@ -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"; diff --git a/app/app/styles/base.scss b/app/app/styles/base.scss index 218e79d1..575e7ac5 100644 --- a/app/app/styles/base.scss +++ b/app/app/styles/base.scss @@ -113,9 +113,9 @@ ul { .clearfix:before, .clearfix:after { - content: " "; - display: table; + content: " "; + display: table; } .clearfix:after { - clear: both; + clear: both; } diff --git a/app/app/styles/print.scss b/app/app/styles/print.scss new file mode 100644 index 00000000..aa072c8c --- /dev/null +++ b/app/app/styles/print.scss @@ -0,0 +1,30 @@ +// Copyright 2016 Documize Inc. . 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 . +// +// 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; + } + } + } +} diff --git a/app/app/styles/view/document/content.scss b/app/app/styles/view/document/content.scss index b6491edb..cae06a19 100644 --- a/app/app/styles/view/document/content.scss +++ b/app/app/styles/view/document/content.scss @@ -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; @@ -15,7 +31,7 @@ padding: 0; list-style-type: none; border-bottom: 1px solid $color-gray2; - padding-bottom: 10px; + padding-bottom: 10px; > .icon { vertical-align: text-top; @@ -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; 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..fbc3b647 100644 --- a/app/app/templates/components/document/document-toolbar.hbs +++ b/app/app/templates/components/document/document-toolbar.hbs @@ -38,7 +38,19 @@ {{/if}}