tagify 0.0.2 → 0.0.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/app/assets/javascripts/tagify.coffee +17 -3
- data/lib/tagify/version.rb +1 -1
- 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: 13ea563706bbc3376a30438a2880e3bb64461020
|
4
|
+
data.tar.gz: 9c6bda4025579ec5a8dcf6cc7182bffa71b785a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1689de89ed8c25d96023cf12c7c04f4529cc51f808831f4c35b33ba0dff63b264eb36098195b9eff9a3f0b5171e08de89153f2d74797eabb8dc897e077f4457b
|
7
|
+
data.tar.gz: 7cb6fcbdf7ca6c31068ac5327b88e57e1a5d576f9b743cb23f4e4b54a585c24f42e43c70af99471e9cf32a609a95f6ecd35dd7842cb2dd6f82b8c8d5e8183383
|
@@ -11,7 +11,7 @@ $ ->
|
|
11
11
|
|
12
12
|
getCurrentValues = (target) ->
|
13
13
|
inputField = getInputField(target)
|
14
|
-
if !!inputField.val() then JSON.parse(inputField.val()) else []
|
14
|
+
currentValues = if !!inputField.val() then JSON.parse(inputField.val()) else []
|
15
15
|
|
16
16
|
getInputField = (target) ->
|
17
17
|
getWrapperField(target).next()
|
@@ -22,6 +22,12 @@ $ ->
|
|
22
22
|
enterNewValue = (selectedValue, target) ->
|
23
23
|
inputField = getInputField(target)
|
24
24
|
currentValues = getCurrentValues(target)
|
25
|
+
|
26
|
+
if !!target.data('max') && currentValues.length >= target.data('max')
|
27
|
+
shiftedValue = currentValues.shift()
|
28
|
+
wrapper = getWrapperField(target)
|
29
|
+
wrapper.find('.token').first().remove()
|
30
|
+
|
25
31
|
currentValues.push(selectedValue)
|
26
32
|
inputField.val(JSON.stringify(currentValues))
|
27
33
|
|
@@ -51,8 +57,7 @@ $ ->
|
|
51
57
|
return
|
52
58
|
tokens
|
53
59
|
|
54
|
-
|
55
|
-
|
60
|
+
initTagify = ->
|
56
61
|
$this = $(this)
|
57
62
|
filename = $this.data('file')
|
58
63
|
|
@@ -72,6 +77,15 @@ $ ->
|
|
72
77
|
.on 'tokenfield:removedtoken', (e) ->
|
73
78
|
selectedValue = e.attrs.value
|
74
79
|
removeExistingValue(selectedValue, $this)
|
80
|
+
.on 'tokenfield:createtoken', (e) ->
|
81
|
+
if e.attrs.value is e.attrs.label
|
82
|
+
false
|
75
83
|
|
76
84
|
tokens = retrieveExistingTokens(data, $this)
|
77
85
|
$this.tokenfield('setTokens', tokens);
|
86
|
+
|
87
|
+
$('.tagify').each ->
|
88
|
+
initTagify.apply this
|
89
|
+
|
90
|
+
$(document).on 'mouseenter focus', '.tagify', ->
|
91
|
+
initTagify.apply this
|
data/lib/tagify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tagify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Azzurrio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jquery-rails
|