sortablelabel-js 2.2 → 2.3

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
  SHA1:
3
- metadata.gz: c65f7a5079171fc4ef7f2cd422425f139e6b351b
4
- data.tar.gz: 9abaaa646f8d8bf2ef89925ffea110d40e64cc5f
3
+ metadata.gz: d890b2d22bfe370e92b426d127c405fdc13576c5
4
+ data.tar.gz: 0810fec8bae3ba84dfc4808d20eeb7898e1e2ff1
5
5
  SHA512:
6
- metadata.gz: 7719e1dcaea286c9129f7b3a747a0b6afecbb22e9440b28a409428b34f61cbf455a1ae7210cfc546a62302f161640371be506563a17433b24a0794cb16f55fe4
7
- data.tar.gz: 3ed548f4f3bb6fd66c41adee6a31b653caf179aaf0afadcbcb236282ba62051b47068a04445d38b81e3a2eb50224ff1b0063530fda317182d5ef6088de0bc2c9
6
+ metadata.gz: 79fb54d22de5683cbedab7de923ebf2c6d7f612b2ea55ef3643351109ee9f0b46064d0ae946b24beb192064c241d03290d6e4ab61908ba998eccb83f2f4ab190
7
+ data.tar.gz: a3709cce2568a4fa9dcf83e37e37122b966a0e2f8e6d0bb9546a781254a971e6f56976b962384977e21d6055b946888050e58602763f125ab9673088d087c0be
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sortablelabel-js (2.2)
4
+ sortablelabel-js (2.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -42,6 +42,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/ZYMori
42
42
  Install dependencies lib
43
43
  ```
44
44
  npm run-script dependency
45
+ bower install
45
46
  ```
46
47
 
47
48
  #### Step 2
data/bower.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Sortable label js dependencies",
4
4
  "main": "index.js",
5
5
  "authors": [
6
- "Joe <ashzhouyue@gmail.com>"
6
+ "Ben <bzbnhang@gmail.com>"
7
7
  ],
8
8
  "license": "MIT",
9
9
  "homepage": "",
@@ -15,9 +15,9 @@
15
15
  "tests"
16
16
  ],
17
17
  "dependencies": {
18
- "jquery": "^3.2.1",
19
- "jasmine-jquery": "^2.1.1",
20
- "jquery-sortable": "^0.9.13",
21
- "jquery-ui": "^1.12.1"
18
+ "jquery": "1.11.1",
19
+ "jasmine-jquery": "2.1.1",
20
+ "jquery-sortable": "0.9.13",
21
+ "jquery-ui": "1.11.4"
22
22
  }
23
23
  }
@@ -1,5 +1,5 @@
1
1
  module Sortablelabel
2
2
  module Js
3
- VERSION = "2.2"
3
+ VERSION = "2.3"
4
4
  end
5
5
  end
@@ -16,7 +16,7 @@ class @SortableLabel
16
16
  @stop_callback = @options["stop"]
17
17
  @initSortByPosition()
18
18
  @calStepLable()
19
- if $(".sortable-label-#{@targetId}").size() == 0
19
+ if $(".sortable-label-#{@targetId}").length == 0
20
20
  $(document).on("nested:fieldAdded:#{@targetId}", (event) =>
21
21
  @calStepLable()
22
22
  if typeof(@stop_callback) == 'function'
@@ -85,7 +85,7 @@ class @SortableLabel
85
85
  # in case that new added field position value is initialized as null or '' or undefined
86
86
  all_fields.each((_, field_item) ->
87
87
  _position = $(field_item).find(_positionTarget).val()
88
- if !_position || _position == '' || typeof _position != 'undefined'
88
+ if !_position || _position == '' || typeof _position == 'undefined'
89
89
  maxium_position += 1
90
90
  $(field_item).find(_positionTarget).val(maxium_position)
91
91
  )
@@ -94,14 +94,14 @@ class @SortableLabel
94
94
  all_fields.each((_, field_item) ->
95
95
  _position = $(field_item).find(_positionTarget).val()
96
96
  _is_removed = $(field_item).find(_option['removeField']).val()
97
- if _is_removed == "false" || _is_removed == false
98
- _is_removed = "false"
97
+ if _is_removed == "false" || _is_removed == false || _is_removed == "0"
98
+ _is_removed = false
99
99
  else
100
- _is_removed = "true"
100
+ _is_removed = true
101
101
 
102
102
  # removed fields should be filtered
103
103
  # only unremoved fields will be sorted
104
- if _is_removed == 'true'
104
+ if _is_removed
105
105
  all_removed_fields_info.push({
106
106
  position: _position,
107
107
  j_element: field_item
@@ -145,15 +145,16 @@ class @SortableLabel
145
145
  )
146
146
 
147
147
  calStepLable: ->
148
- this.calLabel(this.options['removeField']+'[value=false]')
148
+ this.calLabel()
149
149
  if this.options['weekGroupLabelTarget']
150
150
  this.calWeekGroupLabel(this.options['weekGroupLabelTarget'])
151
151
 
152
- calLabel: (target) ->
152
+ calLabel: ->
153
153
  _this = this
154
154
  $(@target.selector).each(->
155
155
  stepCount = 1
156
- $(this).find(target).each( ->
156
+ $(this).find(_this.options['removeField']).each( ->
157
+ return if $(this).val() == 'true' || $(this).val() == '1'
157
158
  if($(this).closest('.fields').find('.remove_nested_fields').data('association') == _this.options['fieldName'])
158
159
  if _this.options['minimun'] >= stepCount
159
160
  $(this).closest('.fields').find('.remove_nested_fields').hide();
@@ -163,17 +164,12 @@ class @SortableLabel
163
164
  if typeof(_this.options['label']) == 'string'
164
165
  if _this.options['fieldName']
165
166
  if $(this).parent().find('.remove_nested_fields').data('association') == _this.options['fieldName']
166
- $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.options['label'] + stepCount)
167
+ $(this).closest('.fields').find(_this.options['labelTarget']).html("#{_this.options['label']} #{stepCount}")
167
168
  else
168
169
  alert("Field name can't be empty!")
169
170
  else if typeof(_this.options['label']) == 'function'
170
171
  $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.options['label'].call($(this).closest('.fields').find(_this.options['labelTarget']), stepCount))
171
- else if _this.options['label'] == false
172
- if !$(this).closest('.fields').find(_this.options['labelTarget']).data('label')
173
- labelContent = $(this).closest('.fields').find(_this.options['labelTarget']).text()
174
- $(this).closest('.fields').find(_this.options['labelTarget']).data('label', labelContent)
175
- $(this).closest('.fields').find(_this.options['labelTarget']).html("#{$(this).closest('.fields').find(_this.options['labelTarget']).data('label')}")
176
- else
172
+ else if _this.options['label'] != false
177
173
  if !$(this).closest('.fields').find(_this.options['labelTarget']).data('label')
178
174
  labelContent = $(this).closest('.fields').find(_this.options['labelTarget']).text()
179
175
  $(this).closest('.fields').find(_this.options['labelTarget']).data('label', labelContent)
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: '2.2'
4
+ version: '2.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - BenZhang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-05 00:00:00.000000000 Z
11
+ date: 2018-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake