smart_tag 0.1.3 → 0.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.
@@ -1,3 +1,3 @@
1
1
  module SmartTag
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  function SmartTag(select) {
5
5
 
6
- function in_array(array, value) {
6
+ function inArray(array, value) {
7
7
  for (var i = array.length - 1; i >= 0; i--) {
8
8
  if (array[i] == value) {
9
9
  return true;
@@ -13,40 +13,102 @@
13
13
  return false;
14
14
  }
15
15
 
16
- function get_options_text(options) {
17
- var options_text = [];
18
- for (var i = options.length - 1; i >= 0; i--) {
19
- var text = $(options[i]).text();
16
+ function clearText(text) {
17
+ text = text.replace(/\ +/g,""); // 去掉空格
18
+ text = text.replace(/[ ]/g,""); // 去掉空格
19
+ return text = text.replace(/[\r\n]/g,""); // 去掉回车换行
20
+ }
21
+
22
+ function getOptions(selector) {
23
+ var options = [];
24
+ for (var i = selector.length - 1; i >= 0; i--) {
25
+ var text = clearText($(selector[i]).text());
20
26
 
21
- if (!in_array(options_text, text)) {
22
- options_text.push(text);
27
+ if (!inArray(options, text)) {
28
+ options.push(text);
23
29
  }
24
30
  }
25
31
 
26
- return options_text;
32
+ return options;
27
33
  }
28
34
 
29
- function add_tags(ul) {
30
- var selected_options_text = get_options_text(select.children('option:selected'));
31
- ul.tagit("removeAll");
32
- for (var i = selected_options_text.length - 1; i >= 0; i--) {
33
- ul.tagit("createTag", selected_options_text[i]);
35
+ function createTags() {
36
+ for (var i = selected_options.length - 1; i >= 0; i--) {
37
+ ul.tagit("createTag", selected_options[i]);
34
38
  }
35
39
  }
36
40
 
37
- function ul_to_selected(tags) {
38
- for (var i = options.length - 1; i >= 0; i--) {
39
- var option = $(options[i]);
40
- if (in_array(tags, option.text())) {
41
- option.attr("selected", true);
42
- } else {
43
- option.attr("selected", false);
41
+ function changeTags() {
42
+ var new_tags = getOptions(select.children('option:selected'));
43
+ var tags = ul.tagit("assignedTags")
44
+
45
+ // create
46
+ for (var i = new_tags.length - 1; i >= 0; i--) {
47
+ if (!inArray(tags, new_tags[i])) {
48
+ ul.tagit("createTag", new_tags[i]);
49
+ }
50
+ }
51
+
52
+ // remove
53
+ for (var i = tags.length - 1; i >= 0; i--) {
54
+ if (!inArray(new_tags, tags[i])) {
55
+ ul.tagit("removeTagByLabel", tags[i]);
44
56
  }
45
57
  }
46
58
  }
47
59
 
48
- var options = select.children('option');
49
- var all_options_text = get_options_text(options);
60
+ function addSelected(tags, option) {
61
+ if (inArray(tags, clearText(option.text()))) {
62
+ option.attr("selected", true);
63
+ }
64
+ }
65
+
66
+ function removeSelected(tags, option) {
67
+ if (!inArray(tags, clearText(option.text()))) {
68
+ option.attr("selected", false);
69
+ }
70
+ }
71
+
72
+ function changeSelected(tags, method) {
73
+ var options = select.children('option');
74
+ for (var i = options.length - 1; i >= 0; i--) {
75
+ method(tags, $(options[i]));
76
+ }
77
+ }
78
+
79
+ function ajaxAddTag(add_tag) {
80
+ var controller = select.attr('controller');
81
+
82
+ if (controller) {
83
+
84
+ var action = select.attr('action') ? select.attr('action') : 'create';
85
+ var param = select.attr('param') ? select.attr('param') : 'title';
86
+ var controllers = select.attr('controllers') ? select.attr('controllers') : controller+'s';
87
+
88
+ var url = '/'+controllers+'/'+action;
89
+ var data = {};
90
+ data[controller+'['+param+']'] = add_tag;
91
+
92
+ $.ajax({
93
+ url: url,
94
+ dataType: "json",
95
+ type: "POST",
96
+ data: data,
97
+ success: function(json){
98
+ if (json) {
99
+ select.prepend('<option selected="selected" value="'+json.id+'">'+add_tag+'</option>');
100
+ } else {
101
+ console.log("josn is null");
102
+ }
103
+ }
104
+ });
105
+ } else {
106
+ console.log("select's controller param is null");
107
+ }
108
+ }
109
+
110
+ var all_options = getOptions(select.children('option'));
111
+ var selected_options = getOptions(select.children('option:selected'));
50
112
  var ul = $('<ul class="' + select.attr('id') + '_smart_tag"></ul>');
51
113
 
52
114
  select.before(ul);
@@ -57,19 +119,26 @@
57
119
  });
58
120
 
59
121
  ul.tagit({
60
- availableTags: all_options_text,
122
+ availableTags: all_options,
61
123
  afterTagAdded: function(event, ui) {
62
- ul_to_selected(ul.tagit("assignedTags"));
124
+ var add_tag = ui.tagLabel;
125
+ all_options = getOptions(select.children('option'));
126
+
127
+ if (inArray(all_options, add_tag)) {
128
+ changeSelected(ul.tagit("assignedTags"), addSelected);
129
+ } else {
130
+ ajaxAddTag(add_tag);
131
+ }
63
132
  },
64
133
  afterTagRemoved: function(event, ui) {
65
- ul_to_selected(ul.tagit("assignedTags"));
134
+ changeSelected(ul.tagit("assignedTags"), removeSelected);
66
135
  }
67
136
  });
68
137
 
69
- add_tags(ul);
138
+ createTags();
70
139
 
71
140
  select.change(function(){
72
- add_tags(ul);
141
+ changeTags();
73
142
  });
74
143
  }
75
144
 
@@ -0,0 +1 @@
1
+ (function($){$(document).ready(function(){function SmartTag(select){function inArray(array,value){for(var i=array.length-1;i>=0;i--){if(array[i]==value){return true}};return false};function clearText(text){text=text.replace(/\ +/g,"");text=text.replace(/[ ]/g,"");return text=text.replace(/[\r\n]/g,"");};function getOptions(selector){var options=[];for(var i=selector.length-1;i>=0;i--){var text=clearText($(selector[i]).text());if(!inArray(options,text)){options.push(text)}};return options};function createTags(){for(var i=selected_options.length-1;i>=0;i--){ul.tagit("createTag",selected_options[i])}};function changeTags(){var new_tags=getOptions(select.children('option:selected'));var tags=ul.tagit("assignedTags")for(var i=new_tags.length-1;i>=0;i--){if(!inArray(tags,new_tags[i])){ul.tagit("createTag",new_tags[i])}};for(var i=tags.length-1;i>=0;i--){if(!inArray(new_tags,tags[i])){ul.tagit("removeTagByLabel",tags[i])}}};function addSelected(tags,option){if(inArray(tags,clearText(option.text()))){option.attr("selected",true)}};function removeSelected(tags,option){if(!inArray(tags,clearText(option.text()))){option.attr("selected",false)}};function changeSelected(tags,method){var options=select.children('option');for(var i=options.length-1;i>=0;i--){method(tags,$(options[i]))}};function ajaxAddTag(add_tag){var controller=select.attr('controller');if(controller){var action=select.attr('action')?select.attr('action'):'create';var param=select.attr('param')?select.attr('param'):'title';var controllers=select.attr('controllers')?select.attr('controllers'):controller+'s';var url='/'+controllers+'/'+action;var data={};data[controller+'['+param+']']=add_tag;$.ajax({url:url,dataType:"json",type:"POST",data:data,success:function(json){if(json){select.prepend('<option selected="selected" value="'+json.id+'">'+add_tag+'</option>')}else{console.log("josn is null")}}})}else{console.log("select's controller param is null")}};var all_options=getOptions(select.children('option'));var selected_options=getOptions(select.children('option:selected'));var ul=$('<ul class="'+select.attr('id')+'_smart_tag"></ul>');select.before(ul);ul.css({'margin-left':'0px','width':'488px'});ul.tagit({availableTags:all_options,afterTagAdded:function(event,ui){var add_tag=ui.tagLabel;all_options=getOptions(select.children('option'));if(inArray(all_options,add_tag)){changeSelected(ul.tagit("assignedTags"),addSelected)}else{ajaxAddTag(add_tag)}},afterTagRemoved:function(event,ui){changeSelected(ul.tagit("assignedTags"),removeSelected)}});createTags();select.change(function(){changeTags()})};var selects=$(".smart_tag");for(var i=selects.length-1;i>=0;i--){SmartTag($(selects[i]))}})}(window.jQuery));
@@ -0,0 +1,540 @@
1
+ /*
2
+ * jQuery UI Tag-it!
3
+ *
4
+ * @version v2.0 (06/2011)
5
+ *
6
+ * Copyright 2011, Levy Carneiro Jr.
7
+ * Released under the MIT license.
8
+ * http://aehlke.github.com/tag-it/LICENSE
9
+ *
10
+ * Homepage:
11
+ * http://aehlke.github.com/tag-it/
12
+ *
13
+ * Authors:
14
+ * Levy Carneiro Jr.
15
+ * Martin Rehfeld
16
+ * Tobias Schmidt
17
+ * Skylar Challand
18
+ * Alex Ehlke
19
+ *
20
+ * Maintainer:
21
+ * Alex Ehlke - Twitter: @aehlke
22
+ *
23
+ * Dependencies:
24
+ * jQuery v1.4+
25
+ * jQuery UI v1.8+
26
+ */
27
+ (function($) {
28
+
29
+ $.widget('ui.tagit', {
30
+ options: {
31
+ allowDuplicates : false,
32
+ caseSensitive : true,
33
+ fieldName : 'tags',
34
+ placeholderText : null, // Sets `placeholder` attr on input field.
35
+ readOnly : false, // Disables editing.
36
+ removeConfirmation: false, // Require confirmation to remove tags.
37
+ tagLimit : null, // Max number of tags allowed (null for unlimited).
38
+
39
+ // Used for autocomplete, unless you override `autocomplete.source`.
40
+ availableTags : [],
41
+
42
+ // Use to override or add any options to the autocomplete widget.
43
+ //
44
+ // By default, autocomplete.source will map to availableTags,
45
+ // unless overridden.
46
+ autocomplete: {},
47
+
48
+ // Shows autocomplete before the user even types anything.
49
+ showAutocompleteOnFocus: false,
50
+
51
+ // When enabled, quotes are unneccesary for inputting multi-word tags.
52
+ allowSpaces: false,
53
+
54
+ // The below options are for using a single field instead of several
55
+ // for our form values.
56
+ //
57
+ // When enabled, will use a single hidden field for the form,
58
+ // rather than one per tag. It will delimit tags in the field
59
+ // with singleFieldDelimiter.
60
+ //
61
+ // The easiest way to use singleField is to just instantiate tag-it
62
+ // on an INPUT element, in which case singleField is automatically
63
+ // set to true, and singleFieldNode is set to that element. This
64
+ // way, you don't need to fiddle with these options.
65
+ singleField: false,
66
+
67
+ // This is just used when preloading data from the field, and for
68
+ // populating the field with delimited tags as the user adds them.
69
+ singleFieldDelimiter: ',',
70
+
71
+ // Set this to an input DOM node to use an existing form field.
72
+ // Any text in it will be erased on init. But it will be
73
+ // populated with the text of tags as they are created,
74
+ // delimited by singleFieldDelimiter.
75
+ //
76
+ // If this is not set, we create an input node for it,
77
+ // with the name given in settings.fieldName.
78
+ singleFieldNode: null,
79
+
80
+ // Whether to animate tag removals or not.
81
+ animate: true,
82
+
83
+ // Optionally set a tabindex attribute on the input that gets
84
+ // created for tag-it.
85
+ tabIndex: null,
86
+
87
+ // Event callbacks.
88
+ beforeTagAdded : null,
89
+ afterTagAdded : null,
90
+
91
+ beforeTagRemoved : null,
92
+ afterTagRemoved : null,
93
+
94
+ onTagClicked : null,
95
+ onTagLimitExceeded : null,
96
+
97
+
98
+ // DEPRECATED:
99
+ //
100
+ // /!\ These event callbacks are deprecated and WILL BE REMOVED at some
101
+ // point in the future. They're here for backwards-compatibility.
102
+ // Use the above before/after event callbacks instead.
103
+ onTagAdded : null,
104
+ onTagRemoved: null,
105
+ // `autocomplete.source` is the replacement for tagSource.
106
+ tagSource: null
107
+ // Do not use the above deprecated options.
108
+ },
109
+
110
+ _create: function() {
111
+ // for handling static scoping inside callbacks
112
+ var that = this;
113
+
114
+ // There are 2 kinds of DOM nodes this widget can be instantiated on:
115
+ // 1. UL, OL, or some element containing either of these.
116
+ // 2. INPUT, in which case 'singleField' is overridden to true,
117
+ // a UL is created and the INPUT is hidden.
118
+ if (this.element.is('input')) {
119
+ this.tagList = $('<ul></ul>').insertAfter(this.element);
120
+ this.options.singleField = true;
121
+ this.options.singleFieldNode = this.element;
122
+ this.element.css('display', 'none');
123
+ } else {
124
+ this.tagList = this.element.find('ul, ol').andSelf().last();
125
+ }
126
+
127
+ this.tagInput = $('<input type="text" />').addClass('ui-widget-content');
128
+
129
+ if (this.options.readOnly) this.tagInput.attr('disabled', 'disabled');
130
+
131
+ if (this.options.tabIndex) {
132
+ this.tagInput.attr('tabindex', this.options.tabIndex);
133
+ }
134
+
135
+ if (this.options.placeholderText) {
136
+ this.tagInput.attr('placeholder', this.options.placeholderText);
137
+ }
138
+
139
+ if (!this.options.autocomplete.source) {
140
+ this.options.autocomplete.source = function(search, showChoices) {
141
+ var filter = search.term.toLowerCase();
142
+ var choices = $.grep(this.options.availableTags, function(element) {
143
+ // match all
144
+ return (element.toLowerCase().indexOf(filter) > 0);
145
+ });
146
+ if (!this.options.allowDuplicates) {
147
+ choices = this._subtractArray(choices, this.assignedTags());
148
+ }
149
+
150
+ showChoices(choices.reverse());
151
+ };
152
+ }
153
+
154
+ if (this.options.showAutocompleteOnFocus) {
155
+ this.tagInput.focus(function(event, ui) {
156
+ that._showAutocomplete();
157
+ });
158
+
159
+ if (typeof this.options.autocomplete.minLength === 'undefined') {
160
+ this.options.autocomplete.minLength = 0;
161
+ }
162
+ }
163
+
164
+ // Bind autocomplete.source callback functions to this context.
165
+ if ($.isFunction(this.options.autocomplete.source)) {
166
+ this.options.autocomplete.source = $.proxy(this.options.autocomplete.source, this);
167
+ }
168
+
169
+ // DEPRECATED.
170
+ if ($.isFunction(this.options.tagSource)) {
171
+ this.options.tagSource = $.proxy(this.options.tagSource, this);
172
+ }
173
+
174
+ this.tagList
175
+ .addClass('tagit')
176
+ .addClass('ui-widget ui-widget-content ui-corner-all')
177
+ // Create the input field.
178
+ .append($('<li class="tagit-new"></li>').append(this.tagInput))
179
+ .click(function(e) {
180
+ var target = $(e.target);
181
+ if (target.hasClass('tagit-label')) {
182
+ var tag = target.closest('.tagit-choice');
183
+ if (!tag.hasClass('removed')) {
184
+ that._trigger('onTagClicked', e, {tag: tag, tagLabel: that.tagLabel(tag)});
185
+ }
186
+ } else {
187
+ // Sets the focus() to the input field, if the user
188
+ // clicks anywhere inside the UL. This is needed
189
+ // because the input field needs to be of a small size.
190
+ that.tagInput.focus();
191
+ }
192
+ });
193
+
194
+ // Single field support.
195
+ var addedExistingFromSingleFieldNode = false;
196
+ if (this.options.singleField) {
197
+ if (this.options.singleFieldNode) {
198
+ // Add existing tags from the input field.
199
+ var node = $(this.options.singleFieldNode);
200
+ var tags = node.val().split(this.options.singleFieldDelimiter);
201
+ node.val('');
202
+ $.each(tags, function(index, tag) {
203
+ that.createTag(tag, null, true);
204
+ addedExistingFromSingleFieldNode = true;
205
+ });
206
+ } else {
207
+ // Create our single field input after our list.
208
+ this.options.singleFieldNode = $('<input type="hidden" style="display:none;" value="" name="' + this.options.fieldName + '" />');
209
+ this.tagList.after(this.options.singleFieldNode);
210
+ }
211
+ }
212
+
213
+ // Add existing tags from the list, if any.
214
+ if (!addedExistingFromSingleFieldNode) {
215
+ this.tagList.children('li').each(function() {
216
+ if (!$(this).hasClass('tagit-new')) {
217
+ that.createTag($(this).text(), $(this).attr('class'), true);
218
+ $(this).remove();
219
+ }
220
+ });
221
+ }
222
+
223
+ // Events.
224
+ this.tagInput
225
+ .keydown(function(event) {
226
+ // Backspace is not detected within a keypress, so it must use keydown.
227
+ if (event.which == $.ui.keyCode.BACKSPACE && that.tagInput.val() === '') {
228
+ var tag = that._lastTag();
229
+ if (!that.options.removeConfirmation || tag.hasClass('remove')) {
230
+ // When backspace is pressed, the last tag is deleted.
231
+ that.removeTag(tag);
232
+ } else if (that.options.removeConfirmation) {
233
+ tag.addClass('remove ui-state-highlight');
234
+ }
235
+ } else if (that.options.removeConfirmation) {
236
+ that._lastTag().removeClass('remove ui-state-highlight');
237
+ }
238
+
239
+ // Comma/Space/Enter are all valid delimiters for new tags,
240
+ // except when there is an open quote or if setting allowSpaces = true.
241
+ // Tab will also create a tag, unless the tag input is empty,
242
+ // in which case it isn't caught.
243
+ if (
244
+ event.which === $.ui.keyCode.COMMA ||
245
+ event.which === $.ui.keyCode.ENTER ||
246
+ (
247
+ event.which == $.ui.keyCode.TAB &&
248
+ that.tagInput.val() !== ''
249
+ ) ||
250
+ (
251
+ event.which == $.ui.keyCode.SPACE &&
252
+ that.options.allowSpaces !== true &&
253
+ (
254
+ $.trim(that.tagInput.val()).replace( /^s*/, '' ).charAt(0) != '"' ||
255
+ (
256
+ $.trim(that.tagInput.val()).charAt(0) == '"' &&
257
+ $.trim(that.tagInput.val()).charAt($.trim(that.tagInput.val()).length - 1) == '"' &&
258
+ $.trim(that.tagInput.val()).length - 1 !== 0
259
+ )
260
+ )
261
+ )
262
+ ) {
263
+ // Enter submits the form if there's no text in the input.
264
+ if (!(event.which === $.ui.keyCode.ENTER && that.tagInput.val() === '')) {
265
+ event.preventDefault();
266
+ }
267
+
268
+ // Autocomplete will create its own tag from a selection and close automatically.
269
+ if (!that.tagInput.data('autocomplete-open')) {
270
+ that.createTag(that._cleanedInput());
271
+ }
272
+ }
273
+ }).blur(function(e){
274
+ // Create a tag when the element loses focus.
275
+ // If autocomplete is enabled and suggestion was clicked, don't add it.
276
+ if (!that.tagInput.data('autocomplete-open')) {
277
+ that.createTag(that._cleanedInput());
278
+ }
279
+ });
280
+
281
+ // Autocomplete.
282
+ if (this.options.availableTags || this.options.tagSource || this.options.autocomplete.source) {
283
+ var autocompleteOptions = {
284
+ select: function(event, ui) {
285
+ that.createTag(ui.item.value);
286
+ // Preventing the tag input to be updated with the chosen value.
287
+ return false;
288
+ }
289
+ };
290
+ $.extend(autocompleteOptions, this.options.autocomplete);
291
+
292
+ // tagSource is deprecated, but takes precedence here since autocomplete.source is set by default,
293
+ // while tagSource is left null by default.
294
+ autocompleteOptions.source = this.options.tagSource || autocompleteOptions.source;
295
+
296
+ this.tagInput.autocomplete(autocompleteOptions).bind('autocompleteopen', function(event, ui) {
297
+ that.tagInput.data('autocomplete-open', true);
298
+ }).bind('autocompleteclose', function(event, ui) {
299
+ that.tagInput.data('autocomplete-open', false)
300
+ });
301
+ }
302
+ },
303
+
304
+ _cleanedInput: function() {
305
+ // Returns the contents of the tag input, cleaned and ready to be passed to createTag
306
+ return $.trim(this.tagInput.val().replace(/^"(.*)"$/, '$1'));
307
+ },
308
+
309
+ _lastTag: function() {
310
+ return this.tagList.find('.tagit-choice:last:not(.removed)');
311
+ },
312
+
313
+ _tags: function() {
314
+ return this.tagList.find('.tagit-choice:not(.removed)');
315
+ },
316
+
317
+ assignedTags: function() {
318
+ // Returns an array of tag string values
319
+ var that = this;
320
+ var tags = [];
321
+ if (this.options.singleField) {
322
+ tags = $(this.options.singleFieldNode).val().split(this.options.singleFieldDelimiter);
323
+ if (tags[0] === '') {
324
+ tags = [];
325
+ }
326
+ } else {
327
+ this._tags().each(function() {
328
+ tags.push(that.tagLabel(this));
329
+ });
330
+ }
331
+ return tags;
332
+ },
333
+
334
+ _updateSingleTagsField: function(tags) {
335
+ // Takes a list of tag string values, updates this.options.singleFieldNode.val to the tags delimited by this.options.singleFieldDelimiter
336
+ $(this.options.singleFieldNode).val(tags.join(this.options.singleFieldDelimiter)).trigger('change');
337
+ },
338
+
339
+ _subtractArray: function(a1, a2) {
340
+ var result = [];
341
+ for (var i = 0; i < a1.length; i++) {
342
+ if ($.inArray(a1[i], a2) == -1) {
343
+ result.push(a1[i]);
344
+ }
345
+ }
346
+ return result;
347
+ },
348
+
349
+ tagLabel: function(tag) {
350
+ // Returns the tag's string label.
351
+ if (this.options.singleField) {
352
+ return $(tag).find('.tagit-label:first').text();
353
+ } else {
354
+ return $(tag).find('input:first').val();
355
+ }
356
+ },
357
+
358
+ _showAutocomplete: function() {
359
+ this.tagInput.autocomplete('search', '');
360
+ },
361
+
362
+ _findTagByLabel: function(name) {
363
+ var that = this;
364
+ var tag = null;
365
+ this._tags().each(function(i) {
366
+ if (that._formatStr(name) == that._formatStr(that.tagLabel(this))) {
367
+ tag = $(this);
368
+ return false;
369
+ }
370
+ });
371
+ return tag;
372
+ },
373
+
374
+ _isNew: function(name) {
375
+ return !this._findTagByLabel(name);
376
+ },
377
+
378
+ _formatStr: function(str) {
379
+ if (this.options.caseSensitive) {
380
+ return str;
381
+ }
382
+ return $.trim(str.toLowerCase());
383
+ },
384
+
385
+ _effectExists: function(name) {
386
+ return Boolean($.effects && ($.effects[name] || ($.effects.effect && $.effects.effect[name])));
387
+ },
388
+
389
+ createTag: function(value, additionalClass, duringInitialization) {
390
+ var that = this;
391
+
392
+ value = $.trim(value);
393
+
394
+ if(this.options.preprocessTag) {
395
+ value = this.options.preprocessTag(value);
396
+ }
397
+
398
+ if (value === '') {
399
+ return false;
400
+ }
401
+
402
+ if (!this.options.allowDuplicates && !this._isNew(value)) {
403
+ var existingTag = this._findTagByLabel(value);
404
+ if (this._trigger('onTagExists', null, {
405
+ existingTag: existingTag,
406
+ duringInitialization: duringInitialization
407
+ }) !== false) {
408
+ if (this._effectExists('highlight')) {
409
+ existingTag.effect('highlight');
410
+ }
411
+ }
412
+ return false;
413
+ }
414
+
415
+ if (this.options.tagLimit && this._tags().length >= this.options.tagLimit) {
416
+ this._trigger('onTagLimitExceeded', null, {duringInitialization: duringInitialization});
417
+ return false;
418
+ }
419
+
420
+ var label = $(this.options.onTagClicked ? '<a class="tagit-label"></a>' : '<span class="tagit-label"></span>').text(value);
421
+
422
+ // Create tag.
423
+ var tag = $('<li></li>')
424
+ .addClass('tagit-choice ui-widget-content ui-state-default ui-corner-all')
425
+ .addClass(additionalClass)
426
+ .append(label);
427
+
428
+ if (this.options.readOnly){
429
+ tag.addClass('tagit-choice-read-only');
430
+ } else {
431
+ tag.addClass('tagit-choice-editable');
432
+ // Button for removing the tag.
433
+ var removeTagIcon = $('<span></span>')
434
+ .addClass('ui-icon ui-icon-close');
435
+ var removeTag = $('<a><span class="text-icon">\xd7</span></a>') // \xd7 is an X
436
+ .addClass('tagit-close')
437
+ .append(removeTagIcon)
438
+ .click(function(e) {
439
+ // Removes a tag when the little 'x' is clicked.
440
+ that.removeTag(tag);
441
+ });
442
+ tag.append(removeTag);
443
+ }
444
+
445
+ // Unless options.singleField is set, each tag has a hidden input field inline.
446
+ if (!this.options.singleField) {
447
+ var escapedValue = label.html();
448
+ tag.append('<input type="hidden" style="display:none;" value="' + escapedValue + '" name="' + this.options.fieldName + '" />');
449
+ }
450
+
451
+ if (this._trigger('beforeTagAdded', null, {
452
+ tag: tag,
453
+ tagLabel: this.tagLabel(tag),
454
+ duringInitialization: duringInitialization
455
+ }) === false) {
456
+ return;
457
+ }
458
+
459
+ if (this.options.singleField) {
460
+ var tags = this.assignedTags();
461
+ tags.push(value);
462
+ this._updateSingleTagsField(tags);
463
+ }
464
+
465
+ // DEPRECATED.
466
+ this._trigger('onTagAdded', null, tag);
467
+
468
+ this.tagInput.val('');
469
+
470
+ // Insert tag.
471
+ this.tagInput.parent().before(tag);
472
+
473
+ this._trigger('afterTagAdded', null, {
474
+ tag: tag,
475
+ tagLabel: this.tagLabel(tag),
476
+ duringInitialization: duringInitialization
477
+ });
478
+
479
+ if (this.options.showAutocompleteOnFocus && !duringInitialization) {
480
+ setTimeout(function () { that._showAutocomplete(); }, 0);
481
+ }
482
+ },
483
+
484
+ removeTag: function(tag, animate) {
485
+ animate = typeof animate === 'undefined' ? this.options.animate : animate;
486
+
487
+ tag = $(tag);
488
+
489
+ // DEPRECATED.
490
+ this._trigger('onTagRemoved', null, tag);
491
+
492
+ if (this._trigger('beforeTagRemoved', null, {tag: tag, tagLabel: this.tagLabel(tag)}) === false) {
493
+ return;
494
+ }
495
+
496
+ if (this.options.singleField) {
497
+ var tags = this.assignedTags();
498
+ var removedTagLabel = this.tagLabel(tag);
499
+ tags = $.grep(tags, function(el){
500
+ return el != removedTagLabel;
501
+ });
502
+ this._updateSingleTagsField(tags);
503
+ }
504
+
505
+ if (animate) {
506
+ tag.addClass('removed'); // Excludes this tag from _tags.
507
+ var hide_args = this._effectExists('blind') ? ['blind', {direction: 'horizontal'}, 'fast'] : ['fast'];
508
+
509
+ var thisTag = this;
510
+ hide_args.push(function() {
511
+ tag.remove();
512
+ thisTag._trigger('afterTagRemoved', null, {tag: tag, tagLabel: thisTag.tagLabel(tag)});
513
+ });
514
+
515
+ tag.fadeOut('fast').hide.apply(tag, hide_args).dequeue();
516
+ } else {
517
+ tag.remove();
518
+ this._trigger('afterTagRemoved', null, {tag: tag, tagLabel: this.tagLabel(tag)});
519
+ }
520
+
521
+ },
522
+
523
+ removeTagByLabel: function(tagLabel, animate) {
524
+ var toRemove = this._findTagByLabel(tagLabel);
525
+ if (!toRemove) {
526
+ throw "No such tag exists with the name '" + tagLabel + "'";
527
+ }
528
+ this.removeTag(toRemove, animate);
529
+ },
530
+
531
+ removeAll: function() {
532
+ // Removes all tags.
533
+ var that = this;
534
+ this._tags().each(function(index, tag) {
535
+ that.removeTag(tag, false);
536
+ });
537
+ }
538
+
539
+ });
540
+ })(jQuery);
@@ -1,16 +1 @@
1
- (function(b){b.widget("ui.tagit",{options:{allowDuplicates:!1,caseSensitive:!0,fieldName:"tags",placeholderText:null,readOnly:!1,removeConfirmation:!1,tagLimit:null,availableTags:[],autocomplete:{},showAutocompleteOnFocus:!1,allowSpaces:!1,singleField:!1,singleFieldDelimiter:",",singleFieldNode:null,animate:!0,tabIndex:null,beforeTagAdded:null,afterTagAdded:null,beforeTagRemoved:null,afterTagRemoved:null,onTagClicked:null,onTagLimitExceeded:null,onTagAdded:null,onTagRemoved:null,tagSource:null},_create:function(){var a=
2
- this;this.element.is("input")?(this.tagList=b("<ul></ul>").insertAfter(this.element),this.options.singleField=!0,this.options.singleFieldNode=this.element,this.element.css("display","none")):this.tagList=this.element.find("ul, ol").andSelf().last();this.tagInput=b('<input type="text" />').addClass("ui-widget-content");this.options.readOnly&&this.tagInput.attr("disabled","disabled");this.options.tabIndex&&this.tagInput.attr("tabindex",this.options.tabIndex);this.options.placeholderText&&this.tagInput.attr("placeholder",
3
- this.options.placeholderText);this.options.autocomplete.source||(this.options.autocomplete.source=function(a,c){var d=a.term.toLowerCase(),e=b.grep(this.options.availableTags,function(a){return 0===a.toLowerCase().indexOf(d)});c(this._subtractArray(e,this.assignedTags()))});this.options.showAutocompleteOnFocus&&(this.tagInput.focus(function(){a._showAutocomplete()}),"undefined"===typeof this.options.autocomplete.minLength&&(this.options.autocomplete.minLength=0));b.isFunction(this.options.autocomplete.source)&&
4
- (this.options.autocomplete.source=b.proxy(this.options.autocomplete.source,this));b.isFunction(this.options.tagSource)&&(this.options.tagSource=b.proxy(this.options.tagSource,this));this.tagList.addClass("tagit").addClass("ui-widget ui-widget-content ui-corner-all").append(b('<li class="tagit-new"></li>').append(this.tagInput)).click(function(c){var d=b(c.target);d.hasClass("tagit-label")?(d=d.closest(".tagit-choice"),d.hasClass("removed")||a._trigger("onTagClicked",c,{tag:d,tagLabel:a.tagLabel(d)})):
5
- a.tagInput.focus()});var d=!1;if(this.options.singleField)if(this.options.singleFieldNode){var c=b(this.options.singleFieldNode),e=c.val().split(this.options.singleFieldDelimiter);c.val("");b.each(e,function(b,c){a.createTag(c,null,!0);d=!0})}else this.options.singleFieldNode=b('<input type="hidden" style="display:none;" value="" name="'+this.options.fieldName+'" />'),this.tagList.after(this.options.singleFieldNode);d||this.tagList.children("li").each(function(){b(this).hasClass("tagit-new")||(a.createTag(b(this).text(),
6
- b(this).attr("class"),!0),b(this).remove())});this.tagInput.keydown(function(c){if(c.which==b.ui.keyCode.BACKSPACE&&""===a.tagInput.val()){var d=a._lastTag();!a.options.removeConfirmation||d.hasClass("remove")?a.removeTag(d):a.options.removeConfirmation&&d.addClass("remove ui-state-highlight")}else a.options.removeConfirmation&&a._lastTag().removeClass("remove ui-state-highlight");if(c.which===b.ui.keyCode.COMMA||c.which===b.ui.keyCode.ENTER||c.which==b.ui.keyCode.TAB&&""!==a.tagInput.val()||c.which==
7
- b.ui.keyCode.SPACE&&!0!==a.options.allowSpaces&&('"'!=b.trim(a.tagInput.val()).replace(/^s*/,"").charAt(0)||'"'==b.trim(a.tagInput.val()).charAt(0)&&'"'==b.trim(a.tagInput.val()).charAt(b.trim(a.tagInput.val()).length-1)&&0!==b.trim(a.tagInput.val()).length-1))c.which===b.ui.keyCode.ENTER&&""===a.tagInput.val()||c.preventDefault(),a.createTag(a._cleanedInput()),a.tagInput.autocomplete("close")}).blur(function(){a.tagInput.data("autocomplete-open")||a.createTag(a._cleanedInput())});if(this.options.availableTags||
8
- this.options.tagSource||this.options.autocomplete.source)c={select:function(b,c){a.createTag(c.item.value);return!1}},b.extend(c,this.options.autocomplete),c.source=this.options.tagSource||c.source,this.tagInput.autocomplete(c).bind("autocompleteopen",function(){a.tagInput.data("autocomplete-open",!0)}).bind("autocompleteclose",function(){a.tagInput.data("autocomplete-open",!1)})},_cleanedInput:function(){return b.trim(this.tagInput.val().replace(/^"(.*)"$/,"$1"))},_lastTag:function(){return this.tagList.find(".tagit-choice:last:not(.removed)")},
9
- _tags:function(){return this.tagList.find(".tagit-choice:not(.removed)")},assignedTags:function(){var a=this,d=[];this.options.singleField?(d=b(this.options.singleFieldNode).val().split(this.options.singleFieldDelimiter),""===d[0]&&(d=[])):this._tags().each(function(){d.push(a.tagLabel(this))});return d},_updateSingleTagsField:function(a){b(this.options.singleFieldNode).val(a.join(this.options.singleFieldDelimiter)).trigger("change")},_subtractArray:function(a,d){for(var c=[],e=0;e<a.length;e++)-1==
10
- b.inArray(a[e],d)&&c.push(a[e]);return c},tagLabel:function(a){return this.options.singleField?b(a).find(".tagit-label:first").text():b(a).find("input:first").val()},_showAutocomplete:function(){this.tagInput.autocomplete("search","")},_findTagByLabel:function(a){var d=this,c=null;this._tags().each(function(){if(d._formatStr(a)==d._formatStr(d.tagLabel(this)))return c=b(this),!1});return c},_isNew:function(a){return!this._findTagByLabel(a)},_formatStr:function(a){return this.options.caseSensitive?
11
- a:b.trim(a.toLowerCase())},_effectExists:function(a){return Boolean(b.effects&&(b.effects[a]||b.effects.effect&&b.effects.effect[a]))},createTag:function(a,d,c){var e=this;a=b.trim(a);this.options.preprocessTag&&(a=this.options.preprocessTag(a));if(""===a)return!1;if(!this.options.allowDuplicates&&!this._isNew(a))return a=this._findTagByLabel(a),!1!==this._trigger("onTagExists",null,{existingTag:a,duringInitialization:c})&&this._effectExists("highlight")&&a.effect("highlight"),!1;if(this.options.tagLimit&&
12
- this._tags().length>=this.options.tagLimit)return this._trigger("onTagLimitExceeded",null,{duringInitialization:c}),!1;var g=b(this.options.onTagClicked?'<a class="tagit-label"></a>':'<span class="tagit-label"></span>').text(a),f=b("<li></li>").addClass("tagit-choice ui-widget-content ui-state-default ui-corner-all").addClass(d).append(g);this.options.readOnly?f.addClass("tagit-choice-read-only"):(f.addClass("tagit-choice-editable"),d=b("<span></span>").addClass("ui-icon ui-icon-close"),d=b('<a><span class="text-icon">\u00d7</span></a>').addClass("tagit-close").append(d).click(function(){e.removeTag(f)}),
13
- f.append(d));this.options.singleField||(g=g.html(),f.append('<input type="hidden" style="display:none;" value="'+g+'" name="'+this.options.fieldName+'" />'));!1!==this._trigger("beforeTagAdded",null,{tag:f,tagLabel:this.tagLabel(f),duringInitialization:c})&&(this.options.singleField&&(g=this.assignedTags(),g.push(a),this._updateSingleTagsField(g)),this._trigger("onTagAdded",null,f),this.tagInput.val(""),this.tagInput.parent().before(f),this._trigger("afterTagAdded",null,{tag:f,tagLabel:this.tagLabel(f),
14
- duringInitialization:c}),this.options.showAutocompleteOnFocus&&!c&&setTimeout(function(){e._showAutocomplete()},0))},removeTag:function(a,d){d="undefined"===typeof d?this.options.animate:d;a=b(a);this._trigger("onTagRemoved",null,a);if(!1!==this._trigger("beforeTagRemoved",null,{tag:a,tagLabel:this.tagLabel(a)})){if(this.options.singleField){var c=this.assignedTags(),e=this.tagLabel(a),c=b.grep(c,function(a){return a!=e});this._updateSingleTagsField(c)}if(d){a.addClass("removed");var c=this._effectExists("blind")?
15
- ["blind",{direction:"horizontal"},"fast"]:["fast"],g=this;c.push(function(){a.remove();g._trigger("afterTagRemoved",null,{tag:a,tagLabel:g.tagLabel(a)})});a.fadeOut("fast").hide.apply(a,c).dequeue()}else a.remove(),this._trigger("afterTagRemoved",null,{tag:a,tagLabel:this.tagLabel(a)})}},removeTagByLabel:function(a,b){var c=this._findTagByLabel(a);if(!c)throw"No such tag exists with the name '"+a+"'";this.removeTag(c,b)},removeAll:function(){var a=this;this._tags().each(function(b,c){a.removeTag(c,
16
- !1)})}})})(jQuery);
1
+ (function($){$.widget('ui.tagit',{options:{allowDuplicates:false,caseSensitive:true,fieldName:'tags',placeholderText:null,readOnly:false,removeConfirmation:false,tagLimit:null,availableTags:[],autocomplete:{},showAutocompleteOnFocus:false,allowSpaces:false,singleField:false,singleFieldDelimiter:',',singleFieldNode:null,animate:true,tabIndex:null,beforeTagAdded:null,afterTagAdded:null,beforeTagRemoved:null,afterTagRemoved:null,onTagClicked:null,onTagLimitExceeded:null,onTagAdded:null,onTagRemoved:null,tagSource:null},_create:function(){var that=this;if(this.element.is('input')){this.tagList=$('<ul></ul>').insertAfter(this.element);this.options.singleField=true;this.options.singleFieldNode=this.element;this.element.css('display','none')}else{this.tagList=this.element.find('ul, ol').andSelf().last()};this.tagInput=$('<input type="text" />').addClass('ui-widget-content');if(this.options.readOnly)this.tagInput.attr('disabled','disabled');if(this.options.tabIndex){this.tagInput.attr('tabindex',this.options.tabIndex)};if(this.options.placeholderText){this.tagInput.attr('placeholder',this.options.placeholderText)};if(!this.options.autocomplete.source){this.options.autocomplete.source=function(search,showChoices){var filter=search.term.toLowerCase();var choices=$.grep(this.options.availableTags,function(element){return(element.toLowerCase().indexOf(filter)>0)});if(!this.options.allowDuplicates){choices=this._subtractArray(choices,this.assignedTags())};showChoices(choices.reverse())}};if(this.options.showAutocompleteOnFocus){this.tagInput.focus(function(event,ui){that._showAutocomplete()});if(typeof this.options.autocomplete.minLength==='undefined'){this.options.autocomplete.minLength=0}};if($.isFunction(this.options.autocomplete.source)){this.options.autocomplete.source=$.proxy(this.options.autocomplete.source,this)};if($.isFunction(this.options.tagSource)){this.options.tagSource=$.proxy(this.options.tagSource,this)};this.tagList.addClass('tagit').addClass('ui-widget ui-widget-content ui-corner-all').append($('<li class="tagit-new"></li>').append(this.tagInput)).click(function(e){var target=$(e.target);if(target.hasClass('tagit-label')){var tag=target.closest('.tagit-choice');if(!tag.hasClass('removed')){that._trigger('onTagClicked',e,{tag:tag,tagLabel:that.tagLabel(tag)})}}else{that.tagInput.focus()}});var addedExistingFromSingleFieldNode=false;if(this.options.singleField){if(this.options.singleFieldNode){var node=$(this.options.singleFieldNode);var tags=node.val().split(this.options.singleFieldDelimiter);node.val('');$.each(tags,function(index,tag){that.createTag(tag,null,true);addedExistingFromSingleFieldNode=true})}else{this.options.singleFieldNode=$('<input type="hidden" style="display:none;" value="" name="'+this.options.fieldName+'" />');this.tagList.after(this.options.singleFieldNode)}};if(!addedExistingFromSingleFieldNode){this.tagList.children('li').each(function(){if(!$(this).hasClass('tagit-new')){that.createTag($(this).text(),$(this).attr('class'),true);$(this).remove()}})};this.tagInput.keydown(function(event){if(event.which==$.ui.keyCode.BACKSPACE&&that.tagInput.val()===''){var tag=that._lastTag();if(!that.options.removeConfirmation||tag.hasClass('remove')){that.removeTag(tag)}else if(that.options.removeConfirmation){tag.addClass('remove ui-state-highlight')}}else if(that.options.removeConfirmation){that._lastTag().removeClass('remove ui-state-highlight')};if(event.which===$.ui.keyCode.COMMA||event.which===$.ui.keyCode.ENTER||(event.which==$.ui.keyCode.TAB&&that.tagInput.val()!=='')||(event.which==$.ui.keyCode.SPACE&&that.options.allowSpaces!==true&&($.trim(that.tagInput.val()).replace(/^s*/,'').charAt(0)!='"'||($.trim(that.tagInput.val()).charAt(0)=='"'&&$.trim(that.tagInput.val()).charAt($.trim(that.tagInput.val()).length-1)=='"'&&$.trim(that.tagInput.val()).length-1!==0)))){if(!(event.which===$.ui.keyCode.ENTER&&that.tagInput.val()==='')){event.preventDefault()};if(!that.tagInput.data('autocomplete-open')){that.createTag(that._cleanedInput())}}}).blur(function(e){if(!that.tagInput.data('autocomplete-open')){that.createTag(that._cleanedInput())}});if(this.options.availableTags||this.options.tagSource||this.options.autocomplete.source){var autocompleteOptions={select:function(event,ui){that.createTag(ui.item.value);return false}};$.extend(autocompleteOptions,this.options.autocomplete);autocompleteOptions.source=this.options.tagSource||autocompleteOptions.source;this.tagInput.autocomplete(autocompleteOptions).bind('autocompleteopen',function(event,ui){that.tagInput.data('autocomplete-open',true)}).bind('autocompleteclose',function(event,ui){that.tagInput.data('autocomplete-open',false)})}},_cleanedInput:function(){return $.trim(this.tagInput.val().replace(/^"(.*)"$/,'$1'))},_lastTag:function(){return this.tagList.find('.tagit-choice:last:not(.removed)')},_tags:function(){return this.tagList.find('.tagit-choice:not(.removed)')},assignedTags:function(){var that=this;var tags=[];if(this.options.singleField){tags=$(this.options.singleFieldNode).val().split(this.options.singleFieldDelimiter);if(tags[0]===''){tags=[]}}else{this._tags().each(function(){tags.push(that.tagLabel(this))})};return tags},_updateSingleTagsField:function(tags){$(this.options.singleFieldNode).val(tags.join(this.options.singleFieldDelimiter)).trigger('change')},_subtractArray:function(a1,a2){var result=[];for(var i=0;i<a1.length;i++){if($.inArray(a1[i],a2)==-1){result.push(a1[i])}};return result},tagLabel:function(tag){if(this.options.singleField){return $(tag).find('.tagit-label:first').text()}else{return $(tag).find('input:first').val()}},_showAutocomplete:function(){this.tagInput.autocomplete('search','')},_findTagByLabel:function(name){var that=this;var tag=null;this._tags().each(function(i){if(that._formatStr(name)==that._formatStr(that.tagLabel(this))){tag=$(this);return false}});return tag},_isNew:function(name){return!this._findTagByLabel(name)},_formatStr:function(str){if(this.options.caseSensitive){return str};return $.trim(str.toLowerCase())},_effectExists:function(name){return Boolean($.effects&&($.effects[name]||($.effects.effect&&$.effects.effect[name])))},createTag:function(value,additionalClass,duringInitialization){var that=this;value=$.trim(value);if(this.options.preprocessTag){value=this.options.preprocessTag(value)};if(value===''){return false};if(!this.options.allowDuplicates&&!this._isNew(value)){var existingTag=this._findTagByLabel(value);if(this._trigger('onTagExists',null,{existingTag:existingTag,duringInitialization:duringInitialization})!==false){if(this._effectExists('highlight')){existingTag.effect('highlight')}};return false};if(this.options.tagLimit&&this._tags().length>=this.options.tagLimit){this._trigger('onTagLimitExceeded',null,{duringInitialization:duringInitialization});return false};var label=$(this.options.onTagClicked?'<a class="tagit-label"></a>':'<span class="tagit-label"></span>').text(value);var tag=$('<li></li>').addClass('tagit-choice ui-widget-content ui-state-default ui-corner-all').addClass(additionalClass).append(label);if(this.options.readOnly){tag.addClass('tagit-choice-read-only')}else{tag.addClass('tagit-choice-editable');var removeTagIcon=$('<span></span>').addClass('ui-icon ui-icon-close');var removeTag=$('<a><span class="text-icon">\xd7</span></a>').addClass('tagit-close').append(removeTagIcon).click(function(e){that.removeTag(tag)});tag.append(removeTag)};if(!this.options.singleField){var escapedValue=label.html();tag.append('<input type="hidden" style="display:none;" value="'+escapedValue+'" name="'+this.options.fieldName+'" />')};if(this._trigger('beforeTagAdded',null,{tag:tag,tagLabel:this.tagLabel(tag),duringInitialization:duringInitialization})===false){return};if(this.options.singleField){var tags=this.assignedTags();tags.push(value);this._updateSingleTagsField(tags)};this._trigger('onTagAdded',null,tag);this.tagInput.val('');this.tagInput.parent().before(tag);this._trigger('afterTagAdded',null,{tag:tag,tagLabel:this.tagLabel(tag),duringInitialization:duringInitialization});if(this.options.showAutocompleteOnFocus&&!duringInitialization){setTimeout(function(){that._showAutocomplete()},0)}},removeTag:function(tag,animate){animate=typeof animate==='undefined'?this.options.animate:animate;tag=$(tag);this._trigger('onTagRemoved',null,tag);if(this._trigger('beforeTagRemoved',null,{tag:tag,tagLabel:this.tagLabel(tag)})===false){return};if(this.options.singleField){var tags=this.assignedTags();var removedTagLabel=this.tagLabel(tag);tags=$.grep(tags,function(el){return el!=removedTagLabel});this._updateSingleTagsField(tags)};if(animate){tag.addClass('removed');var hide_args=this._effectExists('blind')?['blind',{direction:'horizontal'},'fast']:['fast'];var thisTag=this;hide_args.push(function(){tag.remove();thisTag._trigger('afterTagRemoved',null,{tag:tag,tagLabel:thisTag.tagLabel(tag)})});tag.fadeOut('fast').hide.apply(tag,hide_args).dequeue()}else{tag.remove();this._trigger('afterTagRemoved',null,{tag:tag,tagLabel:this.tagLabel(tag)})}},removeTagByLabel:function(tagLabel,animate){var toRemove=this._findTagByLabel(tagLabel);if(!toRemove){throw"No such tag exists with the name '"+tagLabel+"'"};this.removeTag(toRemove,animate)},removeAll:function(){var that=this;this._tags().each(function(index,tag){that.removeTag(tag,false)})}})})(jQuery);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-23 00:00:00.000000000 Z
12
+ date: 2013-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jquery-ui-rails
@@ -46,6 +46,7 @@ files:
46
46
  - smart_tag.gemspec
47
47
  - vendor/assets/javascripts/smart_tag/smart_tag.js
48
48
  - vendor/assets/javascripts/smart_tag/smart_tag.min.js
49
+ - vendor/assets/javascripts/smart_tag/tag-it.js
49
50
  - vendor/assets/javascripts/smart_tag/tag-it.min.js
50
51
  - vendor/assets/stylesheets/smart_tag/jquery.tagit.css
51
52
  homepage: https://github.com/tuliang/smart_tag