2011-10-30 23:02:41 +00:00
|
|
|
module Locomotive
|
2011-07-04 13:25:02 +00:00
|
|
|
class ImportController < BaseController
|
2010-09-28 22:08:11 +00:00
|
|
|
|
|
|
|
sections 'settings', 'site'
|
|
|
|
|
2011-06-26 23:02:48 +00:00
|
|
|
skip_load_and_authorize_resource
|
|
|
|
|
|
|
|
before_filter :authorize_import
|
|
|
|
|
2011-12-11 22:33:38 +00:00
|
|
|
respond_to :json, :only => :show
|
|
|
|
|
2010-09-28 22:08:11 +00:00
|
|
|
def show
|
2011-12-08 15:47:17 +00:00
|
|
|
@import = Locomotive::Import::Model.current(current_site)
|
|
|
|
respond_with @import
|
2010-09-28 22:08:11 +00:00
|
|
|
end
|
|
|
|
|
2011-11-20 10:59:12 +00:00
|
|
|
def new
|
2011-12-08 15:47:17 +00:00
|
|
|
@import = Locomotive::Import::Model.new
|
|
|
|
respond_with @import
|
2011-11-20 10:59:12 +00:00
|
|
|
end
|
2010-09-28 22:08:11 +00:00
|
|
|
|
|
|
|
def create
|
2011-12-08 15:47:17 +00:00
|
|
|
@import = Locomotive::Import::Model.create(params[:import].merge(:site => current_site))
|
|
|
|
respond_with @import, :location => Locomotive.config.delayed_job ? import_url : new_import_url
|
2010-09-28 22:08:11 +00:00
|
|
|
end
|
|
|
|
|
2011-06-26 23:02:48 +00:00
|
|
|
protected
|
|
|
|
|
|
|
|
def authorize_import
|
2011-06-27 15:27:07 +00:00
|
|
|
authorize! :import, Site
|
2011-06-26 23:02:48 +00:00
|
|
|
end
|
|
|
|
|
2010-09-28 22:08:11 +00:00
|
|
|
end
|
2011-12-11 22:33:38 +00:00
|
|
|
end
|