Merge branch 'nccu_fix' of github.com:Rulingcom/NCCU into nccu_fix_matt

This commit is contained in:
Matthew K. Fu JuYuan 2012-08-07 19:22:16 +08:00
commit fe4aadef29
4 changed files with 10 additions and 4 deletions

View File

@ -26,7 +26,7 @@ gem 'mysql2'
gem 'nokogiri' gem 'nokogiri'
gem 'radius' gem 'radius'
gem 'rake' gem 'rake'
gem 'remotipart' # gem 'remotipart'
gem 'resque' # background jobs gem 'resque' # background jobs
gem 'resque-scheduler' # job scheduling gem 'resque-scheduler' # job scheduling
gem 'resque-restriction' gem 'resque-restriction'

View File

@ -2,6 +2,12 @@ $(document).on('click', '#ajax_form_submit', function(){
$('#ajaxForm').ajaxSubmit({ $('#ajaxForm').ajaxSubmit({
beforeSubmit: function(a,f,o) { beforeSubmit: function(a,f,o) {
o.dataType = 'script'; 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)
}
} }
}); });
}); });

View File

@ -17,4 +17,4 @@
//= require side_bar_history //= require side_bar_history
//= require rss //= require rss
//= require ajax_form //= require ajax_form
//= require jquery.remotipart //= require inc/ajax_setting

View File

@ -3,7 +3,7 @@
<%= flash_messages %> <%= 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| %>
<div class="modal-header"> <div class="modal-header">
<h3><%= t 'admin.file_upload' %></h3> <h3><%= t 'admin.file_upload' %></h3>
</div> </div>
@ -51,7 +51,7 @@
</div> </div>
<div style="position: absolute; width: 100%; bottom: 0;"> <div style="position: absolute; width: 100%; bottom: 0;">
<div class="modal-footer"> <div class="modal-footer">
<%= f.submit t(:create), :class => "btn btn-primary" %> <a id='ajax_form_submit' class="btn btn-primary"><%= t(:create) %></a>
</div> </div>
</div> </div>