sortablelabel-js 1.6 → 1.7

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: 9ad6e133d3f37d035e43f162c125c6008744b714
4
- data.tar.gz: 4ef18e451faf96a29c621fdac0ddcf6ce43caae4
3
+ metadata.gz: 84ede6e7b691a3c2aef076d3abc4b78f96266497
4
+ data.tar.gz: 50f2b75f3eef3b2ea66e93dcbbd3034946e58295
5
5
  SHA512:
6
- metadata.gz: 4f96635dd62bdfcdbd2f09946f9aa06c0271a80ce77beca13da6d55be50ba3c1363cd4682fbf18cad0d9e981282d606389ff25d766db41dd3370cad06f9fdc77
7
- data.tar.gz: c40918cd6948d5a3f4974de6b627062c86a760673f0565caaaf3250a6a66e4bc203385986b156ea5408b88b8eaa287cc3de2022a512c1badced49cd1773f2a91
6
+ metadata.gz: dc3132ed3982996f097ff85972946d71370cf69133bb255cd073d1721567de1e059afc87ecf2f37c629f8c5af9f316d14662c2900cc287501e73318f1d43de00
7
+ data.tar.gz: 4f3b8bb2ffdbe29260bf52cd2e4f9658b5c64c9d11f6a37db7961c28f3176afb31f8e8153937b45322e2afb445486745ca341b668f138ccb7a04809d40402f00
data/Gemfile.lock ADDED
@@ -0,0 +1,35 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sortablelabel-js (1.7)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ rake (10.5.0)
11
+ rspec (3.7.0)
12
+ rspec-core (~> 3.7.0)
13
+ rspec-expectations (~> 3.7.0)
14
+ rspec-mocks (~> 3.7.0)
15
+ rspec-core (3.7.1)
16
+ rspec-support (~> 3.7.0)
17
+ rspec-expectations (3.7.0)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.7.0)
20
+ rspec-mocks (3.7.0)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.7.0)
23
+ rspec-support (3.7.0)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ bundler (~> 1.15)
30
+ rake (~> 10.0)
31
+ rspec (~> 3.0)
32
+ sortablelabel-js!
33
+
34
+ BUNDLED WITH
35
+ 1.15.0
@@ -1,5 +1,5 @@
1
1
  module Sortablelabel
2
2
  module Js
3
- VERSION = "1.6"
3
+ VERSION = "1.7"
4
4
  end
5
5
  end
@@ -156,16 +156,18 @@ class @SortableLabel
156
156
  $(this).closest('.fields').find('.remove_nested_fields').show();
157
157
  $(this).closest('.fields').find(_this.options['positionTarget']).val(stepCount)
158
158
  if typeof(_this.options['label']) == 'string'
159
- if _this.options['label'].trim() == 'Day'
160
- $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.dayOfWeek(stepCount - 1))
159
+ if _this.options['fieldName']
160
+ if $(this).parent().find('.remove_nested_fields').data('association') == _this.options['fieldName']
161
+ $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.options['label'] + stepCount)
161
162
  else
162
- if _this.options['fieldName']
163
- if $(this).parent().find('.remove_nested_fields').data('association') == _this.options['fieldName']
164
- $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.options['label'] + stepCount)
165
- else
166
- alert("Field name can't be empty!")
163
+ alert("Field name can't be empty!")
167
164
  else if typeof(_this.options['label']) == 'function'
168
165
  $(this).closest('.fields').find(_this.options['labelTarget']).html(_this.options['label'].call($(this).closest('.fields').find(_this.options['labelTarget']), stepCount))
166
+ else if _this.options['label'] == false
167
+ if !$(this).closest('.fields').find(_this.options['labelTarget']).data('label')
168
+ labelContent = $(this).closest('.fields').find(_this.options['labelTarget']).text()
169
+ $(this).closest('.fields').find(_this.options['labelTarget']).data('label', labelContent)
170
+ $(this).closest('.fields').find(_this.options['labelTarget']).html("#{$(this).closest('.fields').find(_this.options['labelTarget']).data('label')}")
169
171
  else
170
172
  if !$(this).closest('.fields').find(_this.options['labelTarget']).data('label')
171
173
  labelContent = $(this).closest('.fields').find(_this.options['labelTarget']).text()
@@ -217,9 +219,6 @@ class @SortableLabel
217
219
  return index if _item.name is item
218
220
  return -1
219
221
 
220
- dayOfWeek: (dayIndex) ->
221
- ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"][dayIndex]
222
-
223
222
  (($) ->
224
223
  $.fn.sortableLabel = (options) ->
225
224
  new SortableLabel(this, options)
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.6'
4
+ version: '1.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-17 00:00:00.000000000 Z
11
+ date: 2018-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -61,6 +61,7 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - ".gitignore"
63
63
  - Gemfile
64
+ - Gemfile.lock
64
65
  - README.md
65
66
  - Rakefile
66
67
  - bin/console