1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 07:39:39 +02:00

Allow CSV file upload in import flow (#986)

* Add .tool-versions to gitignore

* Add dropzone js for drag and drop file uploads

* UI for csv file uploads for import

* dropzone controller and use lucide_icon instead of svg

* Preview for file chosen

* File upload

* Remove dropzone

* Normalize I18n keys and fix lint issues

* Add system tests

* Cleanup

* Remove unwanted
This commit is contained in:
Tony Vincent 2024-07-16 15:23:45 +02:00 committed by GitHub
parent 41f9e23f8c
commit cdbca5aff3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 307 additions and 41 deletions

View file

@ -38,6 +38,21 @@ class ImportsController < ApplicationController
def load
end
def upload_csv
begin
@import.raw_csv_str = import_params[:raw_csv_str].read
rescue NoMethodError
flash.now[:error] = "Please select a file to upload"
render :load, status: :unprocessable_entity and return
end
if @import.save
redirect_to configure_import_path(@import), notice: t(".import_loaded")
else
flash.now[:error] = @import.errors.full_messages.to_sentence
render :load, status: :unprocessable_entity
end
end
def load_csv
if @import.update(import_params)
redirect_to configure_import_path(@import), notice: t(".import_loaded")