selectize-rails 0.7.4 → 0.7.5
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.
- data/README.md +1 -0
- data/lib/selectize-rails/version.rb +1 -1
- data/vendor/assets/javascripts/selectize.js +65 -37
- data/vendor/assets/stylesheets/selectize.bootstrap2.css +5 -5
- data/vendor/assets/stylesheets/selectize.bootstrap3.css +5 -5
- data/vendor/assets/stylesheets/selectize.css +5 -5
- data/vendor/assets/stylesheets/selectize.default.css +6 -6
- data/vendor/assets/stylesheets/selectize.legacy.css +5 -5
- metadata +2 -2
data/README.md
CHANGED
@@ -41,6 +41,7 @@ See the [demo page of Brian Reavis](http://brianreavis.github.io/selectize.js/)
|
|
41
41
|
|
42
42
|
| Version | Notes |
|
43
43
|
| -------:| ----------------------------------------------------------- |
|
44
|
+
| 0.7.5 | Update to v0.7.5 of selectize.js |
|
44
45
|
| 0.7.4 | Update to v0.7.4 of selectize.js |
|
45
46
|
| 0.7.3 | Update to v0.7.3 of selectize.js |
|
46
47
|
| 0.7.2 | Update to v0.7.2 of selectize.js |
|
@@ -463,7 +463,7 @@
|
|
463
463
|
}));
|
464
464
|
|
465
465
|
/**
|
466
|
-
* selectize.js (v0.7.
|
466
|
+
* selectize.js (v0.7.5)
|
467
467
|
* Copyright (c) 2013 Brian Reavis & contributors
|
468
468
|
*
|
469
469
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
@@ -974,6 +974,7 @@
|
|
974
974
|
|
975
975
|
self.initializePlugins(self.settings.plugins);
|
976
976
|
self.setupCallbacks();
|
977
|
+
self.setupTemplates();
|
977
978
|
self.setup();
|
978
979
|
};
|
979
980
|
|
@@ -1023,8 +1024,7 @@
|
|
1023
1024
|
$dropdown_content = $('<div>').addClass(settings.dropdownContentClass).appendTo($dropdown);
|
1024
1025
|
|
1025
1026
|
$wrapper.css({
|
1026
|
-
width: self.$input[0].style.width
|
1027
|
-
display: self.$input.css('display')
|
1027
|
+
width: self.$input[0].style.width
|
1028
1028
|
});
|
1029
1029
|
|
1030
1030
|
if (self.plugins.names.length) {
|
@@ -1144,6 +1144,35 @@
|
|
1144
1144
|
}
|
1145
1145
|
},
|
1146
1146
|
|
1147
|
+
/**
|
1148
|
+
* Sets up default rendering functions.
|
1149
|
+
*/
|
1150
|
+
setupTemplates: function() {
|
1151
|
+
var self = this;
|
1152
|
+
var field_label = self.settings.labelField;
|
1153
|
+
var field_optgroup = self.settings.optgroupLabelField;
|
1154
|
+
|
1155
|
+
var templates = {
|
1156
|
+
'optgroup': function(data) {
|
1157
|
+
return '<div class="optgroup">' + data.html + '</div>';
|
1158
|
+
},
|
1159
|
+
'optgroup_header': function(data, escape) {
|
1160
|
+
return '<div class="optgroup-header">' + escape(data[field_optgroup]) + '</div>';
|
1161
|
+
},
|
1162
|
+
'option': function(data, escape) {
|
1163
|
+
return '<div class="option">' + escape(data[field_label]) + '</div>';
|
1164
|
+
},
|
1165
|
+
'item': function(data, escape) {
|
1166
|
+
return '<div class="item">' + escape(data[field_label]) + '</div>';
|
1167
|
+
},
|
1168
|
+
'option_create': function(data, escape) {
|
1169
|
+
return '<div class="create">Add <strong>' + escape(data.input) + '</strong>…</div>';
|
1170
|
+
},
|
1171
|
+
};
|
1172
|
+
|
1173
|
+
self.settings.render = $.extend({}, templates, self.settings.render);
|
1174
|
+
},
|
1175
|
+
|
1147
1176
|
/**
|
1148
1177
|
* Maps fired events to callbacks provided
|
1149
1178
|
* in the settings used when creating the control.
|
@@ -2555,29 +2584,7 @@
|
|
2555
2584
|
}
|
2556
2585
|
|
2557
2586
|
// render markup
|
2558
|
-
|
2559
|
-
html = self.settings.render[templateName].apply(this, [data, escape_html]);
|
2560
|
-
} else {
|
2561
|
-
label = data[self.settings.labelField];
|
2562
|
-
switch (templateName) {
|
2563
|
-
case 'optgroup':
|
2564
|
-
html = '<div class="optgroup">' + data.html + "</div>";
|
2565
|
-
break;
|
2566
|
-
case 'optgroup_header':
|
2567
|
-
label = data[self.settings.optgroupLabelField];
|
2568
|
-
html = '<div class="optgroup-header">' + escape_html(label) + '</div>';
|
2569
|
-
break;
|
2570
|
-
case 'option':
|
2571
|
-
html = '<div class="option">' + escape_html(label) + '</div>';
|
2572
|
-
break;
|
2573
|
-
case 'item':
|
2574
|
-
html = '<div class="item">' + escape_html(label) + '</div>';
|
2575
|
-
break;
|
2576
|
-
case 'option_create':
|
2577
|
-
html = '<div class="create">Add <strong>' + escape_html(data.input) + '</strong>…</div>';
|
2578
|
-
break;
|
2579
|
-
}
|
2580
|
-
}
|
2587
|
+
html = self.settings.render[templateName].apply(this, [data, escape_html]);
|
2581
2588
|
|
2582
2589
|
// add mandatory attributes
|
2583
2590
|
if (templateName === 'option' || templateName === 'option_create') {
|
@@ -2923,25 +2930,45 @@
|
|
2923
2930
|
});
|
2924
2931
|
|
2925
2932
|
Selectize.define('remove_button', function(options) {
|
2926
|
-
|
2933
|
+
if (this.settings.mode === 'single') return;
|
2927
2934
|
|
2928
|
-
|
2929
|
-
|
2930
|
-
|
2935
|
+
options = $.extend({
|
2936
|
+
label : '×',
|
2937
|
+
title : 'Remove',
|
2938
|
+
className : 'remove',
|
2939
|
+
append : true,
|
2940
|
+
}, options);
|
2941
|
+
|
2942
|
+
var self = this;
|
2943
|
+
var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
|
2931
2944
|
|
2932
|
-
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2945
|
+
/**
|
2946
|
+
* Appends an element as a child (with raw HTML).
|
2947
|
+
*
|
2948
|
+
* @param {string} html_container
|
2949
|
+
* @param {string} html_element
|
2950
|
+
* @return {string}
|
2951
|
+
*/
|
2952
|
+
var append = function(html_container, html_element) {
|
2953
|
+
var pos = html_container.search(/(<\/[^>]+>\s*)$/);
|
2954
|
+
return html_container.substring(0, pos) + html_element + html_container.substring(pos);
|
2936
2955
|
};
|
2937
2956
|
|
2938
|
-
// override the setup method to add an extra "click" handler
|
2939
|
-
// that listens for mousedown events on the "x"
|
2940
2957
|
this.setup = (function() {
|
2941
2958
|
var original = self.setup;
|
2942
2959
|
return function() {
|
2960
|
+
// override the item rendering method to add the button to each
|
2961
|
+
if (options.append) {
|
2962
|
+
var render_item = self.settings.render.item;
|
2963
|
+
self.settings.render.item = function(data) {
|
2964
|
+
return append(render_item.apply(this, arguments), html);
|
2965
|
+
};
|
2966
|
+
}
|
2967
|
+
|
2943
2968
|
original.apply(this, arguments);
|
2944
|
-
|
2969
|
+
|
2970
|
+
// add event listener
|
2971
|
+
this.$control.on('click', '.' + options.className, function(e) {
|
2945
2972
|
e.preventDefault();
|
2946
2973
|
var $item = $(e.target).parent();
|
2947
2974
|
self.setActiveItem($item);
|
@@ -2949,6 +2976,7 @@
|
|
2949
2976
|
self.setCaret(self.items.length);
|
2950
2977
|
}
|
2951
2978
|
});
|
2979
|
+
|
2952
2980
|
};
|
2953
2981
|
})();
|
2954
2982
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* selectize.bootstrap2.css (v0.7.
|
2
|
+
* selectize.bootstrap2.css (v0.7.5) - Bootstrap 2 Theme
|
3
3
|
* Copyright (c) 2013 Brian Reavis & contributors
|
4
4
|
*
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
@@ -79,12 +79,12 @@
|
|
79
79
|
border-top: 0 none;
|
80
80
|
}
|
81
81
|
|
82
|
-
.selectize-control.plugin-remove_button
|
82
|
+
.selectize-control.plugin-remove_button [data-value] {
|
83
83
|
position: relative;
|
84
84
|
padding-right: 24px !important;
|
85
85
|
}
|
86
86
|
|
87
|
-
.selectize-control.plugin-remove_button
|
87
|
+
.selectize-control.plugin-remove_button [data-value] .remove {
|
88
88
|
position: absolute;
|
89
89
|
top: 0;
|
90
90
|
right: 0;
|
@@ -107,11 +107,11 @@
|
|
107
107
|
box-sizing: border-box;
|
108
108
|
}
|
109
109
|
|
110
|
-
.selectize-control.plugin-remove_button
|
110
|
+
.selectize-control.plugin-remove_button [data-value] .remove:hover {
|
111
111
|
background: rgba(0, 0, 0, 0.05);
|
112
112
|
}
|
113
113
|
|
114
|
-
.selectize-control.plugin-remove_button .
|
114
|
+
.selectize-control.plugin-remove_button [data-value].active .remove {
|
115
115
|
border-left-color: #0077b3;
|
116
116
|
}
|
117
117
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* selectize.bootstrap3.css (v0.7.
|
2
|
+
* selectize.bootstrap3.css (v0.7.5) - Bootstrap 3 Theme
|
3
3
|
* Copyright (c) 2013 Brian Reavis & contributors
|
4
4
|
*
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
@@ -79,12 +79,12 @@
|
|
79
79
|
border-top: 0 none;
|
80
80
|
}
|
81
81
|
|
82
|
-
.selectize-control.plugin-remove_button
|
82
|
+
.selectize-control.plugin-remove_button [data-value] {
|
83
83
|
position: relative;
|
84
84
|
padding-right: 24px !important;
|
85
85
|
}
|
86
86
|
|
87
|
-
.selectize-control.plugin-remove_button
|
87
|
+
.selectize-control.plugin-remove_button [data-value] .remove {
|
88
88
|
position: absolute;
|
89
89
|
top: 0;
|
90
90
|
right: 0;
|
@@ -107,11 +107,11 @@
|
|
107
107
|
box-sizing: border-box;
|
108
108
|
}
|
109
109
|
|
110
|
-
.selectize-control.plugin-remove_button
|
110
|
+
.selectize-control.plugin-remove_button [data-value] .remove:hover {
|
111
111
|
background: rgba(0, 0, 0, 0.05);
|
112
112
|
}
|
113
113
|
|
114
|
-
.selectize-control.plugin-remove_button .
|
114
|
+
.selectize-control.plugin-remove_button [data-value].active .remove {
|
115
115
|
border-left-color: rgba(0, 0, 0, 0);
|
116
116
|
}
|
117
117
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* selectize.css (v0.7.
|
2
|
+
* selectize.css (v0.7.5)
|
3
3
|
* Copyright (c) 2013 Brian Reavis & contributors
|
4
4
|
*
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
@@ -79,12 +79,12 @@
|
|
79
79
|
border-top: 0 none;
|
80
80
|
}
|
81
81
|
|
82
|
-
.selectize-control.plugin-remove_button
|
82
|
+
.selectize-control.plugin-remove_button [data-value] {
|
83
83
|
position: relative;
|
84
84
|
padding-right: 24px !important;
|
85
85
|
}
|
86
86
|
|
87
|
-
.selectize-control.plugin-remove_button
|
87
|
+
.selectize-control.plugin-remove_button [data-value] .remove {
|
88
88
|
position: absolute;
|
89
89
|
top: 0;
|
90
90
|
right: 0;
|
@@ -107,11 +107,11 @@
|
|
107
107
|
box-sizing: border-box;
|
108
108
|
}
|
109
109
|
|
110
|
-
.selectize-control.plugin-remove_button
|
110
|
+
.selectize-control.plugin-remove_button [data-value] .remove:hover {
|
111
111
|
background: rgba(0, 0, 0, 0.05);
|
112
112
|
}
|
113
113
|
|
114
|
-
.selectize-control.plugin-remove_button .
|
114
|
+
.selectize-control.plugin-remove_button [data-value].active .remove {
|
115
115
|
border-left-color: #cacaca;
|
116
116
|
}
|
117
117
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* selectize.default.css (v0.7.
|
2
|
+
* selectize.default.css (v0.7.5) - Default Theme
|
3
3
|
* Copyright (c) 2013 Brian Reavis & contributors
|
4
4
|
*
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
@@ -79,12 +79,12 @@
|
|
79
79
|
border-top: 0 none;
|
80
80
|
}
|
81
81
|
|
82
|
-
.selectize-control.plugin-remove_button
|
82
|
+
.selectize-control.plugin-remove_button [data-value] {
|
83
83
|
position: relative;
|
84
84
|
padding-right: 24px !important;
|
85
85
|
}
|
86
86
|
|
87
|
-
.selectize-control.plugin-remove_button
|
87
|
+
.selectize-control.plugin-remove_button [data-value] .remove {
|
88
88
|
position: absolute;
|
89
89
|
top: 0;
|
90
90
|
right: 0;
|
@@ -107,11 +107,11 @@
|
|
107
107
|
box-sizing: border-box;
|
108
108
|
}
|
109
109
|
|
110
|
-
.selectize-control.plugin-remove_button
|
110
|
+
.selectize-control.plugin-remove_button [data-value] .remove:hover {
|
111
111
|
background: rgba(0, 0, 0, 0.05);
|
112
112
|
}
|
113
113
|
|
114
|
-
.selectize-control.plugin-remove_button .
|
114
|
+
.selectize-control.plugin-remove_button [data-value].active .remove {
|
115
115
|
border-left-color: #00578d;
|
116
116
|
}
|
117
117
|
|
@@ -403,12 +403,12 @@
|
|
403
403
|
}
|
404
404
|
|
405
405
|
.selectize-dropdown .optgroup-header {
|
406
|
+
padding-top: 7px;
|
406
407
|
font-size: 0.85em;
|
407
408
|
font-weight: bold;
|
408
409
|
}
|
409
410
|
|
410
411
|
.selectize-dropdown .optgroup {
|
411
|
-
padding-top: 4px;
|
412
412
|
border-top: 1px solid #f0f0f0;
|
413
413
|
}
|
414
414
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* selectize.legacy.css (v0.7.
|
2
|
+
* selectize.legacy.css (v0.7.5) - Default Theme
|
3
3
|
* Copyright (c) 2013 Brian Reavis & contributors
|
4
4
|
*
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
@@ -79,12 +79,12 @@
|
|
79
79
|
border-top: 0 none;
|
80
80
|
}
|
81
81
|
|
82
|
-
.selectize-control.plugin-remove_button
|
82
|
+
.selectize-control.plugin-remove_button [data-value] {
|
83
83
|
position: relative;
|
84
84
|
padding-right: 24px !important;
|
85
85
|
}
|
86
86
|
|
87
|
-
.selectize-control.plugin-remove_button
|
87
|
+
.selectize-control.plugin-remove_button [data-value] .remove {
|
88
88
|
position: absolute;
|
89
89
|
top: 0;
|
90
90
|
right: 0;
|
@@ -107,11 +107,11 @@
|
|
107
107
|
box-sizing: border-box;
|
108
108
|
}
|
109
109
|
|
110
|
-
.selectize-control.plugin-remove_button
|
110
|
+
.selectize-control.plugin-remove_button [data-value] .remove:hover {
|
111
111
|
background: rgba(0, 0, 0, 0.05);
|
112
112
|
}
|
113
113
|
|
114
|
-
.selectize-control.plugin-remove_button .
|
114
|
+
.selectize-control.plugin-remove_button [data-value].active .remove {
|
115
115
|
border-left-color: #6f9839;
|
116
116
|
}
|
117
117
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selectize-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
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-09-
|
12
|
+
date: 2013-09-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|