sortablelabel-js 2.2 → 2.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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/bower.json +5 -5
- data/lib/sortablelabel/js/version.rb +1 -1
- data/vendor/assets/javascripts/sortable_label.coffee +12 -16
- 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: d890b2d22bfe370e92b426d127c405fdc13576c5
|
4
|
+
data.tar.gz: 0810fec8bae3ba84dfc4808d20eeb7898e1e2ff1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79fb54d22de5683cbedab7de923ebf2c6d7f612b2ea55ef3643351109ee9f0b46064d0ae946b24beb192064c241d03290d6e4ab61908ba998eccb83f2f4ab190
|
7
|
+
data.tar.gz: a3709cce2568a4fa9dcf83e37e37122b966a0e2f8e6d0bb9546a781254a971e6f56976b962384977e21d6055b946888050e58602763f125ab9673088d087c0be
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/bower.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
"description": "Sortable label js dependencies",
|
4
4
|
"main": "index.js",
|
5
5
|
"authors": [
|
6
|
-
"
|
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": "
|
19
|
-
"jasmine-jquery": "
|
20
|
-
"jquery-sortable": "
|
21
|
-
"jquery-ui": "
|
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
|
}
|
@@ -16,7 +16,7 @@ class @SortableLabel
|
|
16
16
|
@stop_callback = @options["stop"]
|
17
17
|
@initSortByPosition()
|
18
18
|
@calStepLable()
|
19
|
-
if $(".sortable-label-#{@targetId}").
|
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
|
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 =
|
97
|
+
if _is_removed == "false" || _is_removed == false || _is_removed == "0"
|
98
|
+
_is_removed = false
|
99
99
|
else
|
100
|
-
_is_removed =
|
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
|
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(
|
148
|
+
this.calLabel()
|
149
149
|
if this.options['weekGroupLabelTarget']
|
150
150
|
this.calWeekGroupLabel(this.options['weekGroupLabelTarget'])
|
151
151
|
|
152
|
-
calLabel:
|
152
|
+
calLabel: ->
|
153
153
|
_this = this
|
154
154
|
$(@target.selector).each(->
|
155
155
|
stepCount = 1
|
156
|
-
$(this).find(
|
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']
|
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']
|
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.
|
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-
|
11
|
+
date: 2018-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|