active_admin-sortable_tree 1.0.0 → 2.0.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
- SHA1:
3
- metadata.gz: 126d784b9ce06a5c29ba502eb96104ef3108d7f0
4
- data.tar.gz: 50aa4cbe40c74b9c19354da0444456130c283569
2
+ SHA256:
3
+ metadata.gz: e0e22264b733cb656adcdd397fe186a6e4de1fbfe06e55d7e45f361f66022cf3
4
+ data.tar.gz: f83027613f9891cbabe4e9ba39e52380811f753a51b0f787750a36459d82b386
5
5
  SHA512:
6
- metadata.gz: d2755222fb58155f57c43ba3bf257eb0d7ef0aac652d2f8243af10d2c23c0c8f0ec972f5b4d77c18e530a2d2a9a49c596ef0accc1e808734d0bb7615b39f47c7
7
- data.tar.gz: a3732fc8fe9ec410f7d1ab94e28aa8676f29ef1837f27db0d16950d5efc06d8c6230d8b5d4e0f7001c6a2a984f1aa338b62d4023fcaae34e7566545e4f04a031
6
+ metadata.gz: e8d5e6495c061de3bbde7dccc1252bb6df52d7a2179f24b26dfd7383f150d04b64dec6b8effe4b74fb546986566c33bb80d1903f1eb1925354f3a923e0819d2e
7
+ data.tar.gz: f0057f2bbbc9e978c043f4ee815f1b8de90006d0d8f29b9ee5789168ab282f32b7fa08c1c99e244df7082861c3895145698b0a3d55cb8184ffc0bbef084988c5
@@ -2,6 +2,27 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [2.0.0] - 2018-01-22
6
+
7
+ ### Changed
8
+
9
+ - Depend on same version of `jquery-ui-rails` as ActiveAdmin
10
+ - Update dependencies to only support ActiveAdmin `< 1.1.0` because `v1.1.0`
11
+ [dropped its dependency on `jquery-ui-rails`](https://github.com/activeadmin/activeadmin/blob/master/CHANGELOG.md).
12
+ - Remove usage of bourbon mixin; instead rely on ActiveAdmin's utilities mixin
13
+ (fixes #73)
14
+
15
+ ### Removed
16
+
17
+ - Remove support for Rails 3.2
18
+ - Remove support for ActiveAdmin 0.6.6
19
+
20
+ ### Upgrading from 1.0.0
21
+
22
+ It is suggested (but not required) to manually include the JavaScript and
23
+ stylesheet to your manifest files in preparation for ActiveAdmin v2.0. See the
24
+ Installation section of the [README.md](README.md#installation) for instructions.
25
+
5
26
  ## [1.0.0] - 2017-06-01
6
27
 
7
28
  ### Added
@@ -51,3 +72,4 @@ All notable changes to this project will be documented in this file.
51
72
  [0.2.1]: https://github.com/zorab47/active_admin-sortable_tree/compare/v0.2.0...v0.2.1
52
73
  [0.3.0]: https://github.com/zorab47/active_admin-sortable_tree/compare/v0.2.1...v0.3.0
53
74
  [1.0.0]: https://github.com/zorab47/active_admin-sortable_tree/compare/v0.3.0...v1.0.0
75
+ [1.1.0]: https://github.com/zorab47/active_admin-sortable_tree/compare/v1.0.0...v1.1.0
data/README.md CHANGED
@@ -10,17 +10,22 @@ sortable via drag'n'drop.
10
10
 
11
11
  ## Installation
12
12
 
13
- ```ruby
14
- # Gemfile
15
- gem "active_admin-sortable_tree"
16
- ```
13
+ 1. Add SortableTree to your Gemfile; then `bundle install`
14
+ ```ruby
15
+ gem "active_admin-sortable_tree", "~> 2.0.0"
16
+ ```
17
17
 
18
- Note: If you experience issues with drag and drop capability, you may need to specify the version for your ActiveAdmin installation. It is reported working using v0.6.6, or if you are using v1.0.0.pre, it is reported working on this commit [b3a9f4b](https://github.com/activeadmin/activeadmin/commit/b3a9f4b3e4051447d011c59649a73f876989a199) or later.
18
+ 2. Add a require to your JavaScript manifest `app/assets/javascripts/active_admin.js`
19
19
 
20
- ```ruby
21
- # Gemfile
22
- gem 'activeadmin', github: 'activeadmin', ref: 'b3a9f4b'
23
- ```
20
+ ```javascript
21
+ //= require active_admin/sortable
22
+ ```
23
+
24
+ 3. Add an import in your stylesheet manifest `app/assets/javascripts/active_admin.js`
25
+
26
+ ```sass
27
+ @import "active_admin/sortable";
28
+ ```
24
29
 
25
30
  ## Usage (Tree)
26
31
 
@@ -152,12 +157,11 @@ In `IndexAsSortable` you can add custom actions (with or without the defaults):
152
157
  ```ruby
153
158
  index :as => :sortable do
154
159
  actions defaults: false do |page|
155
- link_to "Custom action", my_custon_path(page)
160
+ link_to "Custom action", my_custom_path(page)
156
161
  end
157
162
  end
158
163
  ```
159
164
 
160
-
161
165
  ### Ajax Callback Config
162
166
 
163
167
  It exposes three Ajax Events: ajaxDone, ajaxFail and ajaxAlways, which
@@ -171,6 +175,29 @@ ActiveAdminSortableEvent.add('ajaxDone', function (){
171
175
  })
172
176
  ```
173
177
 
178
+ ### Upgrading to SortableTree 2.0 from 1.0
179
+
180
+ Upgrading from SortableTree 1.x requires manually specifying assets in your
181
+ `app/assets/javascripts/active_admin.js` and `app/assets/stylesheets/active_admin.scss`
182
+ files.
183
+
184
+
185
+ ### Dependencies
186
+
187
+ ActiveAdmin::SortableTree 2.0 supports ActiveAdmin 1.0.0+. For previous versions
188
+ of ActiveAdmin use older SortableTree versions from the 1.x branch.
189
+
190
+ Note: If you experience issues with drag and drop capability, you may need to
191
+ specify the version for your ActiveAdmin installation. It is reported working
192
+ using v0.6.6, or if you are using v1.0.0.pre, it is reported working on this
193
+ commit [b3a9f4b](https://github.com/activeadmin/activeadmin/commit/b3a9f4b3e4051447d011c59649a73f876989a199)
194
+ or later.
195
+
196
+ ```ruby
197
+ # Gemfile
198
+ gem 'activeadmin', github: 'activeadmin', ref: 'b3a9f4b'
199
+ ```
200
+
174
201
  ## Semantic Versioning
175
202
 
176
203
  ActiveAdmin::SortableTree follows [semantic versioning](http://semver.org).
@@ -1,2 +1,72 @@
1
1
  #= require jquery-ui/widgets/sortable
2
- #= require active_admin/sortable_core
2
+ #= require jquery.mjs.nestedSortable
3
+
4
+ window.ActiveAdminSortableEvent = do ->
5
+ eventToListeners = {}
6
+
7
+ return {
8
+ add: (event, callback) ->
9
+ if not eventToListeners.hasOwnProperty(event)
10
+ eventToListeners[event] = []
11
+ eventToListeners[event].push(callback)
12
+
13
+ trigger: (event, args) ->
14
+ if eventToListeners.hasOwnProperty(event)
15
+ for callback in eventToListeners[event]
16
+ try
17
+ callback.call(null, args)
18
+ catch e
19
+ console.error(e) if console and console.error
20
+ }
21
+
22
+ $ ->
23
+ $('.disclose').bind 'click', (event) ->
24
+ $(this).closest('li').toggleClass('mjs-nestedSortable-collapsed').toggleClass('mjs-nestedSortable-expanded')
25
+
26
+ $(".index_as_sortable [data-sortable-type]").each ->
27
+ $this = $(@)
28
+
29
+ if $this.data('sortable-type') == "tree"
30
+ max_levels = $this.data('max-levels')
31
+ tab_hack = 20 # nestedSortable default
32
+ else
33
+ max_levels = 1
34
+ tab_hack = 99999
35
+
36
+ $this.nestedSortable
37
+ forcePlaceholderSize: true
38
+ forceHelperSizeType: true
39
+ errorClass: 'cantdoit'
40
+ disableNesting: 'cantdoit'
41
+ handle: '> .item'
42
+ listType: 'ol'
43
+ items: 'li'
44
+ opacity: .6
45
+ placeholder: 'placeholder'
46
+ revert: 250
47
+ maxLevels: max_levels,
48
+ tabSize: tab_hack
49
+ protectRoot: $this.data('protect-root')
50
+ # prevent drag flickers
51
+ tolerance: 'pointer'
52
+ toleranceElement: '> div'
53
+ isTree: true
54
+ startCollapsed: $this.data("start-collapsed")
55
+ update: ->
56
+ $this.nestedSortable("disable")
57
+ $.ajax
58
+ url: $this.data("sortable-url")
59
+ type: "post"
60
+ data: $this.nestedSortable("serialize")
61
+ .always ->
62
+ $this.find('.item').each (index) ->
63
+ if index % 2
64
+ $(this).removeClass('odd').addClass('even')
65
+ else
66
+ $(this).removeClass('even').addClass('odd')
67
+ $this.nestedSortable("enable")
68
+ ActiveAdminSortableEvent.trigger('ajaxAlways')
69
+ .done ->
70
+ ActiveAdminSortableEvent.trigger('ajaxDone')
71
+ .fail ->
72
+ ActiveAdminSortableEvent.trigger('ajaxFail')
@@ -3,7 +3,7 @@ $cRowBorder: #e8e8e8
3
3
  $cRowSelected: #d9e4ec
4
4
  $cRowError: rgb(255,87,87)
5
5
 
6
- @import bourbon
6
+ @import "active_admin/mixins/utilities"
7
7
 
8
8
  body.active_admin
9
9
  .disclose
@@ -1,32 +1,20 @@
1
- require 'activeadmin'
2
- require "rubygems"
1
+ require "activeadmin"
3
2
 
4
3
  module ActiveAdmin
5
4
  module SortableTree
6
5
  class Engine < ::Rails::Engine
7
- engine_name 'active_admin-sortable_tree'
6
+ engine_name "active_admin-sortable_tree"
8
7
 
9
-
10
- def jquery_ui_six?
11
- Gem::Version.new(Jquery::Ui::Rails::VERSION) >= Gem::Version.new("6.0.0")
12
- end
13
-
14
- def sortable_js
15
- if jquery_ui_six?
8
+ initializer "active_admin-sortable_tree.precompile", group: :all do |app|
9
+ app.config.assets.precompile += [
10
+ "active_admin/sortable.css",
16
11
  "active_admin/sortable.js"
17
- else
18
- "active_admin/sortable_ui5.js"
19
- end
20
- end
21
-
22
- initializer "Rails precompile hook", group: :all do |app|
23
- app.config.assets.precompile += [ "active_admin/sortable.css",
24
- sortable_js ]
12
+ ]
25
13
  end
26
14
 
27
- initializer "add assets" do
15
+ initializer "active_admin-sortable_tree.register_assets" do
28
16
  ActiveAdmin.application.register_stylesheet "active_admin/sortable.css"
29
- ActiveAdmin.application.register_javascript sortable_js
17
+ ActiveAdmin.application.register_javascript "active_admin/sortable.js"
30
18
  end
31
19
  end
32
20
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveAdmin
2
2
  module SortableTree
3
- VERSION = "1.0.0"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_admin-sortable_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesco Disperati
@@ -9,50 +9,64 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-06-01 00:00:00.000000000 Z
12
+ date: 2018-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rails
15
+ name: activeadmin
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '3.2'
20
+ version: '1.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.2'
27
+ version: '1.1'
28
28
  - !ruby/object:Gem::Dependency
29
- name: activeadmin
29
+ name: coffee-rails
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '0.6'
34
+ version: '0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '0.6'
41
+ version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: jquery-ui-rails
43
+ name: jquery-rails
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '5.0'
48
+ version: '0'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: '5.0'
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: sass
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.1'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '3.1'
56
70
  - !ruby/object:Gem::Dependency
57
71
  name: capybara
58
72
  requirement: !ruby/object:Gem::Requirement
@@ -136,8 +150,6 @@ files:
136
150
  - MIT-LICENSE
137
151
  - README.md
138
152
  - app/assets/javascripts/active_admin/sortable.js.coffee
139
- - app/assets/javascripts/active_admin/sortable_core.js.coffee
140
- - app/assets/javascripts/active_admin/sortable_ui5.js.coffee
141
153
  - app/assets/stylesheets/active_admin/sortable.sass
142
154
  - lib/active_admin/sortable_tree.rb
143
155
  - lib/active_admin/sortable_tree/compatibility.rb
@@ -168,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
180
  version: '0'
169
181
  requirements: []
170
182
  rubyforge_project:
171
- rubygems_version: 2.5.2
183
+ rubygems_version: 2.7.3
172
184
  signing_key:
173
185
  specification_version: 4
174
186
  summary: Add drag and drop sorting to ActiveAdmin resources
@@ -1,71 +0,0 @@
1
- #= require jquery.mjs.nestedSortable
2
-
3
- window.ActiveAdminSortableEvent = do ->
4
- eventToListeners = {}
5
-
6
- return {
7
- add: (event, callback) ->
8
- if not eventToListeners.hasOwnProperty(event)
9
- eventToListeners[event] = []
10
- eventToListeners[event].push(callback)
11
-
12
- trigger: (event, args) ->
13
- if eventToListeners.hasOwnProperty(event)
14
- for callback in eventToListeners[event]
15
- try
16
- callback.call(null, args)
17
- catch e
18
- console.error(e) if console and console.error
19
- }
20
-
21
- $ ->
22
- $('.disclose').bind 'click', (event) ->
23
- $(this).closest('li').toggleClass('mjs-nestedSortable-collapsed').toggleClass('mjs-nestedSortable-expanded')
24
-
25
- $(".index_as_sortable [data-sortable-type]").each ->
26
- $this = $(@)
27
-
28
- if $this.data('sortable-type') == "tree"
29
- max_levels = $this.data('max-levels')
30
- tab_hack = 20 # nestedSortable default
31
- else
32
- max_levels = 1
33
- tab_hack = 99999
34
-
35
- $this.nestedSortable
36
- forcePlaceholderSize: true
37
- forceHelperSizeType: true
38
- errorClass: 'cantdoit'
39
- disableNesting: 'cantdoit'
40
- handle: '> .item'
41
- listType: 'ol'
42
- items: 'li'
43
- opacity: .6
44
- placeholder: 'placeholder'
45
- revert: 250
46
- maxLevels: max_levels,
47
- tabSize: tab_hack
48
- protectRoot: $this.data('protect-root')
49
- # prevent drag flickers
50
- tolerance: 'pointer'
51
- toleranceElement: '> div'
52
- isTree: true
53
- startCollapsed: $this.data("start-collapsed")
54
- update: ->
55
- $this.nestedSortable("disable")
56
- $.ajax
57
- url: $this.data("sortable-url")
58
- type: "post"
59
- data: $this.nestedSortable("serialize")
60
- .always ->
61
- $this.find('.item').each (index) ->
62
- if index % 2
63
- $(this).removeClass('odd').addClass('even')
64
- else
65
- $(this).removeClass('even').addClass('odd')
66
- $this.nestedSortable("enable")
67
- ActiveAdminSortableEvent.trigger('ajaxAlways')
68
- .done ->
69
- ActiveAdminSortableEvent.trigger('ajaxDone')
70
- .fail ->
71
- ActiveAdminSortableEvent.trigger('ajaxFail')
@@ -1,2 +0,0 @@
1
- #= require jquery-ui/sortable
2
- #= require active_admin/sortable_core