From 5d1974605eaa12c766f88ce4c1261d895a7833c6 Mon Sep 17 00:00:00 2001 From: viktorvsk Date: Thu, 23 Apr 2026 04:56:19 +0000 Subject: [PATCH] feat: add file upload to word import form --- app/views/words/index.html.erb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/views/words/index.html.erb b/app/views/words/index.html.erb index 0e3d5ea..2bf63eb 100644 --- a/app/views/words/index.html.erb +++ b/app/views/words/index.html.erb @@ -46,11 +46,16 @@

Import words

- One entry per line. Formats: word - definition  |  + One entry per line or upload a .txt/.csv file. + Formats: word - definition  |  word: definition  |  word | definition  |  just word

- <%= 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| %> +
+ <%= f.file_field :word_file, accept: ".txt,.csv,.tsv", class: "file-input" %> + or paste below +
<%= 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" %> <% end %>