sortablelabel-js 1.2 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sortablelabel/js/version.rb +1 -1
- data/vendor/assets/javascripts/sortable_label.coffee +33 -30
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f370c6a7e8cd062bacb56116186ad205d0850e7
|
4
|
+
data.tar.gz: c8fd7f3a6d6b2be042f51225d6dd4ccba57a3d48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 491aa937af69e1268b1e5b68aab8a6637ecc4f5070e0e6a64c92db4ec1451a22c36c3e502261ad5a32490f8e3c6ff74ad74189c7f63a0a88ee87866160f7cdc6
|
7
|
+
data.tar.gz: 2f6d18d4c164cdfa675f49f48f617323e48e1fb2387a5e9bb85d2f74b1b81f538f724ed4e54be6f64f8ced0bb16fd5e33c3f9e2e4c56d53fd9619beefdfbf2a2
|
@@ -53,38 +53,41 @@ class @SortableLabel
|
|
53
53
|
# 1. ascending sort if all position fields are not provided
|
54
54
|
# 2. ascending sort field elements which part of them are no provided position
|
55
55
|
initSortByPosition: () ->
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
_position =
|
66
|
-
if _position
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
_position =
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
56
|
+
_option = @options
|
57
|
+
@target.each((i, sub_target) ->
|
58
|
+
all_fields = $(sub_target).find(_option['sortableItem'])
|
59
|
+
_positionTarget = _option['positionTarget']
|
60
|
+
all_fields_info = []
|
61
|
+
maxium_position = 1
|
62
|
+
|
63
|
+
if all_fields.length > 0
|
64
|
+
all_fields.each((index, field_item) ->
|
65
|
+
_position = $(field_item).find(_positionTarget).val()
|
66
|
+
if _position && _position != '' && typeof _position != 'undefined'
|
67
|
+
_position = parseInt(_position, 10)
|
68
|
+
if _position >= maxium_position
|
69
|
+
maxium_position = _position
|
70
|
+
)
|
71
|
+
all_fields.each((index, field_item) ->
|
72
|
+
_position = parseInt($(field_item).find(_positionTarget).val(), 10)
|
73
|
+
if typeof(_position) == 'undefined'
|
74
|
+
_position = maxium_position
|
75
|
+
maxium_position += 1
|
76
|
+
all_fields_info.push({
|
77
|
+
position: _position,
|
78
|
+
j_element: field_item
|
79
|
+
})
|
80
|
+
)
|
79
81
|
|
80
|
-
|
81
|
-
|
82
|
-
|
82
|
+
if all_fields_info.length > 0
|
83
|
+
all_fields_info.sort((a, b) ->
|
84
|
+
return a.position - b.position
|
85
|
+
)
|
86
|
+
_target = $(sub_target)
|
87
|
+
all_fields_info.forEach((item, index) ->
|
88
|
+
_target.append(item.j_element)
|
83
89
|
)
|
84
|
-
|
85
|
-
all_fields_info.forEach((item, index) ->
|
86
|
-
_target.append(item.j_element)
|
87
|
-
)
|
90
|
+
)
|
88
91
|
|
89
92
|
calInitStepLable: ->
|
90
93
|
this.calLabel(this.options['removeField']+'[value=false]')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sortablelabel-js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|