add drag and drop file uploads w/async processing

[skip ci]
This commit is contained in:
Albert Yi
2018-06-06 14:55:27 -07:00
parent e808a4f7cb
commit 0e6c358701
9 changed files with 375 additions and 155 deletions

View File

@@ -1,10 +1,13 @@
class UploadsController < ApplicationController
before_action :member_only, except: [:index, :show]
respond_to :html, :xml, :json, :js
skip_before_action :verify_authenticity_token, only: [:preprocess]
def new
@upload_notice_wiki = WikiPage.titled(Danbooru.config.upload_notice_wiki_page).first
@upload, @post, @source, @normalized_url, @remote_size = UploadService::ControllerHelper.prepare(params[:url], params[:ref])
@upload, @post, @source, @normalized_url, @remote_size = UploadService::ControllerHelper.prepare(
url: params[:url], ref: params[:ref]
)
respond_with(@upload)
end
@@ -39,6 +42,13 @@ class UploadsController < ApplicationController
end
end
def preprocess
@upload, @post, @source, @normalized_url, @remote_size = UploadService::ControllerHelper.prepare(
url: params[:url], file: params[:file], ref: params[:ref]
)
render body: nil
end
def create
@service = UploadService.new(upload_params)
@upload = @service.start!