tagmanager-rails 0.0.2 → 3.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f998760c26811f00fd14c8a0d77d474dc1e6e5e
4
- data.tar.gz: 663fbab4bc681dd17f29648f3d6c5b2f7bfc92e0
3
+ metadata.gz: 2b945c5c52aafe56b431eebd84e91c74a98747e0
4
+ data.tar.gz: 9324bc64c8b3aa04f5252c55752f07198ffad0ce
5
5
  SHA512:
6
- metadata.gz: 54e9299eb4e31417d53101dc926b1032858e1bc00fd14482d8ae639a16be08c0463c5cd4fc9fd1b62baad750e8d975db915e99b9d89799351bf7fc7b464a96db
7
- data.tar.gz: 98196d4eebec118009777f3d8857e1adbd4986ceaa9d7da8f475fed6548159a214cadbfc319a9fbc5c87e4a5147d25c7633293df8068b8cba08e10d213120685
6
+ metadata.gz: 65e55f88bb1a6d51e9d402a53fcc02b556b6c3ae7260286d0b925b7f051955b7031c68276508a3171e4154f0946295917f40df99562829756b53497ea5314781
7
+ data.tar.gz: 7d02f27e274c918212359f2b02d88402016036abe55d4caa25c2a9814ca4cbdc8a8eb000a36323b339837b5e305d36235cb638a7539523fd3ccb5a0356cfac96
data/README.md CHANGED
@@ -10,8 +10,8 @@ It includes the CSS; SCSS and LESS version of the stylesheet.
10
10
 
11
11
  ## Version
12
12
 
13
- Tag Manager version 2.4.2
14
- [8d91c8683546409ab9ec459456f12afa1a0a870f](https://github.com/max-favilli/tagmanager/commit/8d91c8683546409ab9ec459456f12afa1a0a870f)
13
+ Tag Manager version 3.0.0
14
+ [3088482a18c776ed55ff685abedfed28d476b807](https://github.com/max-favilli/tagmanager/commit/3088482a18c776ed55ff685abedfed28d476b807)
15
15
 
16
16
  ## Installation
17
17
 
@@ -1,6 +1,6 @@
1
1
  module TagManager
2
2
  module Rails
3
- VERSION = '0.0.2'
4
- TAGMANAGER_VERSION = '8d91c8683546409ab9ec459456f12afa1a0a870f'
3
+ VERSION = '3.0.0'
4
+ TAGMANAGER_VERSION = '3088482a18c776ed55ff685abedfed28d476b807'
5
5
  end
6
6
  end
@@ -1,5 +1,5 @@
1
1
  /* ===================================================
2
- * bootstrap-tagmanager.js v2.4.2
2
+ * tagmanager.js v3.0.0
3
3
  * http://welldonethings.com/tags/manager
4
4
  * ===================================================
5
5
  * Copyright 2012 Max Favilli
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  * ========================================================== */
17
17
 
18
- (function($){
18
+ (function ($) {
19
19
 
20
20
  "use strict";
21
21
 
@@ -24,72 +24,69 @@
24
24
  console.log = function () { };
25
25
  }
26
26
 
27
- $.fn.tagsManager = function (options,tagToManipulate) {
27
+ $.fn.tagsManager = function (options, tagToManipulate) {
28
+ var obj = this;
29
+ var rndid = "";
30
+
28
31
  var tagManagerOptions = {
29
32
  prefilled: null,
30
33
  CapitalizeFirstLetter: false,
31
34
  preventSubmitOnEnter: true, // deprecated
32
35
  isClearInputOnEsc: true, // deprecated
33
- typeahead: false,
34
- typeaheadAjaxMethod: "POST",
35
- typeaheadAjaxSource: null,
36
- typeaheadAjaxPolling: false,
37
- typeaheadOverrides: null,
38
- typeaheadDelegate: {},
39
- typeaheadSource: null,
40
36
  AjaxPush: null,
41
37
  AjaxPushAllTags: null,
42
38
  AjaxPushParameters: null,
43
- delimiters: [9,13,44], // tab, enter, comma
39
+ delimiters: [9, 13, 44], // tab, enter, comma
44
40
  backspace: [8],
45
41
  maxTags: 0,
46
- hiddenTagListName: null,
47
- hiddenTagListId: null,
42
+ hiddenTagListName: null, // deprecated
43
+ hiddenTagListId: null, // deprecated
44
+ replace: true,
45
+ output: null,
48
46
  deleteTagsOnBackspace: true, // deprecated
49
47
  tagsContainer: null,
50
- tagCloseIcon: '×',
48
+ tagCloseIcon: 'x',
51
49
  tagClass: '',
52
50
  validator: null,
53
51
  onlyTagList: false
54
52
  };
55
53
 
56
- var TypeaheadOverrides = (function () {
57
- function TypeaheadOverrides() {
58
- this.instanceSelectHandler = null;
59
- this.selectedClass = "selected";
60
- this.select = null;
61
- if ("typeahead" in $.fn) {
62
- this.instanceSelectHandler = $.fn.typeahead.Constructor.prototype.select;
63
- this.select = function (overrides) {
64
- this.$menu.find(".active").addClass(overrides.selectedClass);
65
- overrides.instanceSelectHandler.apply(this, arguments);
66
- };
67
- }
68
- }
69
- return TypeaheadOverrides;
70
- })();
71
-
72
54
  // exit when no matched elements
73
55
  if (!(0 in this)) {
74
56
  return this;
75
57
  }
76
58
 
77
- tagManagerOptions.typeaheadOverrides = new TypeaheadOverrides();
59
+ if (typeof options == 'string') {
60
+ tagManagerOptions = obj.data("tm_options");
61
+ } else {
62
+ $.extend(tagManagerOptions, options);
63
+ obj.data("tm_options", tagManagerOptions);
64
+ }
78
65
 
79
- $.extend(tagManagerOptions, options);
66
+ if (typeof options == 'string') {
67
+ rndid = obj.data("tm_rndid");
68
+ } else {
69
+ var albet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
70
+ for (var i = 0; i < 5; i++)
71
+ rndid += albet.charAt(Math.floor(Math.random() * albet.length));
72
+ obj.data("tm_rndid", rndid);
73
+ }
80
74
 
75
+ if (tagManagerOptions.replace === true && tagManagerOptions.hiddenTagListName === null) {
76
+ var original_name = obj.attr('name');
77
+ tagManagerOptions.hiddenTagListName = original_name;
78
+ obj.attr('name', "display-" + rndid);
79
+ }
81
80
  if (tagManagerOptions.hiddenTagListName === null) {
82
- tagManagerOptions.hiddenTagListName = "hidden-" + this.attr('name');
81
+ tagManagerOptions.hiddenTagListName = "hidden-" + rndid;
83
82
  }
84
83
 
85
- var obj = this;
86
- var objName = obj.attr('name').replace(/[^\w]/g, '_');
87
84
  var delimiters = tagManagerOptions.delimeters || tagManagerOptions.delimiters; // 'delimeter' is deprecated
88
85
  // delimiter values to be handled as key codes
89
- var keyNums = [9,13,17,18,19,37,38,39,40];
86
+ var keyNums = [9, 13, 17, 18, 19, 37, 38, 39, 40];
90
87
  var delimiterChars = [], delimiterKeys = [];
91
- $.each(delimiters, function(i,v){
92
- if ( $.inArray(v, keyNums) != -1 ){
88
+ $.each(delimiters, function (i, v) {
89
+ if ($.inArray(v, keyNums) != -1) {
93
90
  delimiterKeys.push(v);
94
91
  } else {
95
92
  delimiterChars.push(v);
@@ -102,107 +99,29 @@
102
99
 
103
100
  if ($.isFunction(tagManagerOptions.validator)) obj.data('validator', tagManagerOptions.validator);
104
101
 
105
- var setupTypeahead = function () {
106
- if (!obj.typeahead) return;
107
-
108
- var taOpts = tagManagerOptions.typeaheadDelegate;
109
-
110
- if (tagManagerOptions.typeaheadSource != null && $.isFunction(tagManagerOptions.typeaheadSource)) {
111
- $.extend(taOpts, { source: tagManagerOptions.typeaheadSource });
112
- obj.typeahead(taOpts);
113
- } else if (tagManagerOptions.typeaheadSource != null) {
114
- obj.typeahead(taOpts);
115
- setTypeaheadSource(tagManagerOptions.typeaheadSource);
116
- } else if (tagManagerOptions.typeaheadAjaxSource != null) {
117
- if (!tagManagerOptions.typeaheadAjaxPolling) {
118
- obj.typeahead(taOpts);
119
-
120
- if (typeof (tagManagerOptions.typeaheadAjaxSource) == "string") {
121
- $.ajax({
122
- cache: false,
123
- type: tagManagerOptions.typeaheadAjaxMethod,
124
- contentType: "application/json",
125
- dataType: "json",
126
- url: tagManagerOptions.typeaheadAjaxSource,
127
- data: JSON.stringify({ typeahead: "" }),
128
- success: function (data) { onTypeaheadAjaxSuccess(data, true); }
129
- });
130
- }
131
- } else if (tagManagerOptions.typeaheadAjaxPolling) {
132
- $.extend(taOpts, { source: ajaxPolling });
133
- obj.typeahead(taOpts);
134
- }
135
- }
136
102
 
137
- var data = obj.data('typeahead');
138
- if (data) {
139
- // set the overrided handler
140
- data.select = $.proxy(tagManagerOptions.typeaheadOverrides.select,
141
- obj.data('typeahead'),
142
- tagManagerOptions.typeaheadOverrides);
143
- }
144
- };
103
+ //var ajaxPolling = function (query, process) {
104
+ // if (typeof (tagManagerOptions.typeaheadAjaxSource) == "string") {
105
+ // $.ajax({
106
+ // cache: false,
107
+ // type: "POST",
108
+ // contentType: "application/json",
109
+ // dataType: "json",
110
+ // url: tagManagerOptions.typeaheadAjaxSource,
111
+ // data: JSON.stringify({ typeahead: query }),
112
+ // success: function (data) { onTypeaheadAjaxSuccess(data, false, process); }
113
+ // });
114
+ // }
115
+ //};
145
116
 
146
- var onTypeaheadAjaxSuccess = function(data, isSetTypeaheadSource, process) {
147
- // format data if it is an asp.net 3.5 response
148
- if ("d" in data) {
149
- data = data.d;
150
- }
151
-
152
- if (data && data.tags) {
153
- var sourceAjaxArray = [];
154
- sourceAjaxArray.length = 0;
155
- $.each(data.tags, function (key, val) {
156
- sourceAjaxArray.push(val.tag);
157
- if (isSetTypeaheadSource) {
158
- setTypeaheadSource(sourceAjaxArray);
159
- }
160
- });
161
-
162
- if ($.isFunction(process)) {
163
- process(sourceAjaxArray);
164
- }
165
- }
166
- };
167
-
168
- var setTypeaheadSource = function (source) {
169
- obj.data('active', true);
170
- obj.data('typeahead').source = source;
171
- tagManagerOptions.typeaheadSource = source;
172
- obj.data('active', false);
173
- };
174
-
175
- var typeaheadSelectedItem = function () {
176
- var listItemSelector = '.' + tagManagerOptions.typeaheadOverrides.selectedClass;
177
- var typeahead_data = obj.data('typeahead');
178
- return typeahead_data ? typeahead_data.$menu.find(listItemSelector) : undefined;
179
- };
180
-
181
- var typeaheadVisible = function () {
182
- return $('.typeahead:visible')[0];
183
- };
184
-
185
- var ajaxPolling = function (query, process) {
186
- if (typeof (tagManagerOptions.typeaheadAjaxSource) == "string") {
187
- $.ajax({
188
- cache: false,
189
- type: "POST",
190
- contentType: "application/json",
191
- dataType: "json",
192
- url: tagManagerOptions.typeaheadAjaxSource,
193
- data: JSON.stringify({ typeahead: query }),
194
- success: function (data) { onTypeaheadAjaxSuccess(data, false, process); }
195
- });
196
- }
197
- };
198
117
 
199
118
  var tagClasses = function () {
200
119
  // 1) default class (tm-tag)
201
120
  var cl = tagBaseClass;
202
121
  // 2) interpolate from input class: tm-input-xxx --> tm-tag-xxx
203
122
  if (obj.attr('class')) {
204
- $.each(obj.attr('class').split(' '), function(index, value) {
205
- if (value.indexOf(inputBaseClass+'-') != -1){
123
+ $.each(obj.attr('class').split(' '), function (index, value) {
124
+ if (value.indexOf(inputBaseClass + '-') != -1) {
206
125
  cl += ' ' + tagBaseClass + value.substring(inputBaseClass.length);
207
126
  }
208
127
  });
@@ -222,18 +141,40 @@
222
141
  return tag.substring(0, i);
223
142
  };
224
143
 
144
+ var showOrHide = function () {
145
+ var tlis = obj.data("tlis");
146
+ if (tagManagerOptions.maxTags > 0 && tlis.length < tagManagerOptions.maxTags) {
147
+ obj.show();
148
+ obj.trigger('tm:show');
149
+ }
150
+ if (tagManagerOptions.maxTags > 0 && tlis.length >= tagManagerOptions.maxTags) {
151
+ obj.hide();
152
+ obj.trigger('tm:hide');
153
+ }
154
+ };
155
+
225
156
  var popTag = function () {
226
157
  var tlis = obj.data("tlis");
227
158
  var tlid = obj.data("tlid");
228
159
 
229
160
  if (tlid.length > 0) {
230
161
  var tagId = tlid.pop();
162
+
163
+ var tagBeingRemoved = tlis[tlis.length - 1];
164
+ obj.trigger('tm:popping', tagBeingRemoved);
231
165
  tlis.pop();
166
+
232
167
  // console.log("TagIdToRemove: " + tagId);
233
- $("#" + objName + "_" + tagId).remove();
168
+ $("#" + rndid + "_" + tagId).remove();
234
169
  refreshHiddenTagList();
170
+ obj.trigger('tm:popped', tagBeingRemoved);
235
171
  // console.log(tlis);
236
172
  }
173
+
174
+ showOrHide();
175
+ //if (tagManagerOptions.maxTags > 0 && tlis.length < tagManagerOptions.maxTags) {
176
+ // obj.show();
177
+ //}
237
178
  };
238
179
 
239
180
  var empty = function () {
@@ -244,21 +185,27 @@
244
185
  var tagId = tlid.pop();
245
186
  tlis.pop();
246
187
  // console.log("TagIdToRemove: " + tagId);
247
- $("#" + objName + "_" + tagId).remove();
188
+ $("#" + rndid + "_" + tagId).remove();
248
189
  refreshHiddenTagList();
249
190
  // console.log(tlis);
250
191
  }
192
+ obj.trigger('tm:emptied', null);
193
+
194
+ showOrHide();
195
+ //if (tagManagerOptions.maxTags > 0 && tlis.length < tagManagerOptions.maxTags) {
196
+ // obj.show();
197
+ //}
251
198
  };
252
199
 
253
200
  var refreshHiddenTagList = function () {
254
201
  var tlis = obj.data("tlis");
255
202
  var lhiddenTagList = obj.data("lhiddenTagList");
256
203
 
257
- obj.trigger('tags:refresh', tlis.join(baseDelimiter));
258
-
259
204
  if (lhiddenTagList) {
260
205
  $(lhiddenTagList).val(tlis.join(baseDelimiter)).change();
261
206
  }
207
+
208
+ obj.trigger('tm:refresh', tlis.join(baseDelimiter));
262
209
  };
263
210
 
264
211
  var spliceTag = function (tagId) {
@@ -271,38 +218,41 @@
271
218
  // console.log("position: " + p);
272
219
 
273
220
  if (-1 != p) {
274
- $("#" + objName + "_" + tagId).remove();
221
+ var tagBeingRemoved = tlis[p];
222
+
223
+ obj.trigger('tm:splicing', tagBeingRemoved);
224
+
225
+ $("#" + rndid + "_" + tagId).remove();
275
226
  tlis.splice(p, 1);
276
227
  tlid.splice(p, 1);
277
228
  refreshHiddenTagList();
229
+
230
+ obj.trigger('tm:spliced', tagBeingRemoved);
231
+
278
232
  // console.log(tlis);
279
233
  }
280
234
 
281
- if (tagManagerOptions.maxTags > 0 && tlis.length < tagManagerOptions.maxTags) {
282
- obj.show();
283
- }
235
+
236
+ showOrHide();
237
+ //if (tagManagerOptions.maxTags > 0 && tlis.length < tagManagerOptions.maxTags) {
238
+ // obj.show();
239
+ //}
284
240
  };
285
241
 
286
- var pushAllTags = function (e, tagstring) {
242
+ var pushAllTags = function (e, tag) {
287
243
  if (tagManagerOptions.AjaxPushAllTags) {
288
- $.post(tagManagerOptions.AjaxPush, { tags: tagstring });
244
+ if (e.type != 'tm:pushed' || $.inArray(tag, tagManagerOptions.prefilled) == -1) {
245
+ var tlis = obj.data("tlis");
246
+ $.post(tagManagerOptions.AjaxPush, { tags: tlis.join(baseDelimiter) });
247
+ }
289
248
  }
290
249
  };
291
250
 
292
- var pushTag = function (tag) {
251
+ var pushTag = function (tag, ignore_events) {
293
252
  tag = trimTag(tag);
294
253
 
295
254
  if (!tag || tag.length <= 0) return;
296
255
 
297
- if (tagManagerOptions.typeaheadSource != null)
298
- {
299
- var source = $.isFunction(tagManagerOptions.typeaheadSource) ?
300
- tagManagerOptions.typeaheadSource() : tagManagerOptions.typeaheadSource;
301
-
302
- if(tagManagerOptions.onlyTagList &&
303
- $.inArray(tag, source) == -1) return;
304
- }
305
-
306
256
  if (tagManagerOptions.CapitalizeFirstLetter && tag.length > 1) {
307
257
  tag = tag.charAt(0).toUpperCase() + tag.slice(1).toLowerCase();
308
258
  }
@@ -317,7 +267,7 @@
317
267
  if (tagManagerOptions.maxTags > 0 && tlis.length >= tagManagerOptions.maxTags) return;
318
268
 
319
269
  var alreadyInList = false;
320
- var tlisLowerCase = tlis.map(function(elem) { return elem.toLowerCase(); });
270
+ var tlisLowerCase = tlis.map(function (elem) { return elem.toLowerCase(); });
321
271
  var p = $.inArray(tag.toLowerCase(), tlisLowerCase);
322
272
  if (-1 != p) {
323
273
  // console.log("tag:" + tag + " !!already in list!!");
@@ -326,7 +276,7 @@
326
276
 
327
277
  if (alreadyInList) {
328
278
  var pTagId = tlid[p];
329
- $("#" + objName + "_" + pTagId).stop()
279
+ $("#" + rndid + "_" + pTagId).stop()
330
280
  .animate({ backgroundColor: tagManagerOptions.blinkBGColor_1 }, 100)
331
281
  .animate({ backgroundColor: tagManagerOptions.blinkBGColor_2 }, 100)
332
282
  .animate({ backgroundColor: tagManagerOptions.blinkBGColor_1 }, 100)
@@ -334,6 +284,9 @@
334
284
  .animate({ backgroundColor: tagManagerOptions.blinkBGColor_1 }, 100)
335
285
  .animate({ backgroundColor: tagManagerOptions.blinkBGColor_2 }, 100);
336
286
  } else {
287
+ if(!ignore_events)
288
+ obj.trigger('tm:pushing', tag);
289
+
337
290
  var max = Math.max.apply(null, tlid);
338
291
  max = max == -Infinity ? 0 : max;
339
292
 
@@ -341,14 +294,17 @@
341
294
  tlis.push(tag);
342
295
  tlid.push(tagId);
343
296
 
344
- if (tagManagerOptions.AjaxPush != null) {
345
- $.post(tagManagerOptions.AjaxPush, $.extend({ tag: tag }, tagManagerOptions.AjaxPushParameters));
346
- }
297
+ if (!ignore_events)
298
+ if (tagManagerOptions.AjaxPush != null) {
299
+ if ($.inArray(tag, tagManagerOptions.prefilled) == -1) {
300
+ $.post(tagManagerOptions.AjaxPush, $.extend({ tag: tag }, tagManagerOptions.AjaxPushParameters));
301
+ }
302
+ }
347
303
 
348
304
  // console.log("tagList: " + tlis);
349
305
 
350
- var newTagId = objName + '_' + tagId;
351
- var newTagRemoveId = objName + '_Remover_' + tagId;
306
+ var newTagId = rndid + '_' + tagId;
307
+ var newTagRemoveId = rndid + '_Remover_' + tagId;
352
308
  var escaped = $("<span></span>").text(tag).html();
353
309
 
354
310
  var html = '<span class="' + tagClasses() + '" id="' + newTagId + '">';
@@ -360,7 +316,13 @@
360
316
  if (tagManagerOptions.tagsContainer != null) {
361
317
  $(tagManagerOptions.tagsContainer).append($el);
362
318
  } else {
363
- obj.before($el);
319
+ if (tagId > 1) {
320
+ var lastTagId = tagId - 1;
321
+ var lastTagObj = $("#" + rndid + "_" + lastTagId);
322
+ lastTagObj.after($el);
323
+ } else {
324
+ obj.before($el);
325
+ }
364
326
  }
365
327
 
366
328
  $el.find("#" + newTagRemoveId).on("click", obj, function (e) {
@@ -371,16 +333,20 @@
371
333
 
372
334
  refreshHiddenTagList();
373
335
 
374
- if (tagManagerOptions.maxTags > 0 && tlis.length >= tagManagerOptions.maxTags) {
375
- obj.hide();
376
- }
336
+ if (!ignore_events)
337
+ obj.trigger('tm:pushed', tag);
338
+
339
+ showOrHide();
340
+ //if (tagManagerOptions.maxTags > 0 && tlis.length >= tagManagerOptions.maxTags) {
341
+ // obj.hide();
342
+ //}
377
343
  }
378
344
  obj.val("");
379
345
  };
380
346
 
381
347
  var prefill = function (pta) {
382
348
  $.each(pta, function (key, val) {
383
- pushTag(val);
349
+ pushTag(val,true);
384
350
  });
385
351
  };
386
352
 
@@ -396,15 +362,12 @@
396
362
  };
397
363
 
398
364
  var applyDelimiter = function (e) {
399
- var taItem = typeaheadSelectedItem();
400
- var taVisible = typeaheadVisible();
401
- if (!(e.which==13 && taItem && taVisible)) {
402
- pushTag(obj.val());
403
- }
365
+ pushTag(obj.val());
404
366
  e.preventDefault();
405
367
  };
406
368
 
407
- return this.each(function () {
369
+ var returnValue = null;
370
+ this.each(function () {
408
371
 
409
372
  if (typeof options == 'string') {
410
373
  switch (options) {
@@ -417,12 +380,15 @@
417
380
  case "pushTag":
418
381
  pushTag(tagToManipulate);
419
382
  break;
383
+ case "tags":
384
+ returnValue = { tags: obj.data("tlis") };
385
+ break;
420
386
  }
421
387
  return;
422
388
  }
423
389
 
424
390
  // prevent double-initialization of TagManager
425
- if ($(this).data('tagManager')){ return false; }
391
+ if ($(this).data('tagManager')) { return false; }
426
392
  $(this).data('tagManager', true);
427
393
 
428
394
  // store instance-specific data in the DOM object
@@ -431,28 +397,21 @@
431
397
  obj.data("tlis", tlis); //list of string tags
432
398
  obj.data("tlid", tlid); //list of ID of the string tags
433
399
 
434
- if (tagManagerOptions.hiddenTagListId == null) { /* if hidden input not given default activity */
435
- var hiddenTag = $("input[name='" + tagManagerOptions.hiddenTagListName + "']");
436
- if (hiddenTag.length > 0) {
437
- hiddenTag.remove();
438
- }
439
-
440
- var html = "";
441
- html += "<input name='" + tagManagerOptions.hiddenTagListName + "' type='hidden' value=''/>";
442
- obj.after(html);
443
- obj.data("lhiddenTagList",
444
- obj.siblings("input[name='" + tagManagerOptions.hiddenTagListName + "']")[0]
445
- );
400
+ if (tagManagerOptions.output == null) {
401
+ var hiddenObj = jQuery('<input/>', {
402
+ type: 'hidden',
403
+ name: tagManagerOptions.hiddenTagListName
404
+ });
405
+ obj.after(hiddenObj);
406
+ obj.data("lhiddenTagList", hiddenObj);
446
407
  } else {
447
- obj.data("lhiddenTagList", $('#' + tagManagerOptions.hiddenTagListId))
448
- }
449
-
450
- if (tagManagerOptions.typeahead) {
451
- setupTypeahead();
408
+ obj.data("lhiddenTagList", jQuery(tagManagerOptions.output))
452
409
  }
453
410
 
454
411
  if (tagManagerOptions.AjaxPushAllTags) {
455
- obj.on('tags:refresh', pushAllTags);
412
+ obj.on('tm:spliced', pushAllTags);
413
+ obj.on('tm:popped', pushAllTags);
414
+ obj.on('tm:pushed', pushAllTags);
456
415
  }
457
416
 
458
417
  // hide popovers on focus and keypress events
@@ -511,14 +470,6 @@
511
470
 
512
471
  if (!/webkit/.test(navigator.userAgent.toLowerCase())) { $(this).focus(); } // why?
513
472
 
514
- var taItem = typeaheadSelectedItem();
515
- var taVisible = typeaheadVisible();
516
-
517
- if (taItem && taVisible) {
518
- taItem.removeClass(tagManagerOptions.typeaheadOverrides.selectedClass);
519
- pushTag(taItem.attr('data-value'));
520
- // console.log('change: pushTypeAheadTag ' + tag);
521
- }
522
473
  /* unimplemented mode to push tag on blur
523
474
  else if (tagManagerOptions.pushTagOnBlur) {
524
475
  console.log('change: pushTagOnBlur ' + tag);
@@ -535,9 +486,16 @@
535
486
  } else if (typeof (tagManagerOptions.prefilled) == "function") {
536
487
  prefill(tagManagerOptions.prefilled());
537
488
  }
538
- } else if (tagManagerOptions.hiddenTagListId != null) {
539
- prefill($('#' + tagManagerOptions.hiddenTagListId).val().split(baseDelimiter));
489
+ } else if (tagManagerOptions.output != null) {
490
+ if (jQuery(tagManagerOptions.output) && jQuery(tagManagerOptions.output).val())
491
+ var existing_tags = jQuery(tagManagerOptions.output)
492
+ prefill(jQuery(tagManagerOptions.output).val().split(baseDelimiter));
540
493
  }
541
494
  });
495
+
496
+ if (!returnValue)
497
+ returnValue = this;
498
+
499
+ return returnValue;
542
500
  }
543
501
  })(jQuery);
@@ -92,6 +92,7 @@
92
92
  }
93
93
  input[type="text"].tm-input {
94
94
  margin-bottom: 5px;
95
+ vertical-align: middle !important;
95
96
  }
96
97
  .control-group.tm-group {
97
98
  margin-bottom: 5px;
@@ -78,7 +78,7 @@
78
78
  font-weight: bold;
79
79
  margin-left: @tagPadding;
80
80
  opacity: 0.2;
81
- &:hover {
81
+ &:hover {
82
82
  color: @black;
83
83
  text-decoration: none;
84
84
  opacity: 0.4;
@@ -78,7 +78,7 @@ $tagMargin: 5px;
78
78
  font-weight: bold;
79
79
  margin-left: $tagPadding;
80
80
  opacity: 0.2;
81
- &:hover {
81
+ &:hover {
82
82
  color: $black;
83
83
  text-decoration: none;
84
84
  opacity: 0.4;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tagmanager-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias L. Maier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-21 00:00:00.000000000 Z
11
+ date: 2013-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -41,11 +41,11 @@ files:
41
41
  - lib/tag_manager/rails/version.rb
42
42
  - lib/tag_manager/rails.rb
43
43
  - lib/tagmanager-rails.rb
44
- - vendor/assets/javascripts/bootstrap-tagmanager.js
44
+ - vendor/assets/javascripts/tagmanager.js
45
45
  - vendor/assets/LICENSE
46
- - vendor/assets/stylesheets/bootstrap-tagmanager.css
47
- - vendor/assets/stylesheets/bootstrap-tagmanager.css.less
48
- - vendor/assets/stylesheets/bootstrap-tagmanager.css.scss
46
+ - vendor/assets/stylesheets/tagmanager.css
47
+ - vendor/assets/stylesheets/tagmanager.css.less
48
+ - vendor/assets/stylesheets/tagmanager.css.scss
49
49
  - LICENSE
50
50
  - Rakefile
51
51
  - README.md