th_simple_content_management 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/simple_content_management/version.rb +1 -1
- data/vendor/assets/javascripts/bootstrap-tagmanager.js +537 -0
- data/vendor/assets/stylesheets/bootstrap-tagmanager.css +107 -0
- metadata +4 -4
- data/app/controllers/simple_content_management/simple_content_sections_controller.rb +0 -9
- data/app/models/simple_content_management/simple_content_section.rb +0 -9
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTg5ZjA0NmM1NjM5NjZkOGY4ZmEzYTYwODQ4ZjVjZmRhYzU1NTFiMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTIyZWE5YmExODNlNjZhMTM4YTNiNmYyZTAzMjJiMTU2ZjAzMWU4NQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmY4YzdiN2IyNWFlY2RkMTY5ODk0NzM2YjVlNmU2Mjg5MDkyZjY5MjVmNzEy
|
10
|
+
Njk3NDBkNmMxMjgyMDYzZGUwMTQ4YmFlNzUyMGYzYWNjN2RkNDdlZjUzYTUz
|
11
|
+
N2RhNmViN2NjNTM4Y2JiMzQyYzFjODI1N2IwMGQ4NWNiZDlhNzM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTM4MzA1NWZkMWVhMGMyMDgzNWUyMmU1MGFiMTZiOGNlNGEwZTgxZjYxMGQ3
|
14
|
+
YmFkZjQ4N2M1MzQ5YzFjNWFjMTc3YTI1ZGU0ZmU1NDNlZjkxMjQ5YTBjOGU2
|
15
|
+
MTFkY2ExMzk5OTQ1MWYxMmIxOGQzYWNjNTY4ODk5ZGY3MzlkNmY=
|
@@ -0,0 +1,537 @@
|
|
1
|
+
/* ===================================================
|
2
|
+
* bootstrap-tagmanager.js v2.2
|
3
|
+
* http://welldonethings.com/tags/manager
|
4
|
+
* ===================================================
|
5
|
+
* Copyright 2012 Max Favilli
|
6
|
+
*
|
7
|
+
* Licensed under the Mozilla Public License, Version 2.0 You may not use this work except in compliance with the License.
|
8
|
+
*
|
9
|
+
* http://www.mozilla.org/MPL/2.0/
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
* ========================================================== */
|
17
|
+
|
18
|
+
// SLIGHTLY MODIFIED BY T HINLOOPEN
|
19
|
+
|
20
|
+
"use strict";
|
21
|
+
|
22
|
+
(function (jQuery) {
|
23
|
+
if (typeof console === "undefined" || typeof console.log === "undefined") {
|
24
|
+
console = {};
|
25
|
+
console.log = function () { };
|
26
|
+
}
|
27
|
+
|
28
|
+
jQuery.fn.tagsManager = function (options,tagToManipulate) {
|
29
|
+
var tagManagerOptions = {
|
30
|
+
prefilled: null,
|
31
|
+
CapitalizeFirstLetter: false,
|
32
|
+
preventSubmitOnEnter: true,
|
33
|
+
isClearInputOnEsc: true,
|
34
|
+
typeahead: false,
|
35
|
+
typeaheadAjaxSource: null,
|
36
|
+
typeaheadAjaxPolling: false,
|
37
|
+
typeaheadOverrides: {
|
38
|
+
instanceSelectHandler: jQuery.fn.typeahead.Constructor.prototype.select,
|
39
|
+
selectedClass: "selected",
|
40
|
+
select: function (overrides) {
|
41
|
+
// settings for the tagmanager instance
|
42
|
+
this.$menu.find(".active").addClass(overrides.selectedClass);
|
43
|
+
|
44
|
+
// call the original handler
|
45
|
+
overrides.instanceSelectHandler.apply(this, arguments);
|
46
|
+
}
|
47
|
+
},
|
48
|
+
typeaheadSource: null,
|
49
|
+
AjaxPush: null,
|
50
|
+
delimeters: [44, 188, 13, 9],
|
51
|
+
backspace: [8],
|
52
|
+
maxTags: 0,
|
53
|
+
hiddenTagListName: null,
|
54
|
+
hiddenTagListId: null,
|
55
|
+
deleteTagsOnBackspace: true,
|
56
|
+
tagsContainer: null,
|
57
|
+
tagCloseIcon: 'x',
|
58
|
+
tagClass: ''
|
59
|
+
};
|
60
|
+
|
61
|
+
jQuery.extend(tagManagerOptions, options);
|
62
|
+
|
63
|
+
if (tagManagerOptions.hiddenTagListName === null) {
|
64
|
+
tagManagerOptions.hiddenTagListName = "hidden-" + this.attr('name');
|
65
|
+
}
|
66
|
+
|
67
|
+
var obj = this;
|
68
|
+
var objName = obj.attr('name').replace(/[^\w]/g, '_');
|
69
|
+
var queuedTag = "";
|
70
|
+
var delimeters = tagManagerOptions.delimeters;
|
71
|
+
var backspace = tagManagerOptions.backspace;
|
72
|
+
var tagIsValid = false;
|
73
|
+
var isSelectedFromList = false;
|
74
|
+
|
75
|
+
var setupTypeahead = function () {
|
76
|
+
if (!obj.typeahead) return;
|
77
|
+
|
78
|
+
if (tagManagerOptions.typeaheadSource != null && jQuery.isFunction(tagManagerOptions.typeaheadSource)) {
|
79
|
+
obj.typeahead({ source: tagManagerOptions.typeaheadSource });
|
80
|
+
} else if (tagManagerOptions.typeaheadSource != null) {
|
81
|
+
obj.typeahead();
|
82
|
+
obj.data('active', true);
|
83
|
+
obj.data('typeahead').source = tagManagerOptions.typeaheadSource;
|
84
|
+
obj.data('active', false);
|
85
|
+
} else if (tagManagerOptions.typeaheadAjaxSource != null) {
|
86
|
+
if (!tagManagerOptions.typeaheadAjaxPolling) {
|
87
|
+
obj.typeahead();
|
88
|
+
jQuery.getJSON(tagManagerOptions.typeaheadAjaxSource, function (data) {
|
89
|
+
var sourceAjaxArray = [];
|
90
|
+
if (data != undefined && data.tags != undefined) {
|
91
|
+
sourceAjaxArray.length = 0;
|
92
|
+
jQuery.each(data.tags, function (key, val) {
|
93
|
+
var a = 1;
|
94
|
+
sourceAjaxArray.push(val.tag);
|
95
|
+
obj.data('active', true);
|
96
|
+
obj.data('typeahead').source = sourceAjaxArray;
|
97
|
+
obj.data('active', false);
|
98
|
+
});
|
99
|
+
}
|
100
|
+
});
|
101
|
+
} else if (tagManagerOptions.typeaheadAjaxPolling) {
|
102
|
+
obj.typeahead({ source: ajaxPolling });
|
103
|
+
}
|
104
|
+
} else if (tagManagerOptions.typeaheadDelegate) {
|
105
|
+
obj.typeahead(tagManagerOptions.typeaheadDelegate);
|
106
|
+
}
|
107
|
+
|
108
|
+
var data = obj.data('typeahead');
|
109
|
+
if (data) {
|
110
|
+
// set the overrided handler
|
111
|
+
data.select = jQuery.proxy(tagManagerOptions.typeaheadOverrides.select,
|
112
|
+
data,
|
113
|
+
tagManagerOptions.typeaheadOverrides);
|
114
|
+
}
|
115
|
+
};
|
116
|
+
|
117
|
+
var ajaxPolling = function (query, process) {
|
118
|
+
jQuery.getJSON(tagManagerOptions.typeaheadAjaxSource, function (data) {
|
119
|
+
var sourceAjaxArray = [];
|
120
|
+
if (data != undefined && data.tags != undefined) {
|
121
|
+
sourceAjaxArray.length = 0;
|
122
|
+
jQuery.each(data.tags, function (key, val) {
|
123
|
+
var a = 1;
|
124
|
+
sourceAjaxArray.push(val.tag);
|
125
|
+
});
|
126
|
+
process(sourceAjaxArray);
|
127
|
+
}
|
128
|
+
});
|
129
|
+
};
|
130
|
+
|
131
|
+
var trimTag = function (tag) {
|
132
|
+
var txt = jQuery.trim(tag);
|
133
|
+
|
134
|
+
var l = txt.length;
|
135
|
+
var t = 0;
|
136
|
+
|
137
|
+
for (var i = l - 1; i >= 0; i--) {
|
138
|
+
if (-1 == jQuery.inArray(txt.charCodeAt(i), delimeters)) break;
|
139
|
+
t++;
|
140
|
+
}
|
141
|
+
|
142
|
+
txt = txt.substring(0, l - t);
|
143
|
+
l = txt.length;
|
144
|
+
t = 0;
|
145
|
+
|
146
|
+
//remove from head
|
147
|
+
for (var i = 0; i < l; i++) {
|
148
|
+
if (-1 == jQuery.inArray(txt.charCodeAt(i), delimeters)) break;
|
149
|
+
t++;
|
150
|
+
}
|
151
|
+
|
152
|
+
txt = txt.substring(t, l);
|
153
|
+
return txt;
|
154
|
+
};
|
155
|
+
|
156
|
+
//$(this).on('popTag', function (e){
|
157
|
+
// var tlis = obj.data("tlis");
|
158
|
+
// var tlid = obj.data("tlid");
|
159
|
+
|
160
|
+
// if (tlid.length > 0) {
|
161
|
+
// var tagId = tlid.pop();
|
162
|
+
// tlis.pop();
|
163
|
+
// // console.log("TagIdToRemove: " + tagId);
|
164
|
+
// jQuery("#" + objName + "_" + tagId).remove();
|
165
|
+
// refreshHiddenTagList();
|
166
|
+
// // console.log(tlis);
|
167
|
+
// }
|
168
|
+
//});
|
169
|
+
|
170
|
+
var popTag = function () {
|
171
|
+
var tlis = obj.data("tlis");
|
172
|
+
var tlid = obj.data("tlid");
|
173
|
+
|
174
|
+
if (tlid.length > 0) {
|
175
|
+
var tagId = tlid.pop();
|
176
|
+
tlis.pop();
|
177
|
+
// console.log("TagIdToRemove: " + tagId);
|
178
|
+
jQuery("#" + objName + "_" + tagId).remove();
|
179
|
+
refreshHiddenTagList();
|
180
|
+
// console.log(tlis);
|
181
|
+
}
|
182
|
+
};
|
183
|
+
|
184
|
+
var empty = function () {
|
185
|
+
var tlis = obj.data("tlis");
|
186
|
+
var tlid = obj.data("tlid");
|
187
|
+
|
188
|
+
while (tlid.length > 0) {
|
189
|
+
var tagId = tlid.pop();
|
190
|
+
tlis.pop();
|
191
|
+
// console.log("TagIdToRemove: " + tagId);
|
192
|
+
jQuery("#" + objName + "_" + tagId).remove();
|
193
|
+
refreshHiddenTagList();
|
194
|
+
// console.log(tlis);
|
195
|
+
}
|
196
|
+
};
|
197
|
+
|
198
|
+
var refreshHiddenTagList = function () {
|
199
|
+
var tlis = obj.data("tlis");
|
200
|
+
var lhiddenTagList = obj.data("lhiddenTagList");
|
201
|
+
|
202
|
+
if (lhiddenTagList == undefined)
|
203
|
+
return;
|
204
|
+
jQuery(lhiddenTagList).val(tlis.join(",")).change();
|
205
|
+
};
|
206
|
+
|
207
|
+
var spliceTag = function (tagId) {
|
208
|
+
var tlis = obj.data("tlis");
|
209
|
+
var tlid = obj.data("tlid");
|
210
|
+
|
211
|
+
var p = jQuery.inArray(tagId, tlid);
|
212
|
+
|
213
|
+
// console.log("TagIdToRemove: " + tagId);
|
214
|
+
// console.log("position: " + p);
|
215
|
+
|
216
|
+
if (-1 != p) {
|
217
|
+
jQuery("#" + objName + "_" + tagId).remove();
|
218
|
+
tlis.splice(p, 1);
|
219
|
+
tlid.splice(p, 1);
|
220
|
+
refreshHiddenTagList();
|
221
|
+
// console.log(tlis);
|
222
|
+
}
|
223
|
+
|
224
|
+
if (tagManagerOptions.maxTags > 0 && tlis.length < tagManagerOptions.maxTags) {
|
225
|
+
obj.show();
|
226
|
+
}
|
227
|
+
};
|
228
|
+
|
229
|
+
var pushTag = function (tag) {
|
230
|
+
if (!tag || (!tagIsValid) || tag.length <= 0) return;
|
231
|
+
|
232
|
+
if (tagManagerOptions.CapitalizeFirstLetter && tag.length > 1) {
|
233
|
+
tag = tag.charAt(0).toUpperCase() + tag.slice(1).toLowerCase();
|
234
|
+
}
|
235
|
+
|
236
|
+
// call the validator (if any) and do not let the tag pass if invalid
|
237
|
+
if (tagManagerOptions.validator !== undefined) {
|
238
|
+
if (tagManagerOptions.validator(tag) !== true) return;
|
239
|
+
}
|
240
|
+
|
241
|
+
var tlis = obj.data("tlis");
|
242
|
+
var tlid = obj.data("tlid");
|
243
|
+
|
244
|
+
// dont accept new tags beyond the defined maximum
|
245
|
+
if (tagManagerOptions.maxTags > 0 && tlis.length >= tagManagerOptions.maxTags) return;
|
246
|
+
|
247
|
+
var alreadyInList = false;
|
248
|
+
var tlisLowerCase = tlis.map(function(elem) { return elem.toLowerCase(); });
|
249
|
+
var p = jQuery.inArray(tag.toLowerCase(), tlisLowerCase);
|
250
|
+
if (-1 != p) {
|
251
|
+
// console.log("tag:" + tag + " !!already in list!!");
|
252
|
+
alreadyInList = true;
|
253
|
+
}
|
254
|
+
|
255
|
+
if (alreadyInList) {
|
256
|
+
var pTagId = tlid[p];
|
257
|
+
jQuery("#" + objName + "_" + pTagId).stop()
|
258
|
+
.animate({ backgroundColor: tagManagerOptions.blinkBGColor_1 }, 100)
|
259
|
+
.animate({ backgroundColor: tagManagerOptions.blinkBGColor_2 }, 100)
|
260
|
+
.animate({ backgroundColor: tagManagerOptions.blinkBGColor_1 }, 100)
|
261
|
+
.animate({ backgroundColor: tagManagerOptions.blinkBGColor_2 }, 100)
|
262
|
+
.animate({ backgroundColor: tagManagerOptions.blinkBGColor_1 }, 100)
|
263
|
+
.animate({ backgroundColor: tagManagerOptions.blinkBGColor_2 }, 100);
|
264
|
+
} else {
|
265
|
+
var max = Math.max.apply(null, tlid);
|
266
|
+
max = max == -Infinity ? 0 : max;
|
267
|
+
|
268
|
+
var tagId = ++max;
|
269
|
+
tlis.push(tag);
|
270
|
+
tlid.push(tagId);
|
271
|
+
|
272
|
+
if (tagManagerOptions.AjaxPush != null) {
|
273
|
+
jQuery.post(tagManagerOptions.AjaxPush, { tag: tag });
|
274
|
+
}
|
275
|
+
|
276
|
+
// console.log("tagList: " + tlis);
|
277
|
+
|
278
|
+
var newTagId = objName + '_' + tagId;
|
279
|
+
var newTagRemoveId = objName + '_Remover_' + tagId;
|
280
|
+
var html = '';
|
281
|
+
var cl = tagManagerOptions.tagClass ? ' '+tagManagerOptions.tagClass : '';
|
282
|
+
html += '<span class="myTag'+cl+'" id="' + newTagId + '"><span>' + tag + '</span> <a href="#" class="myTagRemover" id="' + newTagRemoveId + '" TagIdToRemove="' + tagId + '" title="Remove">' + tagManagerOptions.tagCloseIcon + '</a></span> ';
|
283
|
+
|
284
|
+
if (tagManagerOptions.tagsContainer != null) {
|
285
|
+
jQuery(tagManagerOptions.tagsContainer).append(html);
|
286
|
+
} else {
|
287
|
+
obj.before(html);
|
288
|
+
}
|
289
|
+
|
290
|
+
jQuery("#" + newTagRemoveId).on("click", obj, function (e) {
|
291
|
+
e.preventDefault();
|
292
|
+
var TagIdToRemove = parseInt(jQuery(this).attr("TagIdToRemove"));
|
293
|
+
spliceTag(TagIdToRemove, e.data);
|
294
|
+
});
|
295
|
+
|
296
|
+
refreshHiddenTagList();
|
297
|
+
|
298
|
+
if (tagManagerOptions.maxTags > 0 && tlis.length >= tagManagerOptions.maxTags) {
|
299
|
+
obj.hide();
|
300
|
+
}
|
301
|
+
}
|
302
|
+
obj.val("");
|
303
|
+
};
|
304
|
+
|
305
|
+
return this.each(function () {
|
306
|
+
|
307
|
+
if (typeof options == 'string') {
|
308
|
+
switch (options) {
|
309
|
+
case "empty":
|
310
|
+
empty();
|
311
|
+
break;
|
312
|
+
case "popTag":
|
313
|
+
popTag();
|
314
|
+
break;
|
315
|
+
case "pushTag":
|
316
|
+
pushTag(tagToManipulate);
|
317
|
+
break;
|
318
|
+
}
|
319
|
+
return;
|
320
|
+
}
|
321
|
+
|
322
|
+
//let's store some instance specific data directly into the DOM object
|
323
|
+
var tlis = new Array();
|
324
|
+
var tlid = new Array();
|
325
|
+
obj.data("tlis", tlis); //list of string tags
|
326
|
+
obj.data("tlid", tlid); //list of ID of the string tags
|
327
|
+
|
328
|
+
if (tagManagerOptions.hiddenTagListId == null) { /* if hidden input not given default activity */
|
329
|
+
var html = "";
|
330
|
+
html += "<input name='" + tagManagerOptions.hiddenTagListName + "' type='hidden' value=''/>";
|
331
|
+
obj.after(html);
|
332
|
+
obj.data("lhiddenTagList",
|
333
|
+
obj.siblings("input[name='" + tagManagerOptions.hiddenTagListName + "']")[0]
|
334
|
+
);
|
335
|
+
} else {
|
336
|
+
obj.data("lhiddenTagList", jQuery('#' + tagManagerOptions.hiddenTagListId))
|
337
|
+
}
|
338
|
+
|
339
|
+
if (tagManagerOptions.typeahead) {
|
340
|
+
setupTypeahead();
|
341
|
+
//obj.typeahead({ source: SourceArray })
|
342
|
+
}
|
343
|
+
|
344
|
+
obj.on("focus", function (e) {
|
345
|
+
if (jQuery(this).popover) {
|
346
|
+
jQuery(this).popover("hide");
|
347
|
+
//jQuery(this).popover = null;
|
348
|
+
}
|
349
|
+
});
|
350
|
+
|
351
|
+
// clear input field on Esc
|
352
|
+
if (tagManagerOptions.isClearInputOnEsc) {
|
353
|
+
obj.on("keyup", function (e) {
|
354
|
+
if (e.which == 27) {
|
355
|
+
obj.val("");
|
356
|
+
e.cancelBubble = true;
|
357
|
+
e.returnValue = false;
|
358
|
+
e.stopPropagation();
|
359
|
+
e.preventDefault();
|
360
|
+
}
|
361
|
+
});
|
362
|
+
}
|
363
|
+
|
364
|
+
// disable submit on enter for this input field
|
365
|
+
obj.on("keypress", function (e) {
|
366
|
+
if (jQuery(this).popover) {
|
367
|
+
jQuery(this).popover("hide");
|
368
|
+
//jQuery(this).popover = null;
|
369
|
+
}
|
370
|
+
|
371
|
+
if (tagManagerOptions.preventSubmitOnEnter) {
|
372
|
+
if (e.which == 13) {
|
373
|
+
e.cancelBubble = true;
|
374
|
+
e.returnValue = false;
|
375
|
+
e.stopPropagation();
|
376
|
+
e.preventDefault();
|
377
|
+
//e.keyCode = 9;
|
378
|
+
}
|
379
|
+
}
|
380
|
+
|
381
|
+
var p = jQuery.inArray(e.which, delimeters);
|
382
|
+
if (-1 != p) {
|
383
|
+
//user just entered a valid delimeter
|
384
|
+
tagIsValid = true;
|
385
|
+
var user_input = jQuery(this).val(); //user_input = jQuery().inArray(delimeters[p]);
|
386
|
+
user_input = trimTag(user_input);
|
387
|
+
pushTag(user_input, e.data);
|
388
|
+
e.preventDefault();
|
389
|
+
// console.log("pushTag: keypress");
|
390
|
+
}
|
391
|
+
else {
|
392
|
+
tagIsValid = false;
|
393
|
+
}
|
394
|
+
|
395
|
+
// console.log("keypress: " + e.which);
|
396
|
+
});
|
397
|
+
|
398
|
+
if (tagManagerOptions.deleteTagsOnBackspace) {
|
399
|
+
obj.on("keydown", obj, function (e) {
|
400
|
+
var p = jQuery.inArray(e.which, backspace);
|
401
|
+
if (-1 != p) {
|
402
|
+
//user just entered backspace or equivalent
|
403
|
+
var user_input = jQuery(this).val(); //user_input = jQuery().inArray(delimeters[p]);
|
404
|
+
var i = user_input.length;
|
405
|
+
if (i <= 0) {
|
406
|
+
// console.log("backspace detected");
|
407
|
+
e.preventDefault();
|
408
|
+
popTag();
|
409
|
+
}
|
410
|
+
}
|
411
|
+
});
|
412
|
+
}
|
413
|
+
|
414
|
+
obj.change(function (e) {
|
415
|
+
e.cancelBubble = true;
|
416
|
+
e.returnValue = false;
|
417
|
+
e.stopPropagation();
|
418
|
+
e.preventDefault();
|
419
|
+
|
420
|
+
var selectedItemClass = tagManagerOptions.typeaheadOverrides.selectedClass;
|
421
|
+
var listItemSelector = '.' + selectedItemClass;
|
422
|
+
|
423
|
+
// check the typeahead list selection
|
424
|
+
var data = $(this).data('typeahead');
|
425
|
+
if (data) {
|
426
|
+
isSelectedFromList = $(this).data('typeahead').$menu.find(listItemSelector).hasClass();
|
427
|
+
if (isSelectedFromList) {
|
428
|
+
tagIsValid = true;
|
429
|
+
}
|
430
|
+
}
|
431
|
+
|
432
|
+
if (!tagIsValid) {
|
433
|
+
return;
|
434
|
+
}
|
435
|
+
|
436
|
+
var is_chrome = navigator.userAgent.indexOf('Chrome') > -1;
|
437
|
+
var is_explorer = navigator.userAgent.indexOf('MSIE') > -1;
|
438
|
+
var is_firefox = navigator.userAgent.indexOf('Firefox') > -1;
|
439
|
+
var is_safari = navigator.userAgent.indexOf("Safari") > -1;
|
440
|
+
|
441
|
+
if (!is_chrome && !is_safari)
|
442
|
+
jQuery(this).focus();
|
443
|
+
|
444
|
+
// console.log('Handler for .change() called, value selected:' + obj.val());
|
445
|
+
var ao = jQuery(".typeahead:visible");
|
446
|
+
if (ao[0] != undefined) {
|
447
|
+
// console.log('change: typeaheadIsVisible is visible');
|
448
|
+
//when the user click with the mouse on the typeahead li element we get the change event fired twice, once when the input field loose focus and later with the input field value is replaced with li value
|
449
|
+
|
450
|
+
var isClear = !isSelectedFromList;
|
451
|
+
|
452
|
+
if (isSelectedFromList) {
|
453
|
+
// if user selected from list
|
454
|
+
var user_input = $(this).data('typeahead').$menu.find(listItemSelector).attr('data-value');
|
455
|
+
user_input = trimTag(user_input);
|
456
|
+
if (queuedTag == obj.val() && queuedTag == user_input) {
|
457
|
+
isClear = true;
|
458
|
+
} else {
|
459
|
+
pushTag(user_input);
|
460
|
+
queuedTag = user_input;
|
461
|
+
// console.log('Handler for .change() called, typeahead value pushed:' + queuedTag);
|
462
|
+
}
|
463
|
+
isSelectedFromList = false;
|
464
|
+
$(this).data('typeahead').$menu.find(listItemSelector).removeClass(selectedItemClass);
|
465
|
+
}
|
466
|
+
|
467
|
+
if (isClear) {
|
468
|
+
queuedTag = "";
|
469
|
+
obj.val(queuedTag);
|
470
|
+
}
|
471
|
+
} else {
|
472
|
+
// console.log('change: typeaheadIsVisible is NOT visible');
|
473
|
+
var user_input = jQuery(this).val(); //user_input = jQuery().inArray(delimeters[p]);
|
474
|
+
user_input = trimTag(user_input);
|
475
|
+
pushTag(user_input);
|
476
|
+
// console.log("pushTag: change ");
|
477
|
+
}
|
478
|
+
|
479
|
+
tagIsValid = false;
|
480
|
+
});
|
481
|
+
|
482
|
+
if (1 == 1 || !tagManagerOptions.typeahead) {
|
483
|
+
obj.on("blur", function (e) {
|
484
|
+
//lost focus
|
485
|
+
e.cancelBubble = true;
|
486
|
+
e.returnValue = false;
|
487
|
+
e.stopPropagation();
|
488
|
+
e.preventDefault();
|
489
|
+
|
490
|
+
var push = true;
|
491
|
+
if (tagManagerOptions.typeahead) {
|
492
|
+
var ao = jQuery(".typeahead:visible");
|
493
|
+
if (ao[0] != undefined) {
|
494
|
+
// console.log('blur: typeaheadIsVisible is visible');
|
495
|
+
push = false;
|
496
|
+
} else {
|
497
|
+
// console.log('blur: typeaheadIsVisible is NOT visible');
|
498
|
+
push = true;
|
499
|
+
}
|
500
|
+
}
|
501
|
+
|
502
|
+
if (push) {
|
503
|
+
// console.log('lost focus');
|
504
|
+
var user_input = jQuery(this).val(); //user_input = jQuery().inArray(delimeters[p]);
|
505
|
+
user_input = trimTag(user_input);
|
506
|
+
pushTag(user_input);
|
507
|
+
// console.log("pushTag: blur");
|
508
|
+
}
|
509
|
+
});
|
510
|
+
}
|
511
|
+
|
512
|
+
if (tagManagerOptions.prefilled != null) {
|
513
|
+
var prev_tagIsValid = tagIsValid;
|
514
|
+
tagIsValid = true;
|
515
|
+
|
516
|
+
if (typeof (tagManagerOptions.prefilled) == "object") {
|
517
|
+
var pta = tagManagerOptions.prefilled;
|
518
|
+
jQuery.each(pta, function (key, val) {
|
519
|
+
var a = 1;
|
520
|
+
pushTag(val, obj);
|
521
|
+
});
|
522
|
+
} else if (typeof (tagManagerOptions.prefilled) == "string") {
|
523
|
+
var pta = tagManagerOptions.prefilled.split(',');
|
524
|
+
|
525
|
+
jQuery.each(pta, function (key, val) {
|
526
|
+
var a = 1;
|
527
|
+
pushTag(val, obj);
|
528
|
+
});
|
529
|
+
|
530
|
+
}
|
531
|
+
|
532
|
+
tagIsValid = prev_tagIsValid;
|
533
|
+
}
|
534
|
+
});
|
535
|
+
|
536
|
+
}
|
537
|
+
})(jQuery);
|
@@ -0,0 +1,107 @@
|
|
1
|
+
.myTag
|
2
|
+
{
|
3
|
+
background: none repeat scroll 0 0 #CDE69C;
|
4
|
+
border: 1px solid #A5D24A;
|
5
|
+
border-radius: 3px 3px 3px 3px;
|
6
|
+
color: #638421;
|
7
|
+
|
8
|
+
// to be tested
|
9
|
+
display: block;
|
10
|
+
float: left;
|
11
|
+
//
|
12
|
+
|
13
|
+
font-family: helvetica;
|
14
|
+
font-size: 13px;
|
15
|
+
margin-bottom: 5px;
|
16
|
+
margin-right: 5px;
|
17
|
+
//padding-top: 6px;
|
18
|
+
//padding-bottom: 5px;
|
19
|
+
padding: 6px 5px 5px 5px;
|
20
|
+
text-decoration: none;
|
21
|
+
|
22
|
+
vertical-align: middle;
|
23
|
+
line-height: 18px;
|
24
|
+
height:18px;
|
25
|
+
-moz-transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
|
26
|
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
|
27
|
+
}
|
28
|
+
.myTagError
|
29
|
+
{
|
30
|
+
background-color: #F2DEDE;
|
31
|
+
}
|
32
|
+
.myTagRemover
|
33
|
+
{
|
34
|
+
color:silver;
|
35
|
+
}
|
36
|
+
.tagManager
|
37
|
+
{
|
38
|
+
border-radius: 3px 3px 3px 3px;
|
39
|
+
margin-top:0;
|
40
|
+
}
|
41
|
+
|
42
|
+
.myFramedTag
|
43
|
+
{
|
44
|
+
background: none repeat scroll 0 0 #CDE69C;
|
45
|
+
border: 1px solid #A5D24A;
|
46
|
+
border-radius: 3px 3px 3px 3px;
|
47
|
+
color: #638421;
|
48
|
+
//display: block;
|
49
|
+
//float: left;
|
50
|
+
font-family: helvetica;
|
51
|
+
font-size: 11px;
|
52
|
+
margin-bottom: 5px;
|
53
|
+
margin-right: 5px;
|
54
|
+
//padding-top: 6px;
|
55
|
+
//padding-bottom: 5px;
|
56
|
+
padding: 5px 4px 4px 4px;
|
57
|
+
text-decoration: none;
|
58
|
+
white-space: nowrap;
|
59
|
+
|
60
|
+
vertical-align: middle;
|
61
|
+
line-height: 18px;
|
62
|
+
//height:18px;
|
63
|
+
-moz-transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
|
64
|
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
|
65
|
+
}
|
66
|
+
|
67
|
+
.myMinTag
|
68
|
+
{
|
69
|
+
background: none repeat scroll 0 0 #CDE69C;
|
70
|
+
border: 1px solid #A5D24A;
|
71
|
+
border-radius: 3px 3px 3px 3px;
|
72
|
+
color: #638421;
|
73
|
+
//display: block;
|
74
|
+
//float: left;
|
75
|
+
font-family: helvetica;
|
76
|
+
font-size: 11px;
|
77
|
+
margin-bottom: 5px;
|
78
|
+
margin-right: 5px;
|
79
|
+
//padding-top: 6px;
|
80
|
+
//padding-bottom: 5px;
|
81
|
+
padding: 2px 4px 2px 4px;
|
82
|
+
text-decoration: none;
|
83
|
+
|
84
|
+
vertical-align: middle;
|
85
|
+
line-height: 18px;
|
86
|
+
//height:18px;
|
87
|
+
-moz-transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
|
88
|
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
|
89
|
+
}
|
90
|
+
|
91
|
+
.myMinNonTag
|
92
|
+
{
|
93
|
+
font-family: helvetica;
|
94
|
+
font-size: 11px;
|
95
|
+
margin-bottom: 5px;
|
96
|
+
margin-right: 5px;
|
97
|
+
//padding-top: 6px;
|
98
|
+
//padding-bottom: 5px;
|
99
|
+
padding: 2px 4px 2px 4px;
|
100
|
+
text-decoration: none;
|
101
|
+
|
102
|
+
vertical-align: middle;
|
103
|
+
line-height: 18px;
|
104
|
+
//height:18px;
|
105
|
+
-moz-transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
|
106
|
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
|
107
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: th_simple_content_management
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toby Hinloopen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -104,10 +104,8 @@ files:
|
|
104
104
|
- app/assets/javascripts/simple_content_management/simple_menu_items.js
|
105
105
|
- app/assets/javascripts/simple_content_management/simple_pages.js
|
106
106
|
- app/assets/javascripts/simple_content_management.js
|
107
|
-
- app/controllers/simple_content_management/simple_content_sections_controller.rb
|
108
107
|
- app/controllers/simple_content_management/simple_menu_items_controller.rb
|
109
108
|
- app/controllers/simple_content_management/simple_pages_controller.rb
|
110
|
-
- app/models/simple_content_management/simple_content_section.rb
|
111
109
|
- app/models/simple_content_management/simple_menu_item.rb
|
112
110
|
- app/models/simple_content_management/simple_page.rb
|
113
111
|
- app/models/simple_content_management/simple_route.rb
|
@@ -131,6 +129,8 @@ files:
|
|
131
129
|
- lib/simple_content_management/version.rb
|
132
130
|
- lib/simple_content_management.rb
|
133
131
|
- lib/tasks/simple_content_management_tasks.rake
|
132
|
+
- vendor/assets/javascripts/bootstrap-tagmanager.js
|
133
|
+
- vendor/assets/stylesheets/bootstrap-tagmanager.css
|
134
134
|
- MIT-LICENSE
|
135
135
|
- Rakefile
|
136
136
|
- README.rdoc
|
@@ -1,9 +0,0 @@
|
|
1
|
-
class SimpleContentManagement::SimpleContentSectionsController < InheritedResources::Base
|
2
|
-
defaults :resource_class => SimpleContentManagement::SimpleContentSection
|
3
|
-
include SimpleAdminPanel::ControllerExtensions
|
4
|
-
alias_method_chain :collection, :search_and_pagination
|
5
|
-
|
6
|
-
def end_of_association_chain
|
7
|
-
resource_class.active
|
8
|
-
end
|
9
|
-
end
|