rails-jquery-tokeninput 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/lib/assets/javascripts/rails-jquery-tokeninput.js +21 -15
- data/lib/rails/jquery/tokeninput/version.rb +1 -1
- data/rails-jquery-tokeninput.gemspec +4 -3
- data/spec/dummy/app/models/world.rb +2 -0
- data/spec/dummy/config/initializers/secret_token.rb +1 -0
- data/spec/features/tokeninput_spec.rb +1 -5
- data/spec/spec_helper.rb +1 -0
- metadata +39 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11c59b6682b7ce709c4a6a7998e8eb730cf0439a
|
4
|
+
data.tar.gz: fc4992bff17cf83dab322d113ee2358fbc1f2756
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a12f0be7d001714a49fd660d9aef5d11853ef722b1432372aea52c81cd4fe67cb2bf708530240999f12efb94b2cfdd203fe0a07fba5ee064d4ff8adb6274f2a0
|
7
|
+
data.tar.gz: 3164972f37173f5dddf259d39fa5794c75a8cf3908ab23b8574e827add64cb8d3a57ce95be77e94ca53756fa8ac5ea156fd1d87ecda994ececcf1d784821e899
|
data/.gitignore
ADDED
@@ -2,36 +2,42 @@
|
|
2
2
|
//= require jquery.tokeninput
|
3
3
|
|
4
4
|
$(function() {
|
5
|
+
var DEFAULTS = {
|
6
|
+
options: { tokenValue: 'id' },
|
7
|
+
source: []
|
8
|
+
};
|
9
|
+
|
5
10
|
$.each($('input[data-tokeninput]'), function(index, input) {
|
6
11
|
var inputName = $(input).attr('name');
|
7
|
-
var
|
12
|
+
var source = $(input).data('tokeninput').collection || DEFAULTS.source;
|
13
|
+
var options = $(input).data('tokeninput').options || DEFAULTS.options;
|
8
14
|
|
9
|
-
var
|
10
|
-
var inputItemName
|
15
|
+
var addInput = function(value) {
|
16
|
+
var inputItemName = inputName + '[]';
|
11
17
|
$('<input name="' + inputItemName + '" type="text" style="display: none;" value="' + value + '">').insertAfter(input);
|
12
18
|
}
|
13
19
|
|
14
|
-
var
|
15
|
-
var inputItemValue = item[
|
16
|
-
|
20
|
+
var addItem = function(item) {
|
21
|
+
var inputItemValue = item[options.tokenValue];
|
22
|
+
addInput(inputItemValue);
|
17
23
|
}
|
18
24
|
|
19
|
-
|
20
|
-
|
21
|
-
options.onAdd = add_item;
|
22
|
-
|
23
|
-
options.onDelete = function(item) {
|
24
|
-
var inputItemValue = item[$(input).data('tokeninput').options.tokenValue || 'id'];
|
25
|
+
var deleteItem = function(item) {
|
26
|
+
var inputItemValue = item[options.tokenValue];
|
25
27
|
$('input[value="' + inputItemValue + '"]').remove();
|
26
|
-
|
28
|
+
addInput('');
|
27
29
|
};
|
28
30
|
|
31
|
+
options.onAdd = addItem;
|
32
|
+
options.onDelete = deleteItem;
|
33
|
+
|
29
34
|
if(options.prePopulate) {
|
30
35
|
$.each(options.prePopulate, function(index, itemToPrePopulate) {
|
31
|
-
|
36
|
+
addItem(itemToPrePopulate)
|
32
37
|
});
|
33
38
|
}
|
34
39
|
|
35
|
-
$(input).
|
40
|
+
$(input).attr('name', '');
|
41
|
+
$(input).tokenInput(source, options);
|
36
42
|
});
|
37
43
|
});
|
@@ -18,12 +18,13 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'jquery-rails'
|
21
|
+
spec.add_dependency 'jquery-rails', '~> 2'
|
22
22
|
|
23
|
-
spec.add_development_dependency 'activemodel'
|
23
|
+
spec.add_development_dependency 'activemodel', '~> 4.1.9'
|
24
|
+
spec.add_development_dependency 'actionpack', '~> 4.1.9'
|
24
25
|
spec.add_development_dependency 'sprockets-rails'
|
25
|
-
|
26
26
|
spec.add_development_dependency 'rspec-rails'
|
27
27
|
spec.add_development_dependency 'capybara'
|
28
28
|
spec.add_development_dependency 'poltergeist'
|
29
|
+
spec.add_development_dependency 'pry-byebug'
|
29
30
|
end
|
@@ -10,3 +10,4 @@
|
|
10
10
|
# Make sure your secret_key_base is kept private
|
11
11
|
# if you're sharing your code publicly.
|
12
12
|
Dummy::Application.config.secret_key_base = '72b84484d1fdd5faa3ff6b09182a13b26010880c681bd3f6c575f61cdca53640d08c344fd97cb2e058ff713264ce780439d6fa3bd0ada716309de98520efbccd'
|
13
|
+
Dummy::Application.config.secret_token = '72b84484d1fdd5faa3ff6b09182a13b26010880c681bd3f6c575f61cdca53640d08c344fd97cb2e058ff713264ce780439d6fa3bd0ada716309de98520efbccd'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'features/pages/world_page'
|
3
3
|
|
4
|
-
feature 'Tokeninput
|
4
|
+
feature 'Tokeninput' do
|
5
5
|
let(:world_page) { WorldPage.new(root_path) }
|
6
6
|
let(:country) { Country.first }
|
7
7
|
|
@@ -22,8 +22,4 @@ feature 'Tokeninput:' do
|
|
22
22
|
|
23
23
|
expect(world_page.response['countries']).to match_array([country[:iso_code]])
|
24
24
|
end
|
25
|
-
|
26
|
-
scenario 'adding and removing tokens', js: true do
|
27
|
-
pending 'will come soon'
|
28
|
-
end
|
29
25
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-jquery-tokeninput
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgeny Li
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jquery-rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activemodel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 4.1.9
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 4.1.9
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: actionpack
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.1.9
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.1.9
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: sprockets-rails
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +108,20 @@ dependencies:
|
|
94
108
|
- - ! '>='
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry-byebug
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
97
125
|
description: rails-jquery-tokeninput project integrates Tokeninput jQuery plugin which
|
98
126
|
allows your users to select multiple items from a predefined list, using autocompletion
|
99
127
|
as they type to find each item
|
@@ -103,6 +131,7 @@ executables: []
|
|
103
131
|
extensions: []
|
104
132
|
extra_rdoc_files: []
|
105
133
|
files:
|
134
|
+
- .gitignore
|
106
135
|
- .rspec
|
107
136
|
- .travis.yml
|
108
137
|
- Gemfile
|