It looks like you might have to create a custom action and view. One way to do that would be to use this custom actions plugin. There is also a tutorial about how to build a custom action here. I also used SmarterCSV, and it works brilliantly.
To register a custom action with Rails Admin, you would do this in config/initializers/rails_admin.rb :
module RailsAdmin
module Config
module Actions
class YourClass < RailsAdmin::Config::Actions::Base
RailsAdmin::Config::Actions.register(self)
##code here, as explained more below
end
end
end
end
In this class, you can inherit any of the base actions. So to register a custom partial, in that class you would do:
# View partial name (called in default :controller block)
register_instance_option :template_name do
:your_class
end
Your _your_class partials must be in app/views/rails_admin/main/, you can handle the form with multipart.. I'm not including the partial code, if you want me to take a swing at it let me know.
You will probably also want your action on the model scope:
register_instance_option :collection? do
true
end
And put your controller code in. It would probably be best to handle the processing here, for example:
register_instance_option :controller do
Proc.new do
@order = Order.import(params[:file])
f = SmarterCSV.process(file.tempfile)
f.each do |r|
#combine date and time fields
r[:date_time] = [r[:date],r[:time]].join(' ')
Order.create("date" => r[:date_time])
end
end
end
Next, your action should be registered with RailsAdmin::Config::Actions like this (This code was placed into config/initializers/rails_admin.rb):
module RailsAdmin
module Config
module Actions
class ApproveReview < RailsAdmin::Config::Actions::Base
RailsAdmin::Config::Actions.register(self)
end
end
end
end
Next, the custom action needs to be listed in the actions config in config/initializers/rails_admin.rb:
RailsAdmin.config do |config|
config.actions do
dashboard
index
new
your_class
show
edit
delete
end
end
There are more details in the tutorial, but I think that should be a pretty solid start!