Skip to content

Commit

Permalink
fix sortable without url, bump to 3.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
scambra committed Mar 8, 2013
1 parent 793b8d0 commit 802d608
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 51 deletions.
83 changes: 42 additions & 41 deletions Gemfile.lock
@@ -1,92 +1,93 @@
PATH
remote: .
specs:
active_scaffold_sortable (3.2.1)
active_scaffold (>= 3.3.0.rc)
active_scaffold_sortable (3.2.2)
active_scaffold (>= 3.3.0.rc3)

GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.5)
actionpack (= 3.2.5)
actionmailer (3.2.12)
actionpack (= 3.2.12)
mail (~> 2.4.4)
actionpack (3.2.5)
activemodel (= 3.2.5)
activesupport (= 3.2.5)
actionpack (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
rack (~> 1.4.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.3)
active_scaffold (3.3.0.rc)
sprockets (~> 2.2.1)
active_scaffold (3.3.0.rc3)
rails (~> 3.2.0)
activemodel (3.2.5)
activesupport (= 3.2.5)
activemodel (3.2.12)
activesupport (= 3.2.12)
builder (~> 3.0.0)
activerecord (3.2.5)
activemodel (= 3.2.5)
activesupport (= 3.2.5)
activerecord (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.5)
activemodel (= 3.2.5)
activesupport (= 3.2.5)
activesupport (3.2.5)
activeresource (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
activesupport (3.2.12)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
builder (3.0.4)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.1)
i18n (0.6.4)
journey (1.0.4)
json (1.7.6)
json (1.7.7)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.19)
multi_json (1.5.0)
mime-types (1.21)
multi_json (1.6.1)
polyglot (0.3.3)
rack (1.4.3)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.5)
actionmailer (= 3.2.5)
actionpack (= 3.2.5)
activerecord (= 3.2.5)
activeresource (= 3.2.5)
activesupport (= 3.2.5)
rails (3.2.12)
actionmailer (= 3.2.12)
actionpack (= 3.2.12)
activerecord (= 3.2.12)
activeresource (= 3.2.12)
activesupport (= 3.2.12)
bundler (~> 1.0)
railties (= 3.2.5)
railties (3.2.5)
actionpack (= 3.2.5)
activesupport (= 3.2.5)
railties (= 3.2.12)
railties (3.2.12)
actionpack (= 3.2.12)
activesupport (= 3.2.12)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.3)
rcov (0.9.9)
rdoc (3.12)
rdoc (3.12.2)
json (~> 1.4)
shoulda (2.11.3)
sprockets (2.1.3)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
thor (0.16.0)
tilt (1.3.3)
thor (0.17.0)
tilt (1.3.4)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.35)
tzinfo (0.3.36)

PLATFORMS
ruby
Expand Down
2 changes: 1 addition & 1 deletion active_scaffold_sortable.gemspec
Expand Up @@ -24,6 +24,6 @@ Gem::Specification.new do |s|
s.add_development_dependency(%q<shoulda>, [">= 0"])
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
s.add_development_dependency(%q<rcov>, [">= 0"])
s.add_runtime_dependency(%q<active_scaffold>, [">= 3.3.0.rc"])
s.add_runtime_dependency(%q<active_scaffold>, [">= 3.3.0.rc3"])
end

18 changes: 10 additions & 8 deletions app/assets/javascripts/jquery/active_scaffold_sortable.js
Expand Up @@ -23,14 +23,16 @@ ActiveScaffold.sortable = function(element) {
ActiveScaffold.update_positions(content);
};
} else {
var csrf = jQuery('meta[name=csrf-param]').attr('content') + '=' + jQuery('meta[name=csrf-token]').attr('content');
var url = element.data('reorder-url');
sortable_options.update = function(event, ui) {
var body = jQuery(this).sortable('serialize',{key: encodeURIComponent(jQuery(this).attr('id') + '[]'), expression: new RegExp(element.data('format'))});
var params = element.data('with');
if (params) body += '&' + params;
jQuery.post(url, body + '&' + csrf);
};
if (url) {
var csrf = jQuery('meta[name=csrf-param]').attr('content') + '=' + jQuery('meta[name=csrf-token]').attr('content');
sortable_options.update = function(event, ui) {
var body = jQuery(this).sortable('serialize',{key: encodeURIComponent(jQuery(this).attr('id') + '[]'), expression: new RegExp(element.data('format'))});
var params = element.data('with');
if (params) body += '&' + params;
jQuery.post(url, body + '&' + csrf);
};
}
}
sortable_options.handle = element.data('handle');
sortable_options.items = element.data('tag');
Expand All @@ -40,7 +42,7 @@ ActiveScaffold.sortable = function(element) {
jQuery(document).ready(function($) {
$(document).on('as:action_success', 'a.as_action', function(e, action_link) {
var sortable = $('.sortable-container', action_link.adapter);
if (sortable.length) $.each(sortable, function(i, s) { ActiveScaffold.sortable(s); });
if (sortable.length) $.each(sortable, function(i, s) { ActiveScaffold.sortable($(s)); });
});
var sortable = $('.sortable-container');
if (sortable.length) ActiveScaffold.sortable(sortable);
Expand Down
2 changes: 1 addition & 1 deletion lib/active_scaffold_sortable/version.rb
Expand Up @@ -2,7 +2,7 @@ module ActiveScaffoldSortable
module Version
MAJOR = 3
MINOR = 2
PATCH = 1
PATCH = 2

STRING = [MAJOR, MINOR, PATCH].compact.join('.')
end
Expand Down

0 comments on commit 802d608

Please sign in to comment.