diff --git a/Gemfile b/Gemfile index 6e07eafa..7b12d5c0 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,7 @@ gem 'mysql2' gem 'nokogiri' gem 'radius' gem 'rake' -gem 'remotipart' +# gem 'remotipart' gem 'resque' # background jobs gem 'resque-scheduler' # job scheduling gem 'resque-restriction' diff --git a/app/assets/javascripts/ajax_form.js b/app/assets/javascripts/ajax_form.js index d9b5abfe..26218a08 100644 --- a/app/assets/javascripts/ajax_form.js +++ b/app/assets/javascripts/ajax_form.js @@ -2,6 +2,12 @@ $(document).on('click', '#ajax_form_submit', function(){ $('#ajaxForm').ajaxSubmit({ beforeSubmit: function(a,f,o) { o.dataType = 'script'; + if (o.dataType == 'script') { + o.url = o.url.split('?'); // split on GET params + if (o.url[0].substr(-3) != '.js') o.url[0] += '.js'; // force rails to respond to respond to the request with :format = js + o.url = o.url.join('?'); // join on GET params + alert(o.url) + } } }); }); \ No newline at end of file diff --git a/app/assets/javascripts/new_admin.js b/app/assets/javascripts/new_admin.js index 0c9f30df..949753a9 100644 --- a/app/assets/javascripts/new_admin.js +++ b/app/assets/javascripts/new_admin.js @@ -17,4 +17,4 @@ //= require side_bar_history //= require rss //= require ajax_form -//= require jquery.remotipart +//= require inc/ajax_setting diff --git a/app/views/admin/assets/file_upload.html.erb b/app/views/admin/assets/file_upload.html.erb index d267b674..abdcfbc6 100644 --- a/app/views/admin/assets/file_upload.html.erb +++ b/app/views/admin/assets/file_upload.html.erb @@ -3,7 +3,7 @@ <%= flash_messages %> -<%= form_for :asset, :url => admin_assets_path(:uploader => true), :remote => true do |f| %> +<%= form_for :asset, :url => admin_assets_path(:uploader => true), :html => {:id => 'ajaxForm', :multipart => true } do |f| %>