bootstrap-tagsinput-rails 0.3.2.0
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 +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +53 -0
- data/lib/bootstrap/tagsinput/rails.rb +10 -0
- data/lib/bootstrap/tagsinput/rails/version.rb +7 -0
- data/vendor/assets/javascripts/bootstrap-tagsinput-angular.js +80 -0
- data/vendor/assets/javascripts/bootstrap-tagsinput.js +405 -0
- data/vendor/assets/javascripts/bootstrap-tagsinput.min.js +8 -0
- data/vendor/assets/javascripts/bootstrap-tagsinput.min.js.map +1 -0
- data/vendor/assets/stylesheets/bootstrap-tagsinput.css +44 -0
- data/vendor/assets/stylesheets/bootstrap-tagsinput.less +48 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ba46d233e976dcfc103aa6f8dc6f240912699d5e
|
4
|
+
data.tar.gz: 75fd8a1769bad8e53ae62be25376ee3dcfd9b88e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d9f9d69d7f137571b1b8fe3f4375538c1c89e5de18c4164c0614b63015d9d77c64857d579ed663506dc53098809fc00ff464426bed65ae3d7661f32e2df9acb0
|
7
|
+
data.tar.gz: 648af3bc233397d3654e6fbb235b2c2aa03b6e16f04c87934f322d51f57b942dd95fd695f7d7ad2cb085621ec5fc78a17e13bc4596b9a770639c95412f32bfa3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Hyo Seong Choi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Bootstrap::Tagsinput::Rails
|
2
|
+
|
3
|
+
Original Git source - https://github.com/timschlechter/bootstrap-tagsinput
|
4
|
+
|
5
|
+
To gemify the assets of `bootstrap-tagsinput` jQuery plugin for Rails >= 3.1
|
6
|
+
|
7
|
+
## Compatibility
|
8
|
+
|
9
|
+
Designed for Bootstrap 2.3.2 and 3
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
gem 'bootstrap-tagsinput-rails'
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install bootstrap-tagsinput-rails
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
in app/assets/application.js
|
28
|
+
|
29
|
+
```
|
30
|
+
//= require bootstrap-tagsinput
|
31
|
+
```
|
32
|
+
|
33
|
+
in app/assets/application.css
|
34
|
+
|
35
|
+
```
|
36
|
+
*= require bootstrap-tagsinput
|
37
|
+
```
|
38
|
+
|
39
|
+
in form view, you should add `data-role='tagsinput'` within input tag as the follows: for example, in `simple-form` view template,
|
40
|
+
|
41
|
+
```
|
42
|
+
<%= f.input :tag_list, input_html:{data:{role:'tagsinput'}} %>
|
43
|
+
```
|
44
|
+
|
45
|
+
That's it
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
1. Fork it
|
50
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
51
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
52
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
53
|
+
5. Create new Pull Request
|
@@ -0,0 +1,80 @@
|
|
1
|
+
angular.module('bootstrap-tagsinput', [])
|
2
|
+
.directive('bootstrapTagsinput', [function() {
|
3
|
+
|
4
|
+
function getItemProperty(scope, property) {
|
5
|
+
if (!property)
|
6
|
+
return undefined;
|
7
|
+
|
8
|
+
if (angular.isFunction(scope.$parent[property]))
|
9
|
+
return scope.$parent[property];
|
10
|
+
|
11
|
+
return function(item) {
|
12
|
+
return item[property];
|
13
|
+
};
|
14
|
+
}
|
15
|
+
|
16
|
+
return {
|
17
|
+
restrict: 'EA',
|
18
|
+
scope: {
|
19
|
+
model: '=ngModel'
|
20
|
+
},
|
21
|
+
template: '<select multiple></select>',
|
22
|
+
replace: false,
|
23
|
+
link: function(scope, element, attrs) {
|
24
|
+
$(function() {
|
25
|
+
if (!angular.isArray(scope.model))
|
26
|
+
scope.model = [];
|
27
|
+
|
28
|
+
var select = $('select', element);
|
29
|
+
|
30
|
+
select.tagsinput({
|
31
|
+
typeahead : {
|
32
|
+
source : angular.isFunction(scope.$parent[attrs.typeaheadSource]) ? scope.$parent[attrs.typeaheadSource] : null
|
33
|
+
},
|
34
|
+
itemValue: getItemProperty(scope, attrs.itemvalue),
|
35
|
+
itemText : getItemProperty(scope, attrs.itemtext),
|
36
|
+
tagClass : angular.isFunction(scope.$parent[attrs.tagclass]) ? scope.$parent[attrs.tagclass] : function(item) { return attrs.tagclass; }
|
37
|
+
});
|
38
|
+
|
39
|
+
for (var i = 0; i < scope.model.length; i++) {
|
40
|
+
select.tagsinput('add', scope.model[i]);
|
41
|
+
}
|
42
|
+
|
43
|
+
select.on('itemAdded', function(event) {
|
44
|
+
if (scope.model.indexOf(event.item) === -1)
|
45
|
+
scope.model.push(event.item);
|
46
|
+
});
|
47
|
+
|
48
|
+
select.on('itemRemoved', function(event) {
|
49
|
+
var idx = scope.model.indexOf(event.item);
|
50
|
+
if (idx !== -1)
|
51
|
+
scope.model.splice(idx, 1);
|
52
|
+
});
|
53
|
+
|
54
|
+
// create a shallow copy of model's current state, needed to determine
|
55
|
+
// diff when model changes
|
56
|
+
var prev = scope.model.slice();
|
57
|
+
scope.$watch("model", function() {
|
58
|
+
var added = scope.model.filter(function(i) {return prev.indexOf(i) === -1;}),
|
59
|
+
removed = prev.filter(function(i) {return scope.model.indexOf(i) === -1;}),
|
60
|
+
i;
|
61
|
+
|
62
|
+
prev = scope.model.slice();
|
63
|
+
|
64
|
+
// Remove tags no longer in binded model
|
65
|
+
for (i = 0; i < removed.length; i++) {
|
66
|
+
select.tagsinput('remove', removed[i]);
|
67
|
+
}
|
68
|
+
|
69
|
+
// Refresh remaining tags
|
70
|
+
select.tagsinput('refresh');
|
71
|
+
|
72
|
+
// Add new items in model as tags
|
73
|
+
for (i = 0; i < added.length; i++) {
|
74
|
+
select.tagsinput('add', added[i]);
|
75
|
+
}
|
76
|
+
}, true);
|
77
|
+
});
|
78
|
+
}
|
79
|
+
};
|
80
|
+
}]);
|
@@ -0,0 +1,405 @@
|
|
1
|
+
(function ($) {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var defaultOptions = {
|
5
|
+
tagClass: function(item) {
|
6
|
+
return 'label label-info';
|
7
|
+
},
|
8
|
+
itemValue: function(item) {
|
9
|
+
return item ? item.toString() : item;
|
10
|
+
},
|
11
|
+
itemText: function(item) {
|
12
|
+
return this.itemValue(item);
|
13
|
+
},
|
14
|
+
freeInput : true
|
15
|
+
};
|
16
|
+
|
17
|
+
function TagsInput(element, options) {
|
18
|
+
this.itemsArray = [];
|
19
|
+
|
20
|
+
this.$element = $(element);
|
21
|
+
this.$element.hide();
|
22
|
+
|
23
|
+
this.isSelect = (element.tagName === 'SELECT');
|
24
|
+
this.multiple = (this.isSelect && element.hasAttribute('multiple'));
|
25
|
+
this.objectItems = options && options.itemValue;
|
26
|
+
|
27
|
+
this.$container = $('<div class="bootstrap-tagsinput"></div>');
|
28
|
+
this.$input = $('<input size="1" type="text" />').appendTo(this.$container);
|
29
|
+
|
30
|
+
this.$element.after(this.$container);
|
31
|
+
|
32
|
+
this.build(options);
|
33
|
+
}
|
34
|
+
|
35
|
+
TagsInput.prototype = {
|
36
|
+
constructor: TagsInput,
|
37
|
+
|
38
|
+
add: function(item, dontPushVal) {
|
39
|
+
var self = this;
|
40
|
+
|
41
|
+
// Ignore falsey values, except false
|
42
|
+
if (item !== false && !item)
|
43
|
+
return;
|
44
|
+
|
45
|
+
// Throw an error when trying to add an object while the itemValue option was not set
|
46
|
+
if (typeof item === "object" && !self.objectItems)
|
47
|
+
throw("Can't add objects when itemValue option is not set");
|
48
|
+
|
49
|
+
// Ignore strings only containg whitespace
|
50
|
+
if (item.toString().match(/^\s*$/))
|
51
|
+
return;
|
52
|
+
|
53
|
+
// If SELECT but not multiple, remove current tag
|
54
|
+
if (self.isSelect && !self.multiple && self.itemsArray.length > 0)
|
55
|
+
self.remove(self.itemsArray[0]);
|
56
|
+
|
57
|
+
if (typeof item === "string" && this.$element[0].tagName === 'INPUT') {
|
58
|
+
var items = item.split(',');
|
59
|
+
if (items.length > 1) {
|
60
|
+
for (var i = 0; i < items.length; i++) {
|
61
|
+
this.add(items[i], true);
|
62
|
+
}
|
63
|
+
|
64
|
+
if (!dontPushVal)
|
65
|
+
self.pushVal();
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
// Ignore items allready added
|
71
|
+
var itemValue = self.options.itemValue(item),
|
72
|
+
itemText = self.options.itemText(item),
|
73
|
+
tagClass = self.options.tagClass(item);
|
74
|
+
|
75
|
+
if ($.grep(self.itemsArray, function(item) { return self.options.itemValue(item) === itemValue; } )[0])
|
76
|
+
return;
|
77
|
+
|
78
|
+
// register item in internal array and map
|
79
|
+
self.itemsArray.push(item);
|
80
|
+
|
81
|
+
// add a tag element
|
82
|
+
var $tag = $('<span class="tag ' + htmlEncode(tagClass) + '">' + htmlEncode(itemText) + '<span data-role="remove"></span></span>');
|
83
|
+
$tag.data('item', item);
|
84
|
+
self.$input.before($tag);
|
85
|
+
|
86
|
+
// add <option /> if item represents a value not present in one of the <select />'s options
|
87
|
+
if (self.isSelect && !$('option[value="' + escape(itemValue) + '"]')[0]) {
|
88
|
+
var $option = $('<option selected>' + htmlEncode(itemText) + '</option>');
|
89
|
+
$option.data('item', item);
|
90
|
+
$option.attr('value', itemValue);
|
91
|
+
self.$element.append($option);
|
92
|
+
}
|
93
|
+
|
94
|
+
if (!dontPushVal)
|
95
|
+
self.pushVal();
|
96
|
+
|
97
|
+
self.$element.trigger($.Event('itemAdded', { item: item }));
|
98
|
+
},
|
99
|
+
|
100
|
+
remove: function(item, dontPushVal) {
|
101
|
+
var self = this;
|
102
|
+
|
103
|
+
if (self.objectItems) {
|
104
|
+
if (typeof item === "object")
|
105
|
+
item = $.grep(self.itemsArray, function(other) { return self.options.itemValue(other) == self.options.itemValue(item); } )[0];
|
106
|
+
else
|
107
|
+
item = $.grep(self.itemsArray, function(other) { return self.options.itemValue(other) == item; } )[0];
|
108
|
+
}
|
109
|
+
|
110
|
+
if (item) {
|
111
|
+
$('.tag', self.$container).filter(function() { return $(this).data('item') === item; }).remove();
|
112
|
+
$('option', self.$element).filter(function() { return $(this).data('item') === item; }).remove();
|
113
|
+
self.itemsArray.splice(self.itemsArray.indexOf(item), 1);
|
114
|
+
}
|
115
|
+
|
116
|
+
if (!dontPushVal)
|
117
|
+
self.pushVal();
|
118
|
+
|
119
|
+
self.$element.trigger($.Event('itemRemoved', { item: item }));
|
120
|
+
},
|
121
|
+
|
122
|
+
removeAll: function() {
|
123
|
+
var self = this;
|
124
|
+
|
125
|
+
$('.tag', self.$container).remove();
|
126
|
+
$('option', self.$element).remove();
|
127
|
+
|
128
|
+
while(self.itemsArray.length > 0)
|
129
|
+
self.itemsArray.pop();
|
130
|
+
|
131
|
+
self.pushVal();
|
132
|
+
},
|
133
|
+
|
134
|
+
refresh: function() {
|
135
|
+
var self = this;
|
136
|
+
$('.tag', self.$container).each(function() {
|
137
|
+
var $tag = $(this),
|
138
|
+
item = $tag.data('item'),
|
139
|
+
itemValue = self.options.itemValue(item),
|
140
|
+
itemText = self.options.itemText(item),
|
141
|
+
tagClass = self.options.tagClass(item);
|
142
|
+
|
143
|
+
// Update tag's class and inner text
|
144
|
+
$tag.attr('class', null);
|
145
|
+
$tag.addClass('tag ' + htmlEncode(tagClass));
|
146
|
+
$tag.contents().filter(function() {
|
147
|
+
return this.nodeType == 3;
|
148
|
+
})[0].nodeValue = htmlEncode(itemText);
|
149
|
+
|
150
|
+
if (self.isSelect) {
|
151
|
+
var option = $('option', self.$element).filter(function() { return $(this).data('item') === item; });
|
152
|
+
option.attr('value', itemValue);
|
153
|
+
}
|
154
|
+
});
|
155
|
+
},
|
156
|
+
|
157
|
+
// Returns the items added as tags
|
158
|
+
items: function() {
|
159
|
+
return this.itemsArray;
|
160
|
+
},
|
161
|
+
|
162
|
+
// Assembly value by retrieving the value of each item, and set it on the element.
|
163
|
+
pushVal: function() {
|
164
|
+
var self = this,
|
165
|
+
val = $.map(self.items(), function(item) {
|
166
|
+
return self.options.itemValue(item).toString();
|
167
|
+
});
|
168
|
+
|
169
|
+
self.$element.val(val, true).trigger('change');
|
170
|
+
},
|
171
|
+
|
172
|
+
build: function(options) {
|
173
|
+
var self = this;
|
174
|
+
|
175
|
+
self.options = $.extend({}, defaultOptions, options);
|
176
|
+
var typeahead = self.options.typeahead || {};
|
177
|
+
|
178
|
+
// When itemValue is set, freeInput should always be false
|
179
|
+
if (self.objectItems)
|
180
|
+
self.options.freeInput = false;
|
181
|
+
|
182
|
+
makeOptionItemFunction(self.options, 'itemValue');
|
183
|
+
makeOptionItemFunction(self.options, 'itemText');
|
184
|
+
makeOptionItemFunction(self.options, 'tagClass');
|
185
|
+
|
186
|
+
// for backwards compatibility, self.options.source is deprecated
|
187
|
+
if (self.options.source)
|
188
|
+
typeahead.source = self.options.source;
|
189
|
+
|
190
|
+
if (typeahead.source && $.fn.typeahead) {
|
191
|
+
makeOptionFunction(typeahead, 'source');
|
192
|
+
|
193
|
+
self.$input.typeahead({
|
194
|
+
source: function (query, process) {
|
195
|
+
function processItems(items) {
|
196
|
+
var texts = [];
|
197
|
+
|
198
|
+
for (var i = 0; i < items.length; i++) {
|
199
|
+
var text = self.options.itemText(items[i]);
|
200
|
+
map[text] = items[i];
|
201
|
+
texts.push(text);
|
202
|
+
}
|
203
|
+
process(texts);
|
204
|
+
}
|
205
|
+
|
206
|
+
this.map = {};
|
207
|
+
var map = this.map,
|
208
|
+
data = typeahead.source(query);
|
209
|
+
|
210
|
+
if ($.isFunction(data.success)) {
|
211
|
+
// support for Angular promises
|
212
|
+
data.success(processItems);
|
213
|
+
} else {
|
214
|
+
// support for functions and jquery promises
|
215
|
+
$.when(data)
|
216
|
+
.then(processItems);
|
217
|
+
}
|
218
|
+
},
|
219
|
+
updater: function (text) {
|
220
|
+
self.add(this.map[text]);
|
221
|
+
},
|
222
|
+
matcher: function (text) {
|
223
|
+
return (text.toLowerCase().indexOf(this.query.trim().toLowerCase()) !== -1);
|
224
|
+
},
|
225
|
+
sorter: function (texts) {
|
226
|
+
return texts.sort();
|
227
|
+
},
|
228
|
+
highlighter: function (text) {
|
229
|
+
var regex = new RegExp( '(' + this.query + ')', 'gi' );
|
230
|
+
return text.replace( regex, "<strong>$1</strong>" );
|
231
|
+
}
|
232
|
+
});
|
233
|
+
}
|
234
|
+
|
235
|
+
self.$container.on('click', $.proxy(function(event) {
|
236
|
+
self.$input.focus();
|
237
|
+
}, self));
|
238
|
+
|
239
|
+
self.$container.on('keydown', 'input', $.proxy(function(event) {
|
240
|
+
var $input = $(event.target);
|
241
|
+
switch (event.which) {
|
242
|
+
// BACKSPACE
|
243
|
+
case 8:
|
244
|
+
if (doGetCaretPosition($input[0]) === 0) {
|
245
|
+
var prev = $input.prev();
|
246
|
+
if (prev) {
|
247
|
+
self.remove(prev.data('item'));
|
248
|
+
}
|
249
|
+
}
|
250
|
+
break;
|
251
|
+
|
252
|
+
// DELETE
|
253
|
+
case 46:
|
254
|
+
if (doGetCaretPosition($input[0]) === 0) {
|
255
|
+
var next = $input.next();
|
256
|
+
if (next) {
|
257
|
+
self.remove(next.data('item'));
|
258
|
+
}
|
259
|
+
}
|
260
|
+
break;
|
261
|
+
|
262
|
+
// LEFT ARROW
|
263
|
+
case 37:
|
264
|
+
// Try to move the input before the previous tag
|
265
|
+
var $prevTag = $input.prev();
|
266
|
+
if ($input.val().length === 0 && $prevTag[0]) {
|
267
|
+
$prevTag.before($input);
|
268
|
+
$input.focus();
|
269
|
+
}
|
270
|
+
break;
|
271
|
+
// LEFT ARROW
|
272
|
+
case 39:
|
273
|
+
// Try to move the input before the previous tag
|
274
|
+
var $nextTag = $input.next();
|
275
|
+
if ($input.val().length === 0 && $nextTag[0]) {
|
276
|
+
$nextTag.after($input);
|
277
|
+
$input.focus();
|
278
|
+
}
|
279
|
+
break;
|
280
|
+
// ENTER
|
281
|
+
case 13:
|
282
|
+
if (self.options.freeInput) {
|
283
|
+
self.add($input.val());
|
284
|
+
$input.val('');
|
285
|
+
event.preventDefault();
|
286
|
+
}
|
287
|
+
break;
|
288
|
+
|
289
|
+
}
|
290
|
+
|
291
|
+
$input.attr('size', Math.max(1, $input.val().length));
|
292
|
+
}, self));
|
293
|
+
|
294
|
+
// Remove icon clicked
|
295
|
+
self.$container.on('click', '[data-role=remove]', $.proxy(function(event) {
|
296
|
+
self.remove($(event.target).closest('.tag').data('item'));
|
297
|
+
}, self));
|
298
|
+
|
299
|
+
if (self.$element[0].tagName === 'INPUT') {
|
300
|
+
self.add(self.$element.val());
|
301
|
+
} else {
|
302
|
+
$('option', self.$element).each(function() {
|
303
|
+
self.add($(this).attr('value'), true);
|
304
|
+
});
|
305
|
+
}
|
306
|
+
},
|
307
|
+
|
308
|
+
destroy: function() {
|
309
|
+
var self = this;
|
310
|
+
|
311
|
+
// Unbind events
|
312
|
+
self.$container.off('keypress', 'input');
|
313
|
+
self.$container.off('click', '[50role=remove]');
|
314
|
+
|
315
|
+
self.$container.remove();
|
316
|
+
self.$element.removeData('tagsinput');
|
317
|
+
self.$element.show();
|
318
|
+
},
|
319
|
+
|
320
|
+
focus: function() {
|
321
|
+
this.$input.focus();
|
322
|
+
}
|
323
|
+
};
|
324
|
+
|
325
|
+
// Register JQuery plugin
|
326
|
+
$.fn.tagsinput = function(arg1, arg2) {
|
327
|
+
var results = [];
|
328
|
+
|
329
|
+
this.each(function() {
|
330
|
+
var tagsinput = $(this).data('tagsinput');
|
331
|
+
|
332
|
+
// Initialize a new tags input
|
333
|
+
if (!tagsinput) {
|
334
|
+
tagsinput = new TagsInput(this, arg1);
|
335
|
+
$(this).data('tagsinput', tagsinput);
|
336
|
+
results.push(tagsinput);
|
337
|
+
|
338
|
+
if (this.tagName === 'SELECT') {
|
339
|
+
$('option', $(this)).attr('selected', 'selected');
|
340
|
+
}
|
341
|
+
|
342
|
+
// Init tags from $(this).val()
|
343
|
+
$(this).val($(this).val());
|
344
|
+
} else {
|
345
|
+
// Invoke function on existing tags input
|
346
|
+
var retVal = tagsinput[arg1](arg2);
|
347
|
+
if (retVal !== undefined)
|
348
|
+
results.push(retVal);
|
349
|
+
}
|
350
|
+
});
|
351
|
+
|
352
|
+
if ( typeof arg1 == 'string') {
|
353
|
+
// Return the results from the invoked function calls
|
354
|
+
return results.length > 1 ? results : results[0];
|
355
|
+
} else {
|
356
|
+
return results;
|
357
|
+
}
|
358
|
+
};
|
359
|
+
|
360
|
+
$.fn.tagsinput.Constructor = TagsInput;
|
361
|
+
|
362
|
+
// Most options support both a string or number as well as a function as
|
363
|
+
// option value. This function makes sure that the option with the given
|
364
|
+
// key in the given options is wrapped in a function
|
365
|
+
function makeOptionItemFunction(options, key) {
|
366
|
+
if (typeof options[key] !== 'function') {
|
367
|
+
var value = options[key];
|
368
|
+
options[key] = function(item) { return item[value]; };
|
369
|
+
}
|
370
|
+
}
|
371
|
+
function makeOptionFunction(options, key) {
|
372
|
+
if (typeof options[key] !== 'function') {
|
373
|
+
var value = options[key];
|
374
|
+
options[key] = function() { return value; };
|
375
|
+
}
|
376
|
+
}
|
377
|
+
// HtmlEncodes the given value
|
378
|
+
var htmlEncodeContainer = $('<div />');
|
379
|
+
function htmlEncode(value) {
|
380
|
+
if (value) {
|
381
|
+
return htmlEncodeContainer.text(value).html();
|
382
|
+
} else {
|
383
|
+
return '';
|
384
|
+
}
|
385
|
+
}
|
386
|
+
|
387
|
+
// Returns the position of the caret in the given input field
|
388
|
+
// http://flightschool.acylt.com/devnotes/caret-position-woes/
|
389
|
+
function doGetCaretPosition(oField) {
|
390
|
+
var iCaretPos = 0;
|
391
|
+
if (document.selection) {
|
392
|
+
oField.focus ();
|
393
|
+
var oSel = document.selection.createRange();
|
394
|
+
oSel.moveStart ('character', -oField.value.length);
|
395
|
+
iCaretPos = oSel.text.length;
|
396
|
+
} else if (oField.selectionStart || oField.selectionStart == '0') {
|
397
|
+
iCaretPos = oField.selectionStart;
|
398
|
+
}
|
399
|
+
return (iCaretPos);
|
400
|
+
}
|
401
|
+
|
402
|
+
$(function() {
|
403
|
+
$("input[data-role=tagsinput], select[multiple][data-role=tagsinput]").tagsinput();
|
404
|
+
});
|
405
|
+
})(window.jQuery);
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/*
|
2
|
+
* bootstrap-tagsinput v0.3.2 by Tim Schlechter
|
3
|
+
*
|
4
|
+
*/
|
5
|
+
!function(a){"use strict";function b(b,c){this.itemsArray=[],this.$element=a(b),this.$element.hide(),this.isSelect="SELECT"===b.tagName,this.multiple=this.isSelect&&b.hasAttribute("multiple"),this.objectItems=c&&c.itemValue,this.$container=a('<div class="bootstrap-tagsinput"></div>'),this.$input=a('<input size="1" type="text" />').appendTo(this.$container),this.$element.after(this.$container),this.build(c)}function c(a,b){if("function"!=typeof a[b]){var c=a[b];a[b]=function(a){return a[c]}}}function d(a,b){if("function"!=typeof a[b]){var c=a[b];a[b]=function(){return c}}}function e(a){return a?h.text(a).html():""}function f(a){var b=0;if(document.selection){a.focus();var c=document.selection.createRange();c.moveStart("character",-a.value.length),b=c.text.length}else(a.selectionStart||"0"==a.selectionStart)&&(b=a.selectionStart);return b}var g={tagClass:function(){return"label label-info"},itemValue:function(a){return a?a.toString():a},itemText:function(a){return this.itemValue(a)},freeInput:!0};b.prototype={constructor:b,add:function(b,c){var d=this;if(b===!1||b){if("object"==typeof b&&!d.objectItems)throw"Can't add objects when itemValue option is not set";if(!b.toString().match(/^\s*$/)){if(d.isSelect&&!d.multiple&&d.itemsArray.length>0&&d.remove(d.itemsArray[0]),"string"==typeof b&&"INPUT"===this.$element[0].tagName){var f=b.split(",");if(f.length>1){for(var g=0;g<f.length;g++)this.add(f[g],!0);return c||d.pushVal(),void 0}}var h=d.options.itemValue(b),i=d.options.itemText(b),j=d.options.tagClass(b);if(!a.grep(d.itemsArray,function(a){return d.options.itemValue(a)===h})[0]){d.itemsArray.push(b);var k=a('<span class="tag '+e(j)+'">'+e(i)+'<span data-role="remove"></span></span>');if(k.data("item",b),d.$input.before(k),d.isSelect&&!a('option[value="'+escape(h)+'"]')[0]){var l=a("<option selected>"+e(i)+"</option>");l.data("item",b),l.attr("value",h),d.$element.append(l)}c||d.pushVal(),d.$element.trigger(a.Event("itemAdded",{item:b}))}}}},remove:function(b,c){var d=this;d.objectItems&&(b="object"==typeof b?a.grep(d.itemsArray,function(a){return d.options.itemValue(a)==d.options.itemValue(b)})[0]:a.grep(d.itemsArray,function(a){return d.options.itemValue(a)==b})[0]),b&&(a(".tag",d.$container).filter(function(){return a(this).data("item")===b}).remove(),a("option",d.$element).filter(function(){return a(this).data("item")===b}).remove(),d.itemsArray.splice(d.itemsArray.indexOf(b),1)),c||d.pushVal(),d.$element.trigger(a.Event("itemRemoved",{item:b}))},removeAll:function(){var b=this;for(a(".tag",b.$container).remove(),a("option",b.$element).remove();b.itemsArray.length>0;)b.itemsArray.pop();b.pushVal()},refresh:function(){var b=this;a(".tag",b.$container).each(function(){var c=a(this),d=c.data("item"),f=b.options.itemValue(d),g=b.options.itemText(d),h=b.options.tagClass(d);if(c.attr("class",null),c.addClass("tag "+e(h)),c.contents().filter(function(){return 3==this.nodeType})[0].nodeValue=e(g),b.isSelect){var i=a("option",b.$element).filter(function(){return a(this).data("item")===d});i.attr("value",f)}})},items:function(){return this.itemsArray},pushVal:function(){var b=this,c=a.map(b.items(),function(a){return b.options.itemValue(a).toString()});b.$element.val(c,!0).trigger("change")},build:function(b){var e=this;e.options=a.extend({},g,b);var h=e.options.typeahead||{};e.objectItems&&(e.options.freeInput=!1),c(e.options,"itemValue"),c(e.options,"itemText"),c(e.options,"tagClass"),e.options.source&&(h.source=e.options.source),h.source&&a.fn.typeahead&&(d(h,"source"),e.$input.typeahead({source:function(b,c){function d(a){for(var b=[],d=0;d<a.length;d++){var g=e.options.itemText(a[d]);f[g]=a[d],b.push(g)}c(b)}this.map={};var f=this.map,g=h.source(b);a.isFunction(g.success)?g.success(d):a.when(g).then(d)},updater:function(a){e.add(this.map[a])},matcher:function(a){return-1!==a.toLowerCase().indexOf(this.query.trim().toLowerCase())},sorter:function(a){return a.sort()},highlighter:function(a){var b=new RegExp("("+this.query+")","gi");return a.replace(b,"<strong>$1</strong>")}})),e.$container.on("click",a.proxy(function(){e.$input.focus()},e)),e.$container.on("keydown","input",a.proxy(function(b){var c=a(b.target);switch(b.which){case 8:if(0===f(c[0])){var d=c.prev();d&&e.remove(d.data("item"))}break;case 46:if(0===f(c[0])){var g=c.next();g&&e.remove(g.data("item"))}break;case 37:var h=c.prev();0===c.val().length&&h[0]&&(h.before(c),c.focus());break;case 39:var i=c.next();0===c.val().length&&i[0]&&(i.after(c),c.focus());break;case 13:e.options.freeInput&&(e.add(c.val()),c.val(""),b.preventDefault())}c.attr("size",Math.max(1,c.val().length))},e)),e.$container.on("click","[data-role=remove]",a.proxy(function(b){e.remove(a(b.target).closest(".tag").data("item"))},e)),"INPUT"===e.$element[0].tagName?e.add(e.$element.val()):a("option",e.$element).each(function(){e.add(a(this).attr("value"),!0)})},destroy:function(){var a=this;a.$container.off("keypress","input"),a.$container.off("click","[50role=remove]"),a.$container.remove(),a.$element.removeData("tagsinput"),a.$element.show()},focus:function(){this.$input.focus()}},a.fn.tagsinput=function(c,d){var e=[];return this.each(function(){var f=a(this).data("tagsinput");if(f){var g=f[c](d);void 0!==g&&e.push(g)}else f=new b(this,c),a(this).data("tagsinput",f),e.push(f),"SELECT"===this.tagName&&a("option",a(this)).attr("selected","selected"),a(this).val(a(this).val())}),"string"==typeof c?e.length>1?e:e[0]:e},a.fn.tagsinput.Constructor=b;var h=a("<div />");a(function(){a("input[data-role=tagsinput], select[multiple][data-role=tagsinput]").tagsinput()})}(window.jQuery);
|
6
|
+
/*
|
7
|
+
//@ sourceMappingURL=bootstrap-tagsinput.min.js.map
|
8
|
+
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"examples/assets/bootstrap-tagsinput.min.js","sources":["src/bootstrap-tagsinput.js"],"names":["$","TagsInput","element","options","this","itemsArray","$element","hide","isSelect","tagName","multiple","hasAttribute","objectItems","itemValue","$container","$input","appendTo","after","build","makeOptionItemFunction","key","value","item","makeOptionFunction","htmlEncode","htmlEncodeContainer","text","html","doGetCaretPosition","oField","iCaretPos","document","selection","focus","oSel","createRange","moveStart","length","selectionStart","defaultOptions","tagClass","toString","itemText","freeInput","prototype","constructor","add","dontPushVal","self","match","remove","items","split","i","pushVal","grep","push","$tag","data","before","escape","$option","attr","append","trigger","Event","other","filter","splice","indexOf","removeAll","pop","refresh","each","addClass","contents","nodeType","nodeValue","option","val","map","extend","typeahead","source","fn","query","process","processItems","texts","isFunction","success","when","then","updater","matcher","toLowerCase","trim","sorter","sort","highlighter","regex","RegExp","replace","on","proxy","event","target","which","prev","next","$prevTag","$nextTag","preventDefault","Math","max","closest","destroy","off","removeData","show","tagsinput","arg1","arg2","results","retVal","undefined","Constructor","window","jQuery"],"mappings":"CAAA,SAAWA,GACT,YAeA,SAASC,GAAUC,EAASC,GAC1BC,KAAKC,cAELD,KAAKE,SAAWN,EAAEE,GAClBE,KAAKE,SAASC,OAEdH,KAAKI,SAAgC,WAApBN,EAAQO,QACzBL,KAAKM,SAAYN,KAAKI,UAAYN,EAAQS,aAAa,YACvDP,KAAKQ,YAAcT,GAAWA,EAAQU,UAEtCT,KAAKU,WAAad,EAAE,2CACpBI,KAAKW,OAASf,EAAE,kCAAkCgB,SAASZ,KAAKU,YAEhEV,KAAKE,SAASW,MAAMb,KAAKU,YAEzBV,KAAKc,MAAMf,GA6Ub,QAASgB,GAAuBhB,EAASiB,GACvC,GAA4B,kBAAjBjB,GAAQiB,GAAqB,CACtC,GAAIC,GAAQlB,EAAQiB,EACpBjB,GAAQiB,GAAO,SAASE,GAAQ,MAAOA,GAAKD,KAGhD,QAASE,GAAmBpB,EAASiB,GACnC,GAA4B,kBAAjBjB,GAAQiB,GAAqB,CACtC,GAAIC,GAAQlB,EAAQiB,EACpBjB,GAAQiB,GAAO,WAAa,MAAOC,KAKvC,QAASG,GAAWH,GAClB,MAAIA,GACKI,EAAoBC,KAAKL,GAAOM,OAEhC,GAMX,QAASC,GAAmBC,GAC1B,GAAIC,GAAY,CAChB,IAAIC,SAASC,UAAW,CACtBH,EAAOI,OACP,IAAIC,GAAOH,SAASC,UAAUG,aAC9BD,GAAKE,UAAW,aAAcP,EAAOR,MAAMgB,QAC3CP,EAAYI,EAAKR,KAAKW,YACbR,EAAO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AAjBpH,KAAKK,SACPT,EAAE,SAAUA,EAAEI,OAAO0D,KAAK,WAAY,YAIxC9D,EAAEI,MAAM2E,IAAI/E,EAAEI,MAAM2E,SASJ,gBAAR0C,GAEHE,EAAQtF,OAAS,EAAIsF,EAAUA,EAAQ,GAEvCA,GAIX3H,EAAEoF,GAAGoC,UAAUM,YAAc7H,CAkB7B,IAAIwB,GAAsBzB,EAAE,UAwB5BA,GAAE,WACAA,EAAE,qEAAqEwH,eAExEO,OAAOC"}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
.bootstrap-tagsinput {
|
2
|
+
background-color: #fff;
|
3
|
+
border: 1px solid #ccc;
|
4
|
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
5
|
+
display: inline-block;
|
6
|
+
padding: 4px 6px;
|
7
|
+
margin-bottom: 10px;
|
8
|
+
color: #555;
|
9
|
+
vertical-align: middle;
|
10
|
+
border-radius: 4px;
|
11
|
+
max-width: 100%;
|
12
|
+
line-height: 22px;
|
13
|
+
}
|
14
|
+
.bootstrap-tagsinput input {
|
15
|
+
border: none;
|
16
|
+
box-shadow: none;
|
17
|
+
background-color: transparent;
|
18
|
+
padding: 0;
|
19
|
+
margin: 0;
|
20
|
+
width: auto !important;
|
21
|
+
max-width: inherit;
|
22
|
+
}
|
23
|
+
.bootstrap-tagsinput input:focus {
|
24
|
+
border: none;
|
25
|
+
box-shadow: none;
|
26
|
+
}
|
27
|
+
.bootstrap-tagsinput .tag {
|
28
|
+
margin-right: 5px;
|
29
|
+
color: white;
|
30
|
+
}
|
31
|
+
.bootstrap-tagsinput .tag [data-role="remove"] {
|
32
|
+
margin-left: 8px;
|
33
|
+
cursor: pointer;
|
34
|
+
}
|
35
|
+
.bootstrap-tagsinput .tag [data-role="remove"]:after {
|
36
|
+
content: "x";
|
37
|
+
padding: 0px 2px;
|
38
|
+
}
|
39
|
+
.bootstrap-tagsinput .tag [data-role="remove"]:hover {
|
40
|
+
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
|
41
|
+
}
|
42
|
+
.bootstrap-tagsinput .tag [data-role="remove"]:hover:active {
|
43
|
+
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
|
44
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
.bootstrap-tagsinput {
|
2
|
+
background-color: #fff;
|
3
|
+
border: 1px solid #ccc;
|
4
|
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
5
|
+
display: inline-block;
|
6
|
+
padding: 4px 6px;
|
7
|
+
margin-bottom: 10px;
|
8
|
+
color: #555;
|
9
|
+
vertical-align: middle;
|
10
|
+
border-radius: 4px;
|
11
|
+
max-width: 100%;
|
12
|
+
line-height: 22px;
|
13
|
+
|
14
|
+
input {
|
15
|
+
border: none;
|
16
|
+
box-shadow: none;
|
17
|
+
background-color: transparent;
|
18
|
+
padding: 0;
|
19
|
+
margin: 0;
|
20
|
+
width: auto !important;
|
21
|
+
max-width: inherit;
|
22
|
+
|
23
|
+
&:focus {
|
24
|
+
border: none;
|
25
|
+
box-shadow: none;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
.tag {
|
30
|
+
margin-right: 5px;
|
31
|
+
color: white;
|
32
|
+
|
33
|
+
[data-role="remove"] {
|
34
|
+
margin-left:8px;
|
35
|
+
cursor:pointer;
|
36
|
+
&:after{
|
37
|
+
content: "x";
|
38
|
+
padding:0px 2px;
|
39
|
+
}
|
40
|
+
&:hover {
|
41
|
+
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
|
42
|
+
&:active {
|
43
|
+
box-shadow: inset 0 3px 5px rgba(0,0,0,0.125);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bootstrap-tagsinput-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hyo Seong Choi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: To gemify bootstrap-tagsinput for assets pipleline
|
56
|
+
email:
|
57
|
+
- rorlab@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- lib/bootstrap/tagsinput/rails/version.rb
|
63
|
+
- lib/bootstrap/tagsinput/rails.rb
|
64
|
+
- vendor/assets/javascripts/bootstrap-tagsinput-angular.js
|
65
|
+
- vendor/assets/javascripts/bootstrap-tagsinput.js
|
66
|
+
- vendor/assets/javascripts/bootstrap-tagsinput.min.js
|
67
|
+
- vendor/assets/javascripts/bootstrap-tagsinput.min.js.map
|
68
|
+
- vendor/assets/stylesheets/bootstrap-tagsinput.css
|
69
|
+
- vendor/assets/stylesheets/bootstrap-tagsinput.less
|
70
|
+
- LICENSE.txt
|
71
|
+
- README.md
|
72
|
+
homepage: http://rorlab.github.io/bootstrap-taginput-rails/
|
73
|
+
licenses:
|
74
|
+
- MIT
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.0.0
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: Packaging the assets with Bunlder
|
96
|
+
test_files: []
|
97
|
+
has_rdoc:
|