DEV: Convert EmojiUploader to FormKit

This commit is contained in:
Ted Johansson 2024-11-08 15:19:08 +08:00
parent 189d98f3ca
commit 3960fd4388
No known key found for this signature in database
GPG Key ID: 2E801F82D9A4C6E9
2 changed files with 44 additions and 51 deletions

View File

@ -1,51 +1,44 @@
<div class="emoji-uploader form-horizontal"> <div class="admin-config-page__main-area">
<div class="control-group"> <Form
<span class="label"> @data={{this.formData}}
{{i18n "admin.emoji.name"}} @onSubmit={{this.save}}
</span> as |form|
<div class="input"> >
<Input <form.Field
id="emoji-name" @name="name"
name="name" @title={{i18n "admin.emoji.name"}}
placeholder={{i18n "admin.emoji.name"}} @format="medium"
@value={{readonly this.name}} as |field|>
{{on "input" (with-event-value (fn (mut this.name)))}} <field.Input />
/> </form.Field>
</div>
</div> <form.Field
<div class="control-group"> @name="group"
<span class="label"> @title={{i18n "admin.emoji.group"}}
{{i18n "admin.emoji.group"}} as |field|>
</span> <field.Custom>
<div class="input"> <ComboBox
<ComboBox @name="group"
@name="group" @id="emoji-group-selector"
@id="emoji-group-selector" @value={{this.group}}
@value={{this.group}} @content={{this.newEmojiGroups}}
@content={{this.newEmojiGroups}} @onChange={{action "createEmojiGroup"}}
@onChange={{action "createEmojiGroup"}} @valueProperty={{null}}
@valueProperty={{null}} @nameProperty={{null}}
@nameProperty={{null}} @options={{hash allowAny=true}}
@options={{hash allowAny=true}} />
/> </field.Custom>
</div> </form.Field>
</div>
<div class="control-group"> <form.Field
<div class="input"> @name="image"
<input @title="Image"
{{did-insert this.uppyUpload.setup}} @format="medium"
class="hidden-upload-field" @validation="required"
disabled={{this.uppyUpload.uploading}} as |field|>
type="file" <field.Image @type="emoji" />
multiple="true" </form.Field>
accept=".png,.gif"
/> <form.Submit @label="admin.emoji.add" />
<DButton </Form>
@translatedLabel={{this.buttonLabel}}
@action={{this.chooseFiles}}
@disabled={{this.uppyUpload.uploading}}
class="btn-default"
/>
</div>
</div>
</div> </div>

View File

@ -7206,7 +7206,7 @@ en:
title: "Emoji" title: "Emoji"
description: "Add new emoji that will be available to everyone. Drag and drop multiple files at once without entering a name to create emojis using their file names. The selected group will be used for all files that are added at the same time. You can also click 'Add New Emoji' to open the file picker." description: "Add new emoji that will be available to everyone. Drag and drop multiple files at once without entering a name to create emojis using their file names. The selected group will be used for all files that are added at the same time. You can also click 'Add New Emoji' to open the file picker."
new: "Add" new: "Add"
add: "Add New Emoji" add: "Add new emoji"
choose_files: "Choose Files" choose_files: "Choose Files"
uploading: "Uploading…" uploading: "Uploading…"
name: "Name" name: "Name"