bullet_train-sortable 1.6.38 → 1.7.1

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: bb79143c1669c0e7cd781e99228793145017a20ef2874a2ef9554a28b5936338
4
- data.tar.gz: ccc2f8651f38c01aae39db867c543a66cc0b9082f0b5b648f90e5089e1f5a566
3
+ metadata.gz: c7957d032f4dbaedb2516f60998b7f8a2f5c2601ec96809080afeae9945527eb
4
+ data.tar.gz: c83aad2686779f833aea7bc9d3ac65233305a836836021208c056fc44ba9ef6e
5
5
  SHA512:
6
- metadata.gz: 8d9c8acc30d82fd7a4f2063d569c7fc8a15304102d304fb9f9c8cf904e802354f8eb3adbc90638691a7b281359f92a9b3dc544f0c79ea48b44cc31537a472637
7
- data.tar.gz: 8c5e4b806f9f38ae4a5b7884c4389acb304a65d4ed5af8b4aed53cd602097d677236d9a6cdfc1649dc9028b41111ed260f9ed7e4f6d4cb488f312f10d78bde04
6
+ metadata.gz: eda0a9a61cff10106625d00d29d6bf826304d82129b2f39e5ce469e743c7158cf97ba4d268febb63924fb0c22c0ca177fd048a8a84b0af25b0e90957fd688155
7
+ data.tar.gz: 33a0c3c93dadd17f8e77b13c221becbd6cc5b0dd827de95e9671a1f28e1d698a10da51fbfe8c42cc0cf4de6288aae9e27079e0378aeeed7a1340d4a00a70e09f
@@ -1,2 +1 @@
1
- import "./concerns"
2
1
  export * from './controllers'
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Sortable
3
- VERSION = "1.6.38"
3
+ VERSION = "1.7.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-sortable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.38
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-20 00:00:00.000000000 Z
11
+ date: 2024-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -50,8 +50,6 @@ files:
50
50
  - Rakefile
51
51
  - app/assets/config/bullet_train_sortable_manifest.js
52
52
  - app/controllers/concerns/sortable_actions.rb
53
- - app/javascript/concerns/index.js
54
- - app/javascript/concerns/reassignable.js
55
53
  - app/javascript/controllers/index.js
56
54
  - app/javascript/controllers/sortable_controller.js
57
55
  - app/javascript/index.js
@@ -1 +0,0 @@
1
- import "./reassignable"
@@ -1,63 +0,0 @@
1
- require("dragula/dist/dragula.min.css")
2
-
3
- import dragula from 'dragula';
4
-
5
- function saveAssignments($container) {
6
- var parents = $container.find('[data-reassignment-parent]').map(function(index,element) { return parseInt($(element).attr('data-id')); }).toArray();
7
- var assignmentsById = {}
8
- $.each(parents, function(_, parentId) {
9
- assignmentsById[parentId] = $container.find("[data-reassignment-parent]").filter("[data-id='" + parentId + "']").find("[data-reassignable]").map(function(index,element) { return parseInt($(element).attr('data-id')); }).toArray();
10
- });
11
- $.post($container.attr('data-reassign'), {assignments_by_id: assignmentsById, dispatched_at: new Date().getTime()});
12
- }
13
-
14
- function enableReassignable($scope) {
15
- setTimeout(function() {
16
- var selector = '[data-reassign]';
17
- var $reassignable = $scope.find(selector).addBack(selector);
18
-
19
- $reassignable.each(function (_, container) {
20
-
21
- console.log("🍩 Reassignable 💬 Found the following container:")
22
- console.log(container);
23
-
24
- var $container = $(container);
25
- var dragulaObj = dragula($container.find('[data-reassignment-parent]').toArray(), {
26
- moves: function(el, container, handle) {
27
- if ($(handle).hasClass('undraggable') || ($(handle).closest('.undraggable').length > 0)) {
28
- return false;
29
- }
30
- return !!$(handle).closest('[data-reassignable]').length;
31
- },
32
- accepts: function (el, target, source, sibling) {
33
- if ($(sibling).hasClass('undraggable') && $(sibling).prev().hasClass('undraggable')) {
34
- return false;
35
- } else {
36
- return true;
37
- }
38
- },
39
- }).on('drag', function (el) {
40
- $reassignable.addClass('show-reassignable-targets')
41
- }).on('drop', function (el) {
42
- $reassignable.removeClass('show-reassignable-targets')
43
- saveAssignments($container);
44
- }).on('cancel', function (el) {
45
- $reassignable.removeClass('show-reassignable-targets')
46
- saveAssignments($container);
47
- }).on('over', function (el, container) {
48
- $(document.activeElement).blur();
49
- });
50
- });
51
- }, 500);
52
- }
53
-
54
- $(document).on('turbo:load', function() {
55
- console.log("🍩 Reassignable: Enabling on <body> after a Turbo load.")
56
- enableReassignable($('body'));
57
- })
58
-
59
- $(document).on('sprinkles:update', function(event) {
60
- console.log("🍩 Reassignable: Enabling on the following element after a Sprinkles content update:")
61
- console.log(event.target);
62
- enableReassignable($(event.target));
63
- })