sortablelabel-js 1.2 → 1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7deccf7a6fdb6dd6a39a7d32c168b48aae562b2
4
- data.tar.gz: 849222eeb0d982cdf5bcd50a199d16f2b941209e
3
+ metadata.gz: 6f370c6a7e8cd062bacb56116186ad205d0850e7
4
+ data.tar.gz: c8fd7f3a6d6b2be042f51225d6dd4ccba57a3d48
5
5
  SHA512:
6
- metadata.gz: 5500f3041bbb7d4aa87ac3d2972caeb5308f66df4e18468451626f8a4bdfcb04970114687bc5113d310c9ba0a4bff96d55938f14028f23809cc5bef8ade7fbae
7
- data.tar.gz: 719a82ab093534fc6ca30216c04eaff27aa2957a2e8b9dedf0df7516664aec5e56b49f35cc0e30fcbf9bbfcf89a2b8fd1c60e2a97d760e5a99929e2a870a5652
6
+ metadata.gz: 491aa937af69e1268b1e5b68aab8a6637ecc4f5070e0e6a64c92db4ec1451a22c36c3e502261ad5a32490f8e3c6ff74ad74189c7f63a0a88ee87866160f7cdc6
7
+ data.tar.gz: 2f6d18d4c164cdfa675f49f48f617323e48e1fb2387a5e9bb85d2f74b1b81f538f724ed4e54be6f64f8ced0bb16fd5e33c3f9e2e4c56d53fd9619beefdfbf2a2
@@ -1,5 +1,5 @@
1
1
  module Sortablelabel
2
2
  module Js
3
- VERSION = "1.2"
3
+ VERSION = "1.3"
4
4
  end
5
5
  end
@@ -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
- all_fields = $(@target).find(@options['sortableItem'])
57
- _positionTarget = @options['positionTarget']
58
- all_fields_info = []
59
- maxium_position = 1
60
-
61
- if all_fields.length > 0
62
- all_fields.each((index, field_item) ->
63
- _position = $(field_item).find(_positionTarget).val()
64
- if _position && _position != '' && typeof _position != 'undefined'
65
- _position = parseInt(_position, 10)
66
- if _position >= maxium_position
67
- maxium_position = _position
68
- )
69
- all_fields.each((index, field_item) ->
70
- _position = parseInt($(field_item).find(_positionTarget).val(), 10)
71
- if typeof(_position) == 'undefined'
72
- _position = maxium_position
73
- maxium_position += 1
74
- all_fields_info.push({
75
- position: _position,
76
- j_element: field_item
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
- if all_fields_info.length > 0
81
- all_fields_info.sort((a, b) ->
82
- return a.position - b.position
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
- _target = @target
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.2'
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-15 00:00:00.000000000 Z
11
+ date: 2018-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler