1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-02 20:15:26 +02:00

Provide per section attachments

Upload and delete attachments on a per section basis.
This commit is contained in:
Harvey Kandola 2019-04-18 13:31:48 +01:00
parent 166aeba09b
commit 61d0086337
13 changed files with 248 additions and 116 deletions

View file

@ -1 +1,7 @@
{{component editorType document=document folder=folder page=page meta=meta onCancel=(action "onCancel") onAction=(action "onAction")}}
{{component editorType
document=document
folder=folder
page=page
meta=meta
attachments=attachments
onCancel=(action "onCancel") onAction=(action "onAction")}}

View file

@ -6,6 +6,7 @@
folder=folder
page=editPage
meta=editMeta
attachments=attachments
onCancel=(action "onCancelEdit")
onAction=(action "onSavePage")}}
</div>
@ -35,4 +36,9 @@
{{section/base-renderer page=page}}
</div>
{{/if}}
{{document/section-attachment uploadLabel="Upload Attachments"
editMode=editMode page=page document=document files=attachments
onAttachmentUpload=(action onAttachmentUpload)
onAttachmentDelete=(action onAttachmentDelete)}}
</div>

View file

@ -0,0 +1,39 @@
{{#if editMode}}
{{ui/ui-spacer size=200}}
{{ui/ui-button color=constants.Color.Gray label=uploadLabel id=uploadId}}
{{/if}}
<ul class="section-attachments">
{{#each files key="id" as |file|}}
{{#if (eq file.pageId page.id)}}
<li class="file">
<a href="{{appMeta.endpoint}}/public/attachment/{{appMeta.orgId}}/{{file.id}}{{downloadQuery}}">
{{file.filename}}
</a>
{{#if editMode}}
<div class="menu">
{{#ui/ui-toolbar dark=false light=false raised=false large=false bordered=false}}
{{#ui/ui-toolbar-icon icon=constants.Icon.Delete color=constants.Color.Red}}
{{#attach-popover class="ember-attacher-popper" hideOn="escapekey, clickout" showOn="click" isShown=false}}
<div class="form">
<p>Are you sure you want to delete this file?</p>
{{ui/ui-spacer size=100}}
{{ui/ui-button
light=false
label=constants.Label.Delete
color=constants.Color.Red
onClick=(action "onDelete" file)}}
</div>
{{/attach-popover}}
{{/ui/ui-toolbar-icon}}
{{/ui/ui-toolbar}}
</div>
{{/if}}
</li>
{{/if}}
{{/each}}
</ul>
{{#ui/ui-dialog title="Delete Attachment" confirmCaption="Delete" buttonColor=constants.Color.Red show=showDialog onAction=(action "onDelete")}}
<p>Are you sure you want to delete this attachment?</p>
{{/ui/ui-dialog}}

View file

@ -11,31 +11,32 @@
<div class="document-sidebar-attachment">
<ul class="files">
{{#each files key="id" as |file|}}
<li class="file">
<a href="{{appMeta.endpoint}}/public/attachment/{{appMeta.orgId}}/{{file.id}}{{downloadQuery}}">
{{file.filename}}
</a>
{{#if canEdit}}
<div class="menu">
{{#ui/ui-toolbar dark=false light=false raised=false large=false bordered=false}}
{{#ui/ui-toolbar-icon icon=constants.Icon.Delete color=constants.Color.Red}}
{{#attach-popover class="ember-attacher-popper" hideOn="escapekey, clickout" showOn="click" isShown=false}}
<div class="form">
<p>Are you sure you want to delete this file?</p>
{{ui/ui-spacer size=100}}
{{ui/ui-button
light=false
label=constants.Label.Delete
color=constants.Color.Red
onClick=(action "onDelete" file)}}
</div>
{{/attach-popover}}
{{/ui/ui-toolbar-icon}}
{{/ui/ui-toolbar}}
</div>
{{/if}}
</li>
{{#if (eq file.pageId '')}}
<li class="file">
<a href="{{appMeta.endpoint}}/public/attachment/{{appMeta.orgId}}/{{file.id}}{{downloadQuery}}">
{{file.filename}}
</a>
{{#if canEdit}}
<div class="menu">
{{#ui/ui-toolbar dark=false light=false raised=false large=false bordered=false}}
{{#ui/ui-toolbar-icon icon=constants.Icon.Delete color=constants.Color.Red}}
{{#attach-popover class="ember-attacher-popper" hideOn="escapekey, clickout" showOn="click" isShown=false}}
<div class="form">
<p>Are you sure you want to delete this file?</p>
{{ui/ui-spacer size=100}}
{{ui/ui-button
light=false
label=constants.Label.Delete
color=constants.Color.Red
onClick=(action "onDelete" file)}}
</div>
{{/attach-popover}}
{{/ui/ui-toolbar-icon}}
{{/ui/ui-toolbar}}
</div>
{{/if}}
</li>
{{/if}}
{{/each}}
</ul>
</div>

View file

@ -12,13 +12,16 @@
document=document
pending=item.pending
permissions=permissions
attachments=attachments
refresh=(action refresh)
onAttachmentUpload=(action onAttachmentUpload)
onAttachmentDelete=(action onAttachmentDelete)
onSavePage=(action "onSavePage")
onCopyPage=(action "onCopyPage")
onMovePage=(action "onMovePage")
onDeletePage=(action "onDeletePage")
onSavePageAsBlock=(action "onSavePageAsBlock")
onPageLevelChange=(action onPageLevelChange)
onPageLevelChange=(action onPageLevelChange)
onPageSequenceChange=(action onPageSequenceChange)
onShowSectionWizard=(action "onShowSectionWizard")}}
{{/each}}

View file

@ -41,12 +41,6 @@
<div class="canvas">
{{yield}}
</div>
<div class="attachments">
{{ui/ui-spacer size=100}}
{{ui/ui-button color=constants.Color.Gray label="Upload" id=uploadId}}
{{ui/ui-spacer size=100}}
</div>
</div>
</div>