sortablelabel-js 0.7 → 0.8

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: bcb174b958a8a05fee37c0844a832d103c61cccb
4
- data.tar.gz: 10949d6831b2cf476692e8346111269f6a0598ae
3
+ metadata.gz: 2cfe5fd7777bb9bfdc7b102445eb9286b1f3e7b3
4
+ data.tar.gz: ba6bfb11bccc583cfd89c0a1f7cd92eb7337e33a
5
5
  SHA512:
6
- metadata.gz: dffdbef8491ea6d7a8bee685054bbfdf4a0ab591fb5e9d1ca8c1cb28744d97554d50321184e5c83cbbb851f38ae9205d1029edd9e5894551d3c09ed303171b1c
7
- data.tar.gz: dfa77cd4520b257a8c06153f8480ae41d9681e20f0fd90469dbb181eebaf1229d056a4ec10939f133a9f3e78b2cd40b15cba9977baeb928ef1ca1ff3b3684f0e
6
+ metadata.gz: 6bc193fb82ff8c8f48b62a9feed721e417295bf32ce57ca5ad2db439f469c55861600bdb55262477a28ad235ccab235682bcc0fb363072db676537f7bcb488ee
7
+ data.tar.gz: 66def897877720149551efc2fcccd8762891310ee77c0309a4537783dc4fceba8103d39aac86eb4d7e13afeb177c13778259b5d9c4fa00e4d26b26b2fb058e43
@@ -1,5 +1,5 @@
1
1
  module Sortablelabel
2
2
  module Js
3
- VERSION = "0.7"
3
+ VERSION = "0.8"
4
4
  end
5
5
  end
@@ -61,26 +61,23 @@ class @SortableLabel
61
61
  $(@target).each(->
62
62
  stepCount = 1
63
63
  $(this).find(target).each( ->
64
+ if _this.options['minimun'] >= stepCount
65
+ $(this).closest('.fields').find('.remove_nested_fields').hide();
66
+ else
67
+ $(this).closest('.fields').find('.remove_nested_fields').show();
64
68
  $(this).closest('.fields').find(_this.options['positionTarget']).val(stepCount)
65
69
  if typeof(_this.options['label']) == 'string'
66
70
  if _this.options['label'].trim() == 'Day'
67
- $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.dayOfWeek(stepCount - 1))
68
- stepCount += 1
71
+ $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.dayOfWeek(stepCount - 1))
69
72
  else
70
73
  if _this.options['fieldName']
71
74
  if $(this).parent().find('.remove_nested_fields').data('association') == _this.options['fieldName']
72
75
  $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.options['label'] + stepCount)
73
- stepCount += 1
74
76
  else
75
- throw "Field name can't be empty!"
77
+ alert("Field name can't be empty!")
76
78
  else if typeof(_this.options['label']) == 'function'
77
79
  $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.options['label'].call($(this).closest('.fields').find(_this.options['labelTarget']), stepCount))
78
- stepCount += 1
79
- if _this.options['minimun'] >= stepCount
80
- $(this).closest('.fields').find('.remove_nested_fields').hide();
81
- else
82
- $(this).closest('.fields').find('.remove_nested_fields').show();
83
-
80
+ stepCount += 1
84
81
  )
85
82
  )
86
83
 
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: '0.7'
4
+ version: '0.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-16 00:00:00.000000000 Z
11
+ date: 2017-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler