active_scaffold_sortable 3.4.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32d846a77db73022d77fae9f89593c42fc18f4146a1c694ad3deb66b02e2b1cd
4
- data.tar.gz: 8d82537f1748352064e4100c03feaa663369c45cde7c35ce743f52e34f7c4204
3
+ metadata.gz: 6a2ba69a2e3d71c06c7263f86fb9c7a1e005dd292fcf0e364b45d3c2c6e724a6
4
+ data.tar.gz: 4d57add1e0531ac0b6744340b4b4430246a479d07a42e68ee3f3be180e2e1270
5
5
  SHA512:
6
- metadata.gz: e31694f1969a08cb691c27efae01488e6b255913b13dddb82abdb1c1a925f763b6cdc754c8e9cba002f50181baed071e370e788ad5b2fbc2896ddc7fb5d66456
7
- data.tar.gz: 233c34441179b5478ab70f7afeda6d5c4c7b731f2db9611c0d110c7821496bae33ff83644678520b4cd3c363740157673d06517608ae187656b6628a89c66695
6
+ metadata.gz: 25f72fc6addcd4f173f9b2ca35033c6fa195e16a2b28de828a4d8f73c87867ad95905f160d3a8dd0c8b8f8a0a831f7daa5067f295e16dd7190a3e168400b6eb9
7
+ data.tar.gz: b77eaea4a0770abbaf5ec1c22649e28290b59a3a281d0d7fb460252e2a29c85f8f352cfe7989066b8a8bb46690a881f59eaf75d0b3a0b6d8befa3c1f2904199f
@@ -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,7 +1,7 @@
1
1
  module ActiveScaffoldSortable
2
2
  module Version
3
3
  MAJOR = 3
4
- MINOR = 4
4
+ MINOR = 6
5
5
  PATCH = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
@@ -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.4.0
4
+ version: 3.6.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-12-04 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: 4.0.0.rc1
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: 4.0.0.rc1
28
28
  description: Sort Tree or List Structures by Drag n Drop
29
29
  email: activescaffold@googlegroups.com
30
30
  executables: []
@@ -36,9 +36,7 @@ files:
36
36
  - LICENSE.txt
37
37
  - README.textile
38
38
  - app/assets/images/active_scaffold/sortable.png
39
- - app/assets/javascripts/active_scaffold_sortable.js.erb
40
- - app/assets/javascripts/jquery/active_scaffold_sortable.js
41
- - app/assets/javascripts/prototype/active_scaffold_sortable.js
39
+ - app/assets/javascripts/active_scaffold_sortable.js
42
40
  - app/assets/stylesheets/active_scaffold_sortable.css.scss
43
41
  - app/views/active_scaffold_overrides/_form_association.html.erb
44
42
  - app/views/active_scaffold_overrides/edit_associated.js.erb
@@ -51,7 +49,6 @@ files:
51
49
  - lib/active_scaffold/helpers/sortable_helpers.rb
52
50
  - lib/active_scaffold_sortable.rb
53
51
  - lib/active_scaffold_sortable/attribute_params.rb
54
- - lib/active_scaffold_sortable/config/core.rb
55
52
  - lib/active_scaffold_sortable/core.rb
56
53
  - lib/active_scaffold_sortable/engine.rb
57
54
  - lib/active_scaffold_sortable/version.rb
@@ -85,18 +82,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
82
  - !ruby/object:Gem::Version
86
83
  version: '0'
87
84
  requirements: []
88
- rubygems_version: 3.3.7
85
+ rubygems_version: 3.5.11
89
86
  signing_key:
90
87
  specification_version: 4
91
88
  summary: Drag n Drop Sorting for Activescaffold
92
89
  test_files:
90
+ - test/auto_models_controller_test.rb
93
91
  - test/config_test.rb
94
- - test/models/model.rb
92
+ - test/controllers/auto_models_controller.rb
93
+ - test/controllers/models_controller.rb
94
+ - test/controllers/sortable_models_controller.rb
95
95
  - test/models/auto_model.rb
96
+ - test/models/model.rb
96
97
  - test/router_test.rb
97
- - test/test_helper.rb
98
- - test/auto_models_controller_test.rb
99
98
  - test/schema.rb
100
- - test/controllers/auto_models_controller.rb
101
- - test/controllers/sortable_models_controller.rb
102
- - test/controllers/models_controller.rb
99
+ - test/test_helper.rb
@@ -1 +0,0 @@
1
- <% require_asset "#{ActiveScaffold.js_framework}/active_scaffold_sortable" %>
@@ -1,34 +0,0 @@
1
- ActiveScaffold.sortable = function(element) {
2
- var form, content, sortable_options = {};
3
- if (typeof(element) == 'string') {
4
- content = $(element);
5
- element = content.up('.sortable-container');
6
- } else {
7
- var form = !!element.up('form.as_form');
8
- if (form) content = element;
9
- else content = element.down('.records');
10
- }
11
-
12
- if (!form) {
13
- var csrf = $$('meta[name=csrf-param]')[0].readAttribute('content') + '=' + $$('meta[name=csrf-token]')[0].readAttribute('content');
14
- var url = element.readAttribute('data-reorder-url').append_params(csrf);
15
- sortable_options.onUpdate = function() {
16
- var body = Sortable.serialize(content);
17
- var params = element.readAttribute('data-with');
18
- if (params) body += '&' + params;
19
- new Ajax.Request(url, {method: 'post', parameters: body + '&' + csrf});
20
- }
21
- }
22
- sortable_options.handle = element.readAttribute('data-handle');
23
- sortable_options.items = element.readAttribute('data-tag');
24
- Sortable.create(content, sortable_options);
25
- };
26
-
27
- document.observe('dom:loaded', function(){
28
- document.on('as:action_success', 'a.as_action', function(e, action_link) {
29
- var sortable = $(action_link.adapter).find('.sortable-container');
30
- if (sortable.length) sortable.invoke(function(s) { ActiveScaffold.sortable(s); });
31
- });
32
- var sortable = $$('.sortable-container');
33
- if (sortable.length) ActiveScaffold.sortable(sortable[0]);
34
- });
@@ -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