sortablelabel-js 2.1 → 2.2
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sortablelabel/js/version.rb +1 -1
- data/vendor/assets/javascripts/sortable_label.coffee +32 -29
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c65f7a5079171fc4ef7f2cd422425f139e6b351b
|
4
|
+
data.tar.gz: 9abaaa646f8d8bf2ef89925ffea110d40e64cc5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7719e1dcaea286c9129f7b3a747a0b6afecbb22e9440b28a409428b34f61cbf455a1ae7210cfc546a62302f161640371be506563a17433b24a0794cb16f55fe4
|
7
|
+
data.tar.gz: 3ed548f4f3bb6fd66c41adee6a31b653caf179aaf0afadcbcb236282ba62051b47068a04445d38b81e3a2eb50224ff1b0063530fda317182d5ef6088de0bc2c9
|
data/Gemfile.lock
CHANGED
@@ -30,38 +30,41 @@ class @SortableLabel
|
|
30
30
|
if typeof(@stop_callback) == 'function'
|
31
31
|
@stop_callback.call(@target)
|
32
32
|
)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
33
|
+
|
34
|
+
@target.each((_, element)=>
|
35
|
+
target = $(element)
|
36
|
+
if !target.hasClass("sortable-label-#{@targetId}")
|
37
|
+
target.addClass("sortable-label-#{@targetId}")
|
38
|
+
|
39
|
+
target.on('sortableLabel:refresh', =>
|
40
|
+
target.sortable("enable")
|
41
|
+
@calStepLable()
|
42
|
+
)
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
+
if @options['nestedTarget']
|
45
|
+
@options['nestedTarget'].call(@target)
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
target.sortable(
|
48
|
+
items: @options['sortableItem']
|
49
|
+
placeholder: "ui-state-highlight"
|
50
|
+
start: (event, ui)->
|
51
|
+
$(this).find('.ui-state-highlight').css('height', $(ui.item).css('height'))
|
52
|
+
stop: =>
|
53
|
+
@calStepLable()
|
54
|
+
if typeof(@stop_callback) == 'function'
|
55
|
+
@stop_callback.call(@target)
|
56
|
+
)
|
55
57
|
|
56
|
-
|
57
|
-
|
58
|
-
|
58
|
+
target.on('sortableLabel:disable', =>
|
59
|
+
target.sortable('disable')
|
60
|
+
)
|
61
|
+
)
|
59
62
|
|
60
63
|
# 1. ascending sort if all position fields are not provided
|
61
64
|
# 2. ascending sort field elements which part of them are no provided position
|
62
65
|
initSortByPosition: () ->
|
63
66
|
_option = @options
|
64
|
-
@target.each((
|
67
|
+
@target.each((_, sub_target) ->
|
65
68
|
all_fields = $(sub_target).find(_option['sortableItem'])
|
66
69
|
_positionTarget = _option['positionTarget']
|
67
70
|
all_remain_fields_info = []
|
@@ -71,7 +74,7 @@ class @SortableLabel
|
|
71
74
|
if all_fields.length > 0
|
72
75
|
|
73
76
|
# get the maxinum_position
|
74
|
-
all_fields.each((
|
77
|
+
all_fields.each((_, field_item) ->
|
75
78
|
_position = $(field_item).find(_positionTarget).val()
|
76
79
|
if _position && _position != '' && typeof _position != 'undefined'
|
77
80
|
_position = parseInt(_position, 10)
|
@@ -80,7 +83,7 @@ class @SortableLabel
|
|
80
83
|
)
|
81
84
|
|
82
85
|
# in case that new added field position value is initialized as null or '' or undefined
|
83
|
-
all_fields.each((
|
86
|
+
all_fields.each((_, field_item) ->
|
84
87
|
_position = $(field_item).find(_positionTarget).val()
|
85
88
|
if !_position || _position == '' || typeof _position != 'undefined'
|
86
89
|
maxium_position += 1
|
@@ -88,7 +91,7 @@ class @SortableLabel
|
|
88
91
|
)
|
89
92
|
|
90
93
|
# filter removed fields and remain fields
|
91
|
-
all_fields.each((
|
94
|
+
all_fields.each((_, field_item) ->
|
92
95
|
_position = $(field_item).find(_positionTarget).val()
|
93
96
|
_is_removed = $(field_item).find(_option['removeField']).val()
|
94
97
|
if _is_removed == "false" || _is_removed == false
|
@@ -132,11 +135,11 @@ class @SortableLabel
|
|
132
135
|
all_remain_fields_info[key].position = key + 1
|
133
136
|
|
134
137
|
_target = $(sub_target)
|
135
|
-
all_remain_fields_info.forEach((item,
|
138
|
+
all_remain_fields_info.forEach((item, _) ->
|
136
139
|
_target.append(item.j_element)
|
137
140
|
)
|
138
141
|
|
139
|
-
all_removed_fields_info.forEach((item,
|
142
|
+
all_removed_fields_info.forEach((item, _) ->
|
140
143
|
_target.append(item.j_element)
|
141
144
|
)
|
142
145
|
)
|