rails_sortable 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/sortable_controller.rb +4 -3
- data/lib/rails_sortable/version.rb +1 -1
- data/spec/controllers/sortable_controller_spec.rb +2 -2
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/log/development.log +835 -0
- data/spec/dummy/log/test.log +1025 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/01/01R-s_WCfie5NOUCgzCRAa1HGSgrRGzSWOC_m6QKtDs.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/0C/0CSZvbvyMRBgG6qOaNyldbOa0BC8Z6Hl-Gsc4eRLOOU.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/0s/0sKu42gh2vBaPvT4isoyz1C5n3QsEH9XYKbdz33ynp0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2m/2mYWSxzZ3mr-W-zj_QlMzUVhXAc6K5n_mxuhfVPKeRk.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2n/2noyLPdhyYrTOf9E_xx-j1-l2o0D4xIKefkU2_2zuSw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/3Z/3ZmFVd37_er9xacTdpDVrru3pqqONv7oiLoa5jumXMA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5D/5D4vKn0nXiZFypoQ88UVWACwMPmNEtPoizlnlf5a3KE.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8q/8qL2VWqjLsK-3Th2nChJt0rmn86ayYoXXljxNwr6boA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/95/95wFhe664F63WUSzEhsVvTZSomnmA29bQqRzCuqUw80.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/9o/9oVNtnLWwqQb7TmD8FpMip1dkKF6-5Vv_ZgkxMiCsSg.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ac/ACjjatYt7SSchzTFuzSgpHU4aH76Y0BEFicjyejYRRo.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/BJ/bjVQEFR5R1N_JWucAuDUty6laM2DRjj0_RMZu9SYDvA.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Bq/BqpRHlLIR78Mve0JYwWNBqMMqFDayfalTJQYgjiM9qM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Br/BrcgfO216aBCp02p1z62HHiagAlHNyLgZJO0x-qFmzY.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Bz/BzlgWWh3KsQ2JEqmmrJN5zzF2kzeFk6banY43og-jco.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Cg/Cg032mB5wsCJc7M9PJYtX8kW2rme7nDs2NfqRMU_Kag.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Cv/CvnZzjVTprKQs9En8yNOqFZb8PbjTdhGHDTUA759Jdg.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/GY/GYPawP__JY6VU09QGlK0uX8tBEMxoF0ruW15q2_urco.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/HC/HCV17aj9PDQvsltkt1vtlC4Pi97LUK70iUjju-aeY4U.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/HF/HFuNhzNZA5ILxIzWi2wxnZ_uEYPrAQ4OVoo0Y_92muU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/JK/jK6RVDyZCJVp-tGbxpa6CenvbY-RVAZE6JA6fCCBGwY.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/L4/L4tqqx-yJoztIjoGXHSy-NvkI8VW65QKMxETt-QnRXk.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Lu/LuT9MVCevd9cnJyM-rnFODC6fmZlQCo6sbB-oOYo32o.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/NJ/NJPKulTTVml31dAHvlNlvTSmc67dd1-khPdXxd-BV-g.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/NO/NOFsgdG9JHvxaTdETOIM03FC4zJSLMNaRYMqzJD-PK0.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ph/PhVnF8dSHdYPZAh-rGDzubSJJQ15B8LYWAmbT_Ayg0I.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Qi/QiqRtgYYt80Fdiy7_p9KG5epgz0iScb6d3ggvZ9ou8E.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Qx/Qx762cihrWGbxDFPg0J0Ty3XRyawIkiYNfkOa1rdjvg.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Rm/RmvX8mn3Y70pTR3IdOxE8mQsk-o8YnIKsmhxamYuhuA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Wf/WfSpDqLVIBRLs7zN4EaLvO5gZwP1gDZ-vhVlSV5Nuzc.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Xt/Xtbc0qIZ56U3len-pJqUpGyz5orhqIh4f4NCwhIZOM8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Zb/ZbaWLp8-uhTLC-bZtsNyzAKzsHNiUMTQ8TR7cm1f2Ts.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/_u/_ucBCVho_GH8mpAYEMEbO1mdZJA-0utvol1cThSZTRg.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/em/emP_P5yEj_Ci8tJ6_ddcLEs7tM8AvTDbABXxxYpMdPw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gO/gO19bm9njX8eGJ2fzPGIjFDbzQPo1xtL9t8UdNCiFkU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/h-/h-paFtnuvuXCitlu9RkKwtd01wTZ85uFXdeuWbAKkfA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/h7/h7PdJc7WD_pMR3zsy0unfpLJ5eaQXdEs2-6tZOTDqxo.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/iV/iV3fh6WxdwfEgGkB2pwMRA_SCCQvc-m2qajISsYI0CA.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/iq/iq2GtOhe61su4HU3HYmCgHdNZ-oYdbfXcEDLakPZ8rU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/iy/iyfidHeD50i9-agD3MGfxD7S8YHAfdRGFr5ibIu4ut4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lZ/lZgZiiAsBaoL4Jp113upgQKw_CZ-tmIAJ7cwdBkVgA4.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ns/nSNxLfPPOsSygihx5Va1O0nHBvrYNBLgAw3mUfS-MiU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oI/oIl3ZhCKx-9NoH-O5mvEaaKJle-PHumtCuLCQxIlK28.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oZ/oZoFF5k22C6pdrJDUhnQZw0Un1VAYs5L3ndYNW3_3nA.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ok/ok_mqE9G9QoEC0-Zt5o6oGpAaFsYyKfqMav5MnTsX6I.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/p4/p4dmucZ_zwAKtbHzWvqAkxxoba_Bj4sGSYK6O88Uc70.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/qw/qwryXXP-w0d2pH8QRB8kapqCk8848jEsMfAK6Zi2Ch0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vy/vyLWTgfRnLmx9FzyEV6eZXeJ5tvpiMp-TpRYwiMgmH4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wM/wMbVYWswUofRkOXJoKjSGFmk5Aupumk4F3LxgCivI88.cache +3 -0
- data/vendor/assets/javascripts/plugin.js +9 -1
- metadata +99 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68460fb1a8862e4715a9e453b2f61a4fb6d71c4d954b4a5dc1dcece0df1b6fab
|
4
|
+
data.tar.gz: f0b3ad873c0a562b4c3811b10bfb577a8a566ee10035065c364a71bdbc167585
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 603e02eefd9ec9c18b1cdff4c3657fa620fcdb5b3ad6af8bee06f46aa8670ccdf7548504f47e5f3092d86383719177220fa3e9bde6cdc52057d5e58cbd75f536
|
7
|
+
data.tar.gz: bf663b64587f4293ede0870b47db0a753d44b54f4b776c8fbc0a0afdf28f9e3734008c8e3837093d27d07c544f626e44525d305e9fe565e58652bf64815f3e9d
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class SortableController < ApplicationController
|
2
2
|
#
|
3
|
-
# post /sortable/reorder, :klass
|
3
|
+
# post /sortable/reorder, rails_sortable: { klass: ["1", "3", "2"] }
|
4
4
|
#
|
5
5
|
def reorder
|
6
6
|
klass, ids = parse_params
|
@@ -19,8 +19,9 @@ class SortableController < ApplicationController
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def parse_params
|
22
|
-
|
23
|
-
|
22
|
+
rails_sortable_params = params['rails_sortable']
|
23
|
+
klass_name = rails_sortable_params.keys.first
|
24
|
+
ids = rails_sortable_params[klass_name].map {|id| id.to_i }
|
24
25
|
[ klass_name.constantize, ids ]
|
25
26
|
end
|
26
27
|
end
|
@@ -9,9 +9,9 @@ describe SortableController, type: :controller do
|
|
9
9
|
end
|
10
10
|
it "should reorder models" do
|
11
11
|
if Gem::Version.new(Rails.version) < Gem::Version.new(5)
|
12
|
-
post :reorder, Item: [@item1.id, @item3.id, @item2.id]
|
12
|
+
post :reorder, rails_sortable: { Item: [@item1.id, @item3.id, @item2.id] }
|
13
13
|
else
|
14
|
-
post :reorder, params: { Item: [@item1.id, @item3.id, @item2.id] }
|
14
|
+
post :reorder, params: { rails_sortable: { Item: [@item1.id, @item3.id, @item2.id] } }
|
15
15
|
end
|
16
16
|
expect(response.body).to be_blank
|
17
17
|
expect(Item.find(@item1.id).sort).to eql 0
|
Binary file
|