2021-12-09 18:00:15 +03:00
|
|
|
<KoenigCard
|
|
|
|
@env={{@env}}
|
2021-12-10 21:17:11 +03:00
|
|
|
@class={{"ba b--transparent relative kg-card-hover kg-card kg-file-card mih10 miw-100 relative" (kg-style "breakout" size=@payload.cardWidth)}}
|
2021-12-09 18:00:15 +03:00
|
|
|
@headerOffset={{@headerOffset}}
|
|
|
|
@toolbar={{this.toolbar}}
|
|
|
|
@payload={{@payload}}
|
|
|
|
@isSelected={{@isSelected}}
|
|
|
|
@isEditing={{@isEditing}}
|
|
|
|
@selectCard={{@selectCard}}
|
|
|
|
@deselectCard={{@deselectCard}}
|
|
|
|
@editCard={{@editCard}}
|
|
|
|
@hasEditMode={{not this.isEmpty}}
|
|
|
|
@saveCard={{@saveCard}}
|
|
|
|
@saveAsSnippet={{@saveAsSnippet}}
|
|
|
|
@addParagraphAfterCard={{@addParagraphAfterCard}}
|
|
|
|
@moveCursorToPrevSection={{@moveCursorToPrevSection}}
|
|
|
|
@moveCursorToNextSection={{@moveCursorToNextSection}}
|
|
|
|
@editor={{@editor}}
|
|
|
|
{{did-insert this.didInsert}}
|
|
|
|
{{on "dragover" this.dragOver}}
|
|
|
|
{{on "dragleave" this.dragLeave}}
|
|
|
|
{{on "drop" this.drop}}
|
|
|
|
>
|
|
|
|
{{#if @payload.src}}
|
2021-12-14 19:41:37 +03:00
|
|
|
<div class="kg-upload-container {{if (and (not @isEditing) (or (not @payload.fileTitle) (not @payload.fileCaption))) "medium"}} {{if (and (not @isEditing) (and (not @payload.fileTitle) (not @payload.fileCaption))) "small"}}">
|
2021-12-10 21:17:11 +03:00
|
|
|
<div class="kg-media-container light">
|
2022-02-02 19:09:43 +03:00
|
|
|
<button class="kg-upload-button" type="button">
|
2021-12-14 19:41:37 +03:00
|
|
|
{{svg-jar "file-upload" class="kg-file-icon"}}
|
2021-12-09 18:00:15 +03:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="kg-file-data-container">
|
2021-12-14 19:41:37 +03:00
|
|
|
<div class="kg-file-inputs">
|
2021-12-10 21:17:11 +03:00
|
|
|
<GhTextInput
|
|
|
|
@value={{@payload.fileTitle}}
|
2021-12-14 19:55:27 +03:00
|
|
|
@placeholder="File title"
|
2021-12-10 21:17:11 +03:00
|
|
|
@input={{action "setFileTitle" value="target.value"}}
|
2021-12-14 19:41:37 +03:00
|
|
|
@class="kg-upload-title {{if (and (not @isEditing) (not @payload.fileTitle)) "hide"}}"
|
|
|
|
@maxlength="80"
|
2021-12-10 21:17:11 +03:00
|
|
|
/>
|
|
|
|
<GhTextInput
|
|
|
|
@value={{@payload.fileCaption}}
|
|
|
|
@input={{action "setFileCaption" value="target.value"}}
|
2021-12-15 19:45:04 +03:00
|
|
|
@placeholder="Add optional file description"
|
2021-12-14 19:41:37 +03:00
|
|
|
@class="kg-upload-caption {{if (and (not @isEditing) (not @payload.fileCaption)) "hide"}}"
|
|
|
|
@maxlength="100"
|
2021-12-10 21:17:11 +03:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div class="kg-upload-metadata">
|
|
|
|
{{!-- </div>style="display:flex;line-height:1.15;margin-top:10px;margin-left:10px;font-size:1.3rem"> --}}
|
|
|
|
{{this.fileName}} <span class="kg-upload-filesize">• {{this.fileSize}}</span>
|
2021-12-09 18:00:15 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-02-02 19:09:43 +03:00
|
|
|
{{#unless @isEditing}}
|
2021-12-13 13:28:12 +03:00
|
|
|
<div class="koenig-card-click-overlay"></div>
|
2022-02-02 19:09:43 +03:00
|
|
|
{{/unless}}
|
2021-12-09 18:00:15 +03:00
|
|
|
{{else}}
|
2021-12-10 21:17:11 +03:00
|
|
|
<div class="kg-upload-container kg-upload-container-empty">
|
2021-12-09 18:00:15 +03:00
|
|
|
<GhUploader
|
2021-12-10 15:31:25 +03:00
|
|
|
@uploadUrl="/files/upload/"
|
|
|
|
@resourceName="files"
|
2021-12-09 18:00:15 +03:00
|
|
|
@files={{this.files}}
|
|
|
|
@onStart={{this.fileUploadStarted}}
|
|
|
|
@onComplete={{this.fileUploadCompleted}}
|
|
|
|
@onFailed={{this.fileUploadFailed}}
|
|
|
|
as |uploader|
|
|
|
|
>
|
|
|
|
{{#if (or uploader.errors uploader.isUploading)}}
|
|
|
|
{{#if uploader.errors}}
|
|
|
|
<span class="db absolute top-0 right-0 left-0 flex items-center h8 pl2 pr2 bg-red white sans-serif f7">
|
2023-01-04 12:39:32 +03:00
|
|
|
{{get uploader.errors "0.message"}}
|
2021-12-09 18:00:15 +03:00
|
|
|
</span>
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{#if this.isDraggedOver}}
|
|
|
|
<span class="db center sans-serif fw7 f7 middarkgrey">
|
|
|
|
Drop it like it's hot 🔥
|
|
|
|
</span>
|
|
|
|
{{else if uploader.isUploading}}
|
|
|
|
{{uploader.progressBar}}
|
|
|
|
{{/if}}
|
|
|
|
{{else}}
|
|
|
|
{{#if this.isDraggedOver}}
|
|
|
|
<span class="db center sans-serif fw7 f7 middarkgrey">
|
|
|
|
Drop it like it's hot 🔥
|
|
|
|
</span>
|
|
|
|
{{else if uploader.isUploading}}
|
|
|
|
{{uploader.progressBar}}
|
|
|
|
{{else}}
|
2021-12-10 21:17:11 +03:00
|
|
|
<div {{on "click" this.triggerFileDialog}} class="flex pa4 midgrey">
|
2021-12-14 19:41:37 +03:00
|
|
|
{{svg-jar "upload"}}
|
2021-12-10 21:17:11 +03:00
|
|
|
<span class="kg-upload-placeholder-text">
|
2021-12-10 15:31:25 +03:00
|
|
|
Click to upload a file
|
2021-12-09 18:00:15 +03:00
|
|
|
</span>
|
2021-12-10 21:17:11 +03:00
|
|
|
</div>
|
2021-12-09 18:00:15 +03:00
|
|
|
{{/if}}
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
<div style="display:none">
|
|
|
|
<GhFileInput
|
|
|
|
@multiple={{false}}
|
|
|
|
@action={{uploader.setFiles}}
|
|
|
|
@onInsert={{uploader.registerFileInput}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</GhUploader>
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
</KoenigCard>
|