open-vault/ui/app/templates/components/file-to-array-buffer.hbs
claire bontempo 56442f673d
ui: refactor text file component (#18458)
* wip tests

* Move text-file to addon

* rename fileName to filename, initial cleanup of text-fil

* rename args, rename test selector

* fix eye-con, remove enterAsText from file object

* add tests

* move files back to original location

* rename files via git for git diff

* adjsut test

* Revert "wip tests"

This reverts commit 63716a1e647a0b01236d34322837456ef3e9db43.

* fix policy form input

* cleanup conditional

* add bottom margin

* add element id

* change arg name

* add text area input test

* add upload test to policy form

Co-authored-by: Chelsea Shaw <cshaw@hashicorp.com>
2022-12-19 23:54:59 +00:00

45 lines
1.3 KiB
Handlebars

<div class="field">
<div class="control is-expanded">
<label class="is-label">
{{#if this.label}}
{{this.label}}
{{/if}}
</label>
<div class="file has-name is-fullwidth">
<div class="file-label" aria-label="Choose a file">
<input id="file-input" class="file-input" type="file" onchange={{action "pickedFile"}} data-test-file-input />
<label for="file-input" class="file-cta button">
<Icon @name="upload" class="has-light-grey-text" />
Choose a file…
</label>
<span class="file-name has-text-grey-dark" data-test-text-file-input-label={{true}}>
{{or this.filename "No file chosen"}}
</span>
{{#if this.filename}}
<button
type="button"
class="file-delete-button"
aria-label="Clear file selection"
{{action "clearFile"}}
data-test-text-clear
>
<Icon @name="x-circle" />
</button>
{{/if}}
</div>
</div>
</div>
{{#if this.filename}}
<p class="help has-text-grey">
This file is
{{this.fileSize}}
and was created on
{{date-format this.fileLastModified "MMM dd, yyyy hh:mm:ss a"}}.
</p>
{{/if}}
{{#if @fileHelpText}}
<p class="help has-text-grey">
{{@fileHelpText}}
</p>
{{/if}}
</div>