active_scaffold_sortable 3.3.10 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d70b6e4f025e689fb53925722bb1deda409627cbdcede20161190c3ca10b76b9
4
- data.tar.gz: 81885ddbf593c12ad5961b22a7a0058a6afdc4c02486fc5125ca582f3181fe51
3
+ metadata.gz: 548a760ce00526629966fd4abbff3f0a5fe4cae3dbfbd676e4dc1aa1734c5360
4
+ data.tar.gz: 9c8071449474ffe07d8841bf3b9f32c2c6c6086e27edee193af90dab4a00a981
5
5
  SHA512:
6
- metadata.gz: 6e6230b9887d5541c296736408abad598dedf220ab60364a59e2d0ca40e7faee04bb159758f32939adcfaea03d7f710917e94774baface663f453833a3115fa5
7
- data.tar.gz: 425dc8d853fcd44e17a3d4fce9a4b4e0a83f5da637d7013e23eb9b386133175b3b1d41efa2a16319c2ae6df938015c67e690317ccad2bb4e28556bf1854c06b4
6
+ metadata.gz: 2131e8b08e86c8e7f718bbb7ff5f7e3b8391f55141a0be8dc819f7c54e8e9ccebf4edc7a215b3e4159b006fef0bee2438b42296ff8f2c33a55f882f46f4192f8
7
+ data.tar.gz: a7c744ea5ab9611e5051ee0d42e365e929a74830c4cb61c2340a59988ab3d273cc564f514713b19fafa78777f62f722140b51d536c76a18cda238d4145707f34
@@ -37,7 +37,7 @@ ActiveScaffold.sortable = function(element) {
37
37
  element = jQuery(element);
38
38
  form = element.closest('form.as_form').length > 0;
39
39
  if (form) content = element;
40
- else content = element.find('.records:first');
40
+ else content = element.find(element.data('contentSelector') || '.records:first');
41
41
  }
42
42
 
43
43
  if (form) {
@@ -49,7 +49,8 @@ ActiveScaffold.sortable = function(element) {
49
49
  if (url) {
50
50
  var csrf = jQuery('meta[name=csrf-param]').attr('content') + '=' + jQuery('meta[name=csrf-token]').attr('content');
51
51
  sortable_options.update = function(event, ui) {
52
- var body = jQuery(this).sortable('serialize',{key: encodeURIComponent(jQuery(this).attr('id') + '[]'), expression: new RegExp(element.data('format'))});
52
+ var $this = jQuery(this),
53
+ body = $this.sortable('serialize',{key: encodeURIComponent(($this.data('key') || $this.attr('id')) + '[]'), expression: new RegExp(element.data('format'))});
53
54
  var params = element.data('with');
54
55
  if (params) body += '&' + params;
55
56
  jQuery.post(url, body + '&' + csrf);
@@ -1,4 +1,20 @@
1
1
  module ActiveScaffoldSortable
2
2
  class Engine < ::Rails::Engine
3
+ initializer 'active_scaffold_sortable.routes' do
4
+ ActiveSupport.on_load :active_scaffold_routing do
5
+ self::ACTIVE_SCAFFOLD_CORE_ROUTING[:collection][:reorder] = :post
6
+ end
7
+ end
8
+
9
+ initializer 'active_scaffold_sortable.action_view' do
10
+ ActiveSupport.on_load :action_view do
11
+ ActionView::Base.send :include, ActiveScaffoldSortable::ViewHelpers
12
+ end
13
+ end
14
+
15
+ initializer 'active_scaffold_sortable.extensions' do
16
+ ActiveScaffold::Config::Core.send :prepend, ActiveScaffoldSortable::Core
17
+ ActiveScaffold::AttributeParams.send :prepend, ActiveScaffoldSortable::AttributeParams
18
+ end
3
19
  end
4
20
  end
@@ -1,8 +1,8 @@
1
1
  module ActiveScaffoldSortable
2
2
  module Version
3
3
  MAJOR = 3
4
- MINOR = 3
5
- PATCH = 10
4
+ MINOR = 5
5
+ PATCH = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -1,13 +1,12 @@
1
- require "active_scaffold_sortable/config/core.rb"
2
- require "active_scaffold_sortable/core.rb"
3
- require "active_scaffold_sortable/attribute_params.rb"
4
- require "active_scaffold_sortable/engine.rb" unless defined? ACTIVE_SCAFFOLD_SORTABLE_PLUGIN
1
+ require "active_scaffold_sortable/engine.rb"
5
2
 
6
3
  module ActiveScaffoldSortable
7
4
  def self.root
8
5
  File.dirname(__FILE__) + "/.."
9
6
  end
7
+ autoload 'Core', 'active_scaffold_sortable/core.rb'
10
8
  autoload 'ViewHelpers', 'active_scaffold_sortable/view_helpers.rb'
9
+ autoload 'AttributeParams', 'active_scaffold_sortable/attribute_params.rb'
11
10
  end
12
11
 
13
12
  module ActiveScaffold
@@ -23,8 +22,5 @@ module ActiveScaffold
23
22
  ActiveScaffold.autoload_subdir('helpers', self, File.dirname(__FILE__))
24
23
  end
25
24
  end
26
- ActionView::Base.send :include, ActiveScaffoldSortable::ViewHelpers
27
- ActiveScaffold::Config::Core.send :prepend, ActiveScaffoldSortable::Core
28
- ActiveScaffold::AttributeParams.send :prepend, ActiveScaffoldSortable::AttributeParams
29
25
  ActiveScaffold.stylesheets << 'active_scaffold_sortable'
30
26
  ActiveScaffold.javascripts << 'active_scaffold_sortable'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold_sortable
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.10
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Cambra
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-02-20 00:00:00.000000000 Z
12
+ date: 2024-04-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: active_scaffold
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 3.6.0.pre
20
+ version: 3.7.1
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 3.6.0.pre
27
+ version: 3.7.1
28
28
  description: Sort Tree or List Structures by Drag n Drop
29
29
  email: activescaffold@googlegroups.com
30
30
  executables: []
@@ -51,7 +51,6 @@ files:
51
51
  - lib/active_scaffold/helpers/sortable_helpers.rb
52
52
  - lib/active_scaffold_sortable.rb
53
53
  - lib/active_scaffold_sortable/attribute_params.rb
54
- - lib/active_scaffold_sortable/config/core.rb
55
54
  - lib/active_scaffold_sortable/core.rb
56
55
  - lib/active_scaffold_sortable/engine.rb
57
56
  - lib/active_scaffold_sortable/version.rb
@@ -85,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
84
  - !ruby/object:Gem::Version
86
85
  version: '0'
87
86
  requirements: []
88
- rubygems_version: 3.3.7
87
+ rubygems_version: 3.2.3
89
88
  signing_key:
90
89
  specification_version: 4
91
90
  summary: Drag n Drop Sorting for Activescaffold
@@ -1,4 +0,0 @@
1
- # Need to open the AS module carefully due to Rails 2.3 lazy loading
2
- ActiveScaffold::Config::Core.class_eval do
3
- ActiveScaffold::Routing::ACTIVE_SCAFFOLD_CORE_ROUTING[:collection][:reorder] = :post
4
- end