activeadmin_reorderable 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -28
- data/app/assets/javascripts/activeadmin_reorderable.js +5 -2
- data/lib/activeadmin_reorderable/engine.rb +7 -0
- data/lib/activeadmin_reorderable/version.rb +1 -1
- data/package.json +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 432b1bf79ccce9af126f1d991c7a00a926a80d2e6aa3544c93650a2860591628
|
4
|
+
data.tar.gz: 71d1daeb82bb9c9631c5e947a98437478b6c347d0e55846c84b5d653dbe02aaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9969c5d1b405bbc2f00530a08b97c182a35460295f3929befc05a6288756fc908df1a8e2ad9ce9d281667b65d3bd698452248cfe712cce94fb563a0f3ba1b348
|
7
|
+
data.tar.gz: 9778aaf69204141275c167df461034b75c40033c9ab91b92db45d1a00138f573251090d0b40f5a5934e43d6dbe45e5befca8a3c28d05e9b47f7313bdfbe5e89a
|
data/README.md
CHANGED
@@ -8,6 +8,14 @@ Drag and drop to reorder your ActiveAdmin tables.
|
|
8
8
|
Your resource classes must respond to `insert_at` ala the [`acts_as_list`](https://github.com/swanandp/acts_as_list) API. You don't need to use `acts_as_list`, but if you don't, make sure to define `insert_at`.
|
9
9
|
|
10
10
|
## Installation
|
11
|
+
### Importmap
|
12
|
+
|
13
|
+
- Add `gem 'activeadmin_reorderable'` to `Gemfile` and run `bundle install`
|
14
|
+
- Add `import "activeadmin_reorderable"` to JS entrypoint (a JS file that is included for activeadmin)
|
15
|
+
- Add `@import "activeadmin_reorderable";` in your CSS style file
|
16
|
+
|
17
|
+
NOTE: no need to pin the import in your application. That's handled internally by the gem.
|
18
|
+
|
11
19
|
### Sprockets
|
12
20
|
- Add `gem 'activeadmin_reorderable'` to `Gemfile` and run `bundle install`
|
13
21
|
- Add `#= require activeadmin_reorderable` to `app/assets/javascripts/active_admin.js.coffee`
|
@@ -61,31 +69,4 @@ end
|
|
61
69
|
|
62
70
|
## Contributing
|
63
71
|
|
64
|
-
|
65
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
66
|
-
3. Commit your changes (`git commit -am "Add some feature"`)
|
67
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
68
|
-
5. Create a new Pull Request
|
69
|
-
|
70
|
-
### Issue and PR reviews
|
71
|
-
|
72
|
-
Another way you can help is by reviewing issues, trying to reproduce bugs, and providing feedback on PRs.
|
73
|
-
|
74
|
-
## Pushing a new version
|
75
|
-
|
76
|
-
First, you must be authorized on both rubygems.org and npmjs.com. Then:
|
77
|
-
|
78
|
-
Update the ruby gem:
|
79
|
-
- Update the version in `lib/activeadmin_reorderable/version.rb`
|
80
|
-
- `gem build activeadmin_reorderable.gemspec`
|
81
|
-
- `gem push activeadmin_reorderable-X.Y.Z.gem`
|
82
|
-
|
83
|
-
Update the npm package:
|
84
|
-
- Update the version in `package.json`
|
85
|
-
- `npm publish`
|
86
|
-
|
87
|
-
Tag the version in git:
|
88
|
-
- `git tag X.Y.Z`
|
89
|
-
- `git push origin X.Y.Z`
|
90
|
-
|
91
|
-
Update the changelog
|
72
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md)
|
@@ -59,7 +59,10 @@ const updateEvenOddClasses = (row, index) => {
|
|
59
59
|
}
|
60
60
|
|
61
61
|
const updatePositionText = (row, index) => {
|
62
|
-
row.querySelector(".position")
|
62
|
+
const position = row.querySelector(".position")
|
63
|
+
if (position) {
|
64
|
+
position.textContent = index
|
65
|
+
}
|
63
66
|
}
|
64
67
|
|
65
68
|
const updateBackend = (url, rowIndex) => {
|
@@ -79,7 +82,7 @@ const updateBackend = (url, rowIndex) => {
|
|
79
82
|
}
|
80
83
|
|
81
84
|
document.addEventListener("DOMContentLoaded", () => {
|
82
|
-
document.querySelectorAll(".aa-reorderable").forEach((table) => {
|
85
|
+
document.querySelectorAll("table.aa-reorderable").forEach((table) => {
|
83
86
|
setupReorderable({
|
84
87
|
table,
|
85
88
|
onUpdate: (row) => {
|
@@ -2,5 +2,12 @@ require 'rails/engine'
|
|
2
2
|
|
3
3
|
module ActiveadminReorderable
|
4
4
|
class Engine < Rails::Engine
|
5
|
+
initializer "activeadmin_reorderable.importmap", before: "importmap" do |app|
|
6
|
+
# Skip if importmap-rails is not installed
|
7
|
+
next unless app.config.respond_to?(:importmap)
|
8
|
+
|
9
|
+
app.config.importmap.paths << Engine.root.join("config/importmap.rb")
|
10
|
+
app.config.importmap.cache_sweepers << Engine.root.join("app/assets/javascripts")
|
11
|
+
end
|
5
12
|
end
|
6
13
|
end
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin_reorderable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derek Kniffin
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-07-
|
13
|
+
date: 2024-07-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activeadmin
|
@@ -158,20 +158,6 @@ dependencies:
|
|
158
158
|
- - "~>"
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: '4.10'
|
161
|
-
- !ruby/object:Gem::Dependency
|
162
|
-
name: site_prism
|
163
|
-
requirement: !ruby/object:Gem::Requirement
|
164
|
-
requirements:
|
165
|
-
- - ">="
|
166
|
-
- !ruby/object:Gem::Version
|
167
|
-
version: '0'
|
168
|
-
type: :development
|
169
|
-
prerelease: false
|
170
|
-
version_requirements: !ruby/object:Gem::Requirement
|
171
|
-
requirements:
|
172
|
-
- - ">="
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
version: '0'
|
175
161
|
- !ruby/object:Gem::Dependency
|
176
162
|
name: sqlite3
|
177
163
|
requirement: !ruby/object:Gem::Requirement
|