mirror of
https://github.com/documize/community.git
synced 2025-07-19 05:09:42 +02:00
parent
715c31a1da
commit
c59a467cdb
6 changed files with 55 additions and 4 deletions
|
@ -99,7 +99,35 @@ export default Component.extend(ModalMixin, AuthMixin, Notifier, {
|
|||
cb();
|
||||
},
|
||||
|
||||
onPrintDocument() {
|
||||
onShowPrintModal() {
|
||||
let pages = this.get('pages');
|
||||
|
||||
// By default we select everything for print.
|
||||
pages.forEach((item) => {
|
||||
item.set('printSelected', true);
|
||||
});
|
||||
|
||||
this.set('pages', pages);
|
||||
|
||||
this.modalOpen("#document-print-modal", {show:true});
|
||||
},
|
||||
|
||||
onPrintSelection() {
|
||||
this.modalClose('#document-print-modal');
|
||||
|
||||
let pages = this.get('pages');
|
||||
pages.forEach((item) => {
|
||||
let pageId = item.get('page.id');
|
||||
let selected = item.get('printSelected');
|
||||
$(`#page-${pageId}`).addClass('non-printable');
|
||||
$(`#page-spacer-${pageId}`).addClass('non-printable');
|
||||
|
||||
if (selected) {
|
||||
$(`#page-${pageId}`).removeClass('non-printable');
|
||||
$(`#page-spacer-${pageId}`).removeClass('non-printable');
|
||||
}
|
||||
});
|
||||
|
||||
window.print();
|
||||
},
|
||||
|
||||
|
|
|
@ -348,6 +348,7 @@ let constants = EmberObject.extend({
|
|||
Next: 'Next',
|
||||
OK: 'OK',
|
||||
Preview: 'Preview',
|
||||
Print: 'Print',
|
||||
Publish: 'Publish',
|
||||
Reject: 'Reject',
|
||||
Remove: 'Remove',
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
{{document/document-toolbar
|
||||
tab=tab
|
||||
roles=roles
|
||||
pages=pages
|
||||
space=folder
|
||||
spaces=folders
|
||||
document=document
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
{{/if}}
|
||||
|
||||
{{#if document.template}}
|
||||
<div class="label-template">
|
||||
<div class="label-template non-printable">
|
||||
Template
|
||||
{{#attach-tooltip showDelay=1000}}This is a template{{/attach-tooltip}}
|
||||
</div>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<li class="item" {{action "onPin"}}>Bookmark</li>
|
||||
<li class="divider"/>
|
||||
{{/if}}
|
||||
<li class="item" {{action "onPrintDocument"}}>Print</li>
|
||||
<li class="item" {{action "onShowPrintModal"}}>Print</li>
|
||||
<li class="item" {{action "onExport"}}>Download</li>
|
||||
{{#if permissions.documentAdd}}
|
||||
<li class="divider"/>
|
||||
|
@ -93,6 +93,27 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="document-print-modal" class="modal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">Print</div>
|
||||
<div class="modal-body">
|
||||
<p>Print all content or select sections.</p>
|
||||
{{#each pages as |item|}}
|
||||
{{#ui/ui-checkbox selected=item.printSelected}}
|
||||
{{item.page.numbering}}. {{item.page.title}}
|
||||
{{/ui/ui-checkbox}}
|
||||
{{/each}}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
{{ui/ui-button color=constants.Color.Gray light=true label=constants.Label.Cancel dismiss=true}}
|
||||
{{ui/ui-button-gap}}
|
||||
{{ui/ui-button color=constants.Color.Green light=true label=constants.Label.Print onClick=(action "onPrintSelection")}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="document-delete-modal" class="modal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{#if hasPages}}
|
||||
{{#each pages key="id" as |item|}}
|
||||
<Ui::UiSpacer @size="100" />
|
||||
<Ui::UiSpacer @size="100" id={{concat 'page-spacer-' item.page.id}} />
|
||||
{{document/document-page
|
||||
roles=roles
|
||||
pages=pages
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue