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:
parent
166aeba09b
commit
61d0086337
13 changed files with 248 additions and 116 deletions
|
@ -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")}}
|
||||
|
|
|
@ -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>
|
||||
|
|
39
gui/app/templates/components/document/section-attachment.hbs
Normal file
39
gui/app/templates/components/document/section-attachment.hbs
Normal 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}}
|
|
@ -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>
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue