feat: add file upload to word import form
Some checks failed
CI / Lint & Test (push) Has been cancelled
Deploy Status Page / Build & Deploy (push) Has been cancelled

This commit is contained in:
viktorvsk 2026-04-23 04:56:19 +00:00
parent 657e08faec
commit 5d1974605e

View File

@ -46,11 +46,16 @@
<div class="section"> <div class="section">
<h2>Import words</h2> <h2>Import words</h2>
<p class="hint"> <p class="hint">
One entry per line. Formats: <code>word - definition</code> &nbsp;|&nbsp; One entry per line or upload a .txt/.csv file.
Formats: <code>word - definition</code> &nbsp;|&nbsp;
<code>word: definition</code> &nbsp;|&nbsp; <code>word | definition</code> &nbsp;|&nbsp; <code>word: definition</code> &nbsp;|&nbsp; <code>word | definition</code> &nbsp;|&nbsp;
just <code>word</code> just <code>word</code>
</p> </p>
<%= form_with url: words_path, method: :post, local: false, data: { turbo: false } do |f| %> <%= form_with url: words_path, method: :post, local: false, data: { turbo: false }, multipart: true do |f| %>
<div class="import-file-row">
<%= f.file_field :word_file, accept: ".txt,.csv,.tsv", class: "file-input" %>
<span class="import-or">or paste below</span>
</div>
<%= f.text_area :word_list, placeholder: "ephemeral - lasting for a very short time\npersistent\ntenacious: holding firmly to a purpose", rows: 8, class: "import-textarea" %> <%= f.text_area :word_list, placeholder: "ephemeral - lasting for a very short time\npersistent\ntenacious: holding firmly to a purpose", rows: 8, class: "import-textarea" %>
<%= f.submit "Import", class: "btn btn-primary" %> <%= f.submit "Import", class: "btn btn-primary" %>
<% end %> <% end %>