select-multiple-rails 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 034be1f5bc93c1b870fd8715e90ecf16f8de2615
4
+ data.tar.gz: 8aebaa44f39da358566f8189c4e5ed0de167a4ae
5
+ SHA512:
6
+ metadata.gz: f215393867eaafc25966f66ca85b505b4d9855349073280ffea8c8d16768785d34672c206f7e0986f85142439a5c6d9f1711fba873770d7d00cb47c54dfe4eed
7
+ data.tar.gz: 5bb11f44af5ada7eb01810e99bf2ccc0edf4974e5d5c8c4041d4b1ee06308a9c4a1b6f24f2501710e0aa41c8a3ccf4d836e9c1c78314937ee6d30c90517101e5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bootstrap-rails.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Shalil Awaley
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # SelectMultiple for Rails [![Gem Version]
2
+
3
+ [select-multiple](https://github.com/krazedkrish/select-multiple) is a tiny jQuery plugin to customize selects with the multiple attribute.
4
+
5
+ The `select-multiple-rails` gem integrates `select-multiple` with the Rails asset pipeline.
6
+
7
+ ## Usage
8
+
9
+ ### Install select-multiple-rails gem
10
+
11
+ Include `select-multiple-rails` in Gemfile
12
+
13
+ gem 'select-multiple-rails'
14
+
15
+ Then run `bundle install`
16
+
17
+ ### Include selectmultiple javascript
18
+
19
+ Add to your `app/assets/javascripts/application.js`
20
+
21
+ //= require select-multiple
22
+
23
+ ### Include selectmultiple stylesheet
24
+
25
+ Add to your `app/assets/stylesheets/application.css`
26
+
27
+ *= require select-multiple
28
+
29
+ ## Updating the gem
30
+ There are two rake tasks designed to ease the maintenance of this gem.
31
+
32
+ The `update` task pulls the latest select-multiple code from github and places images, stylesheets and javascripts in the correct gem paths. It also changes background-image properties in the stylesheet to asset pipeline equivalents.
33
+
34
+ rake update
35
+
36
+ The `build` task is a simple wrapper for `gem build`
37
+
38
+ rake build
39
+
40
+
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ desc "Update"
2
+ task :update do
3
+ system("rm -rf select-multiple-src")
4
+
5
+ system("git clone --depth 1 https://github.com/krazedkrish/select-multiple.git select-multiple-src")
6
+ system("cp select-multiple-src/css/select-multiple.css app/assets/stylesheets/select-multiple.scss")
7
+ system("cp select-multiple-src/js/jquery.select-multiple.js app/assets/javascripts/select-multiple.js")
8
+
9
+ system("rm -rf select-multiple-src")
10
+ end
11
+
12
+ desc "Build"
13
+ task "build" do
14
+ system("gem build select-multiple-rails.gemspec")
15
+ end
@@ -0,0 +1,471 @@
1
+ /*
2
+ * SelectMultiple v0.1
3
+ * Copyright (c) 2015 krazedkrish( Shalil Awaley )
4
+ *
5
+ * This program is free software. It comes without any warranty, to
6
+ * the extent permitted by applicable law. You can redistribute it
7
+ * and/or modify it under the terms of the MIT LICENSE.
8
+ * See https://en.wikipedia.org/wiki/MIT_License for more details.
9
+ */
10
+
11
+ !function ($) {
12
+
13
+ "use strict";
14
+
15
+
16
+ /* SELECTMULTIPLE CLASS DEFINITION
17
+ * ====================== */
18
+
19
+ var SelectMultiple = function (element, options) {
20
+ this.options = options;
21
+ this.$element = $(element);
22
+ this.$container = $('<div/>', { 'class': "ms-container" });
23
+ this.$selectableContainer = $('<div/>', { 'class': 'ms-selectable' });
24
+ this.$selectableUl = $('<ul/>', { 'class': "ms-list", 'tabindex' : '-1' });
25
+ this.scrollTo = 0;
26
+ this.elemsSelector = 'li';
27
+ };
28
+
29
+ SelectMultiple.prototype = {
30
+ constructor: SelectMultiple,
31
+
32
+ init: function(){
33
+ var that = this,
34
+ ms = this.$element;
35
+
36
+ if (ms.next('.ms-container').length === 0){
37
+ ms.css({ position: 'absolute', left: '-9999px' });
38
+ ms.attr('id', ms.attr('id') ? ms.attr('id') : Math.ceil(Math.random()*1000)+'selectmultiple');
39
+ this.$container.attr('id', 'ms-'+ms.attr('id'));
40
+ this.$container.addClass(that.options.cssClass);
41
+ ms.find('option').each(function(){
42
+ that.generateLisFromOption(this);
43
+ });
44
+
45
+
46
+ if (that.options.selectableHeader){
47
+ that.$selectableContainer.append(that.options.selectableHeader);
48
+ }
49
+ that.$selectableContainer.append(that.$selectableUl);
50
+ if (that.options.selectableFooter){
51
+ that.$selectableContainer.append(that.options.selectableFooter);
52
+ }
53
+
54
+
55
+ that.$container.append(that.$selectableContainer);
56
+ ms.after(that.$container);
57
+
58
+ that.activeMouse(that.$selectableUl);
59
+ that.activeKeyboard(that.$selectableUl);
60
+
61
+ var action = that.options.dblClick ? 'dblclick' : 'click';
62
+
63
+ that.$selectableUl.on(action, '.ms-elem-selectable', function(){
64
+ that.select($(this).data('ms-value'));
65
+ });
66
+
67
+
68
+ ms.on('focus', function(){
69
+ that.$selectableUl.focus();
70
+ })
71
+ }
72
+
73
+ var selectedValues = ms.find('option:selected').map(function(){ return $(this).val(); }).get();
74
+ that.select(selectedValues, 'init');
75
+
76
+ if (typeof that.options.afterInit === 'function') {
77
+ that.options.afterInit.call(this, this.$container);
78
+ }
79
+ },
80
+
81
+ 'generateLisFromOption' : function(option, index, $container){
82
+ var that = this,
83
+ ms = that.$element,
84
+ attributes = "",
85
+ $option = $(option);
86
+
87
+ for (var cpt = 0; cpt < option.attributes.length; cpt++){
88
+ var attr = option.attributes[cpt];
89
+
90
+ if(attr.name !== 'value' && attr.name !== 'disabled'){
91
+ attributes += attr.name+'="'+attr.value+'" ';
92
+ }
93
+ }
94
+ var selectableLi = $('<li '+attributes+'><span>'+that.escapeHTML($option.text())+'</span><span class="pull-right ms-elem-selected">✔</span></li>'),
95
+ selectedLi = selectableLi.clone(),
96
+ value = $option.val(),
97
+ elementId = that.sanitize(value);
98
+
99
+ selectableLi
100
+ .data('ms-value', value)
101
+ .addClass('ms-elem-selectable')
102
+ .attr('id', elementId+'-selectable');
103
+
104
+
105
+ if ($option.prop('disabled') || ms.prop('disabled')){
106
+ selectableLi.addClass(that.options.disabledClass);
107
+ }
108
+
109
+ var $optgroup = $option.parent('optgroup');
110
+
111
+ if ($optgroup.length > 0){
112
+ var optgroupLabel = $optgroup.attr('label'),
113
+ optgroupId = that.sanitize(optgroupLabel),
114
+ $selectableOptgroup = that.$selectableUl.find('#optgroup-selectable-'+optgroupId);
115
+
116
+ if ($selectableOptgroup.length === 0){
117
+ var optgroupContainerTpl = '<li class="ms-optgroup-container"></li>',
118
+ optgroupTpl = '<ul class="ms-optgroup"><li class="ms-optgroup-label"><span>'+optgroupLabel+'</span></li></ul>';
119
+
120
+ $selectableOptgroup = $(optgroupContainerTpl);
121
+ $selectableOptgroup.attr('id', 'optgroup-selectable-'+optgroupId);
122
+ $selectableOptgroup.append($(optgroupTpl));
123
+ if (that.options.selectableOptgroup){
124
+ $selectableOptgroup.find('.ms-optgroup-label').on('click', function(){
125
+ var values = $optgroup.children(':not(:selected, :disabled)').map(function(){ return $(this).val() }).get();
126
+ that.select(values);
127
+ });
128
+ }
129
+ that.$selectableUl.append($selectableOptgroup);
130
+ }
131
+ index = index == undefined ? $selectableOptgroup.find('ul').children().length : index + 1;
132
+ selectableLi.insertAt(index, $selectableOptgroup.children());
133
+ } else {
134
+ index = index == undefined ? that.$selectableUl.children().length : index;
135
+
136
+ selectableLi.insertAt(index, that.$selectableUl);
137
+ }
138
+ },
139
+
140
+ 'addOption' : function(options){
141
+ var that = this;
142
+
143
+ if (options.value !== undefined && options.value !== null){
144
+ options = [options];
145
+ }
146
+ $.each(options, function(index, option){
147
+ if (option.value !== undefined && option.value !== null &&
148
+ that.$element.find("option[value='"+option.value+"']").length === 0){
149
+ var $option = $('<option value="'+option.value+'">'+option.text+'</option>'),
150
+ index = parseInt((typeof option.index === 'undefined' ? that.$element.children().length : option.index)),
151
+ $container = option.nested == undefined ? that.$element : $("optgroup[label='"+option.nested+"']")
152
+
153
+ $option.insertAt(index, $container);
154
+ that.generateLisFromOption($option.get(0), index, option.nested);
155
+ }
156
+ })
157
+ },
158
+
159
+ 'escapeHTML' : function(text){
160
+ return $("<div>").text(text).html();
161
+ },
162
+
163
+ 'activeKeyboard' : function($list){
164
+ var that = this;
165
+
166
+ $list.on('focus', function(){
167
+ $(this).addClass('ms-focus');
168
+ })
169
+ .on('blur', function(){
170
+ $(this).removeClass('ms-focus');
171
+ })
172
+ .on('keydown', function(e){
173
+ switch (e.which) {
174
+ case 40:
175
+ case 38:
176
+ e.preventDefault();
177
+ e.stopPropagation();
178
+ that.moveHighlight($(this), (e.which === 38) ? -1 : 1);
179
+ return;
180
+ case 37:
181
+ case 39:
182
+ e.preventDefault();
183
+ e.stopPropagation();
184
+ that.switchList($list);
185
+ return;
186
+ case 9:
187
+ if(that.$element.is('[tabindex]')){
188
+ e.preventDefault();
189
+ var tabindex = parseInt(that.$element.attr('tabindex'), 10);
190
+ tabindex = (e.shiftKey) ? tabindex-1 : tabindex+1;
191
+ $('[tabindex="'+(tabindex)+'"]').focus();
192
+ return;
193
+ }else{
194
+ if(e.shiftKey){
195
+ that.$element.trigger('focus');
196
+ }
197
+ }
198
+ }
199
+ if($.inArray(e.which, that.options.keySelect) > -1){
200
+ e.preventDefault();
201
+ e.stopPropagation();
202
+ that.selectHighlighted($list);
203
+ return;
204
+ }
205
+ });
206
+ },
207
+
208
+ 'moveHighlight': function($list, direction){
209
+ var $elems = $list.find(this.elemsSelector),
210
+ $currElem = $elems.filter('.ms-hover'),
211
+ $nextElem = null,
212
+ elemHeight = $elems.first().outerHeight(),
213
+ containerHeight = $list.height(),
214
+ containerSelector = '#'+this.$container.prop('id');
215
+
216
+ $elems.removeClass('ms-hover');
217
+ if (direction === 1){ // DOWN
218
+
219
+ $nextElem = $currElem.nextAll(this.elemsSelector).first();
220
+ if ($nextElem.length === 0){
221
+ var $optgroupUl = $currElem.parent();
222
+
223
+ if ($optgroupUl.hasClass('ms-optgroup')){
224
+ var $optgroupLi = $optgroupUl.parent(),
225
+ $nextOptgroupLi = $optgroupLi.next(':visible');
226
+
227
+ if ($nextOptgroupLi.length > 0){
228
+ $nextElem = $nextOptgroupLi.find(this.elemsSelector).first();
229
+ } else {
230
+ $nextElem = $elems.first();
231
+ }
232
+ } else {
233
+ $nextElem = $elems.first();
234
+ }
235
+ }
236
+ } else if (direction === -1){ // UP
237
+
238
+ $nextElem = $currElem.prevAll(this.elemsSelector).first();
239
+ if ($nextElem.length === 0){
240
+ var $optgroupUl = $currElem.parent();
241
+
242
+ if ($optgroupUl.hasClass('ms-optgroup')){
243
+ var $optgroupLi = $optgroupUl.parent(),
244
+ $prevOptgroupLi = $optgroupLi.prev(':visible');
245
+
246
+ if ($prevOptgroupLi.length > 0){
247
+ $nextElem = $prevOptgroupLi.find(this.elemsSelector).last();
248
+ } else {
249
+ $nextElem = $elems.last();
250
+ }
251
+ } else {
252
+ $nextElem = $elems.last();
253
+ }
254
+ }
255
+ }
256
+ if ($nextElem.length > 0){
257
+ $nextElem.addClass('ms-hover');
258
+ var scrollTo = $list.scrollTop() + $nextElem.position().top -
259
+ containerHeight / 2 + elemHeight / 2;
260
+
261
+ $list.scrollTop(scrollTo);
262
+ }
263
+ },
264
+
265
+ 'selectHighlighted' : function($list){
266
+ var $elems = $list.find(this.elemsSelector),
267
+ $highlightedElem = $elems.filter('.ms-hover').first();
268
+
269
+ if ($highlightedElem.length > 0){
270
+ if ($list.parent().hasClass('ms-selectable')){
271
+ this.select($highlightedElem.data('ms-value'));
272
+ } else {
273
+ this.deselect($highlightedElem.data('ms-value'));
274
+ }
275
+ $elems.removeClass('ms-hover');
276
+ }
277
+ },
278
+
279
+ 'switchList' : function($list){
280
+ $list.blur();
281
+ this.$container.find(this.elemsSelector).removeClass('ms-hover');
282
+ if ($list.parent().hasClass('ms-selectable')){
283
+ } else {
284
+ this.$selectableUl.focus();
285
+ }
286
+ },
287
+
288
+ 'activeMouse' : function($list){
289
+ var that = this;
290
+
291
+ $('body').on('mouseenter', that.elemsSelector, function(){
292
+ $(this).parents('.ms-container').find(that.elemsSelector).removeClass('ms-hover');
293
+ $(this).addClass('ms-hover');
294
+ });
295
+
296
+ $('body').on('mouseleave', that.elemsSelector, function () {
297
+ $(this).parents('.ms-container').find(that.elemsSelector).removeClass('ms-hover');;
298
+ });
299
+ },
300
+
301
+ 'refresh' : function() {
302
+ this.destroy();
303
+ this.$element.selectMultiple(this.options);
304
+ },
305
+
306
+ 'destroy' : function(){
307
+ $("#ms-"+this.$element.attr("id")).remove();
308
+ this.$element.css('position', '').css('left', '')
309
+ this.$element.removeData('selectmultiple');
310
+ },
311
+
312
+ 'select' : function(value, method){
313
+ if (typeof value === 'string'){ value = [value]; }
314
+
315
+ var that = this,
316
+ ms = this.$element,
317
+ msIds = $.map(value, function(val){ return(that.sanitize(val)); }),
318
+ selectables = this.$selectableUl.find('#' + msIds.join('-selectable, #')+'-selectable').filter(':not(.'+that.options.disabledClass+')'),
319
+ options = ms.find('option:not(:disabled)').filter(function(){ return($.inArray(this.value, value) > -1); });
320
+
321
+ if (method === 'init'){
322
+ selectables = this.$selectableUl.find('#' + msIds.join('-selectable, #')+'-selectable');
323
+ selectables.children('.ms-elem-selected').show();
324
+ }
325
+
326
+ if (selectables.length > 0){
327
+ selectables.addClass('ms-selected').children('.ms-elem-selected').show();
328
+
329
+ if (method !== 'init' && options.prop('selected') == true) {
330
+ that.deselect(value, method);
331
+ return;
332
+ }
333
+
334
+ options.prop('selected', true);
335
+
336
+ var selectableOptgroups = that.$selectableUl.children('.ms-optgroup-container');
337
+ if (selectableOptgroups.length > 0){
338
+ selectableOptgroups.each(function(){
339
+ var selectablesLi = $(this).find('.ms-elem-selectable');
340
+ if (selectablesLi.length === selectablesLi.filter('.ms-selected').length){
341
+ $(this).find('.ms-optgroup-label').hide();
342
+ }
343
+ });
344
+
345
+ }
346
+ if (method !== 'init'){
347
+ ms.trigger('change');
348
+ if (typeof that.options.afterSelect === 'function') {
349
+ that.options.afterSelect.call(this, value);
350
+ }
351
+ }
352
+ }
353
+ },
354
+
355
+ 'deselect' : function(value, method){
356
+ if (typeof value === 'string'){ value = [value]; }
357
+
358
+ var that = this,
359
+ ms = this.$element,
360
+ msIds = $.map(value, function(val){ return(that.sanitize(val)); }),
361
+ selectables = this.$selectableUl.find('#' + msIds.join('-selectable, #')+'-selectable'),
362
+ options = ms.find('option').filter(function(){ return($.inArray(this.value, value) > -1); });
363
+
364
+ selectables.removeClass('ms-selected').children('.ms-elem-selected').hide();
365
+ options.prop('selected', false);
366
+
367
+ var selectableOptgroups = that.$selectableUl.children('.ms-optgroup-container');
368
+ if (selectableOptgroups.length > 0){
369
+ selectableOptgroups.each(function(){
370
+ var selectablesLi = $(this).find('.ms-elem-selectable');
371
+ if (selectablesLi.filter(':not(.ms-selected)').length > 0){
372
+ $(this).find('.ms-optgroup-label').show();
373
+ }
374
+ });
375
+
376
+ }
377
+ if (method !== 'init'){
378
+ ms.trigger('change');
379
+ if (typeof that.options.afterDeselect === 'function') {
380
+ that.options.afterDeselect.call(this, value);
381
+ }
382
+ }
383
+ },
384
+
385
+ 'select_all' : function(){
386
+ var ms = this.$element,
387
+ values = ms.val();
388
+
389
+ ms.find('option:not(":disabled")').prop('selected', true);
390
+ this.$selectableUl.find('.ms-elem-selectable').filter(':not(.'+this.options.disabledClass+')').addClass('ms-selected').hide();
391
+ this.$selectableUl.find('.ms-optgroup-label').hide();
392
+ ms.trigger('change');
393
+ if (typeof this.options.afterSelect === 'function') {
394
+ var selectedValues = $.grep(ms.val(), function(item){
395
+ return $.inArray(item, values) < 0;
396
+ });
397
+ this.options.afterSelect.call(this, selectedValues);
398
+ }
399
+ },
400
+
401
+ 'deselect_all' : function(){
402
+ var ms = this.$element,
403
+ values = ms.val();
404
+
405
+ ms.find('option').prop('selected', false);
406
+ this.$selectableUl.find('.ms-elem-selectable').removeClass('ms-selected').show();
407
+ this.$selectableUl.find('.ms-optgroup-label').show();
408
+ this.$selectableUl.focus();
409
+ ms.trigger('change');
410
+ if (typeof this.options.afterDeselect === 'function') {
411
+ this.options.afterDeselect.call(this, values);
412
+ }
413
+ },
414
+
415
+ sanitize: function(value){
416
+ var hash = 0, i, character;
417
+ if (value.length == 0) return hash;
418
+ var ls = 0;
419
+ for (i = 0, ls = value.length; i < ls; i++) {
420
+ character = value.charCodeAt(i);
421
+ hash = ((hash<<5)-hash)+character;
422
+ hash |= 0; // Convert to 32bit integer
423
+ }
424
+ return hash;
425
+ }
426
+ };
427
+
428
+ /* SELECTMULTIPLE PLUGIN DEFINITION
429
+ * ======================= */
430
+
431
+ $.fn.selectMultiple = function () {
432
+ var option = arguments[0],
433
+ args = arguments;
434
+
435
+ return this.each(function () {
436
+ var $this = $(this),
437
+ data = $this.data('selectmultiple'),
438
+ options = $.extend({}, $.fn.selectMultiple.defaults, $this.data(), typeof option === 'object' && option);
439
+
440
+ if (!data){ $this.data('selectmultiple', (data = new SelectMultiple(this, options))); }
441
+
442
+ if (typeof option === 'string'){
443
+ data[option](args[1]);
444
+ } else {
445
+ data.init();
446
+ }
447
+ });
448
+ };
449
+
450
+ $.fn.selectMultiple.defaults = {
451
+ keySelect: [32],
452
+ selectableOptgroup: false,
453
+ disabledClass : 'disabled',
454
+ dblClick : false,
455
+ keepOrder: false,
456
+ cssClass: ''
457
+ };
458
+
459
+ $.fn.selectMultiple.Constructor = SelectMultiple;
460
+
461
+ $.fn.insertAt = function(index, $parent) {
462
+ return this.each(function() {
463
+ if (index === 0) {
464
+ $parent.prepend(this);
465
+ } else {
466
+ $parent.children().eq(index - 1).after(this);
467
+ }
468
+ });
469
+ }
470
+
471
+ }(window.jQuery);
@@ -0,0 +1,89 @@
1
+ .ms-container{
2
+ width: 200px;
3
+ }
4
+
5
+ .ms-container:after{
6
+ content: ".";
7
+ display: block;
8
+ height: 0;
9
+ line-height: 0;
10
+ font-size: 0;
11
+ clear: both;
12
+ min-height: 0;
13
+ visibility: hidden;
14
+ }
15
+
16
+ .ms-container .ms-selectable, .ms-container .ms-selection{
17
+ background: #fff;
18
+ color: #555555;
19
+ /*float: left;*/
20
+ }
21
+
22
+ .ms-container .ms-list{
23
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
24
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
25
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
26
+ -webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
27
+ -moz-transition: border linear 0.2s, box-shadow linear 0.2s;
28
+ -ms-transition: border linear 0.2s, box-shadow linear 0.2s;
29
+ -o-transition: border linear 0.2s, box-shadow linear 0.2s;
30
+ transition: border linear 0.2s, box-shadow linear 0.2s;
31
+ border: 1px solid #ccc;
32
+ -webkit-border-radius: 3px;
33
+ -moz-border-radius: 3px;
34
+ border-radius: 3px;
35
+ position: relative;
36
+ height: 200px;
37
+ padding: 0;
38
+ overflow-y: auto;
39
+ }
40
+
41
+ .ms-container .ms-list.ms-focus{
42
+ border-color: rgba(82, 168, 236, 0.8);
43
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
44
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
45
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
46
+ outline: 0;
47
+ outline: thin dotted \9;
48
+ }
49
+
50
+ .ms-container ul{
51
+ margin: 0;
52
+ list-style-type: none;
53
+ padding: 0;
54
+ }
55
+
56
+ .ms-container .ms-optgroup-container{
57
+ width: 100%;
58
+ }
59
+
60
+ .ms-container .ms-optgroup-label{
61
+ margin: 0;
62
+ padding: 5px 0px 0px 5px;
63
+ cursor: pointer;
64
+ color: #999;
65
+ }
66
+
67
+ .ms-container .ms-selectable li.ms-elem-selectable{
68
+ border-bottom: 1px #eee solid;
69
+ padding: 2px 10px;
70
+ color: #555;
71
+ font-size: 14px;
72
+ }
73
+
74
+ .ms-container .ms-selectable li.ms-hover{
75
+ cursor: pointer;
76
+ color: #fff;
77
+ text-decoration: none;
78
+ background-color: #08c;
79
+ }
80
+
81
+ .ms-container .ms-selectable li.disabled{
82
+ background-color: #eee;
83
+ color: #aaa;
84
+ cursor: text;
85
+ }
86
+
87
+ .ms-container .ms-selectable li span.ms-elem-selected {
88
+ display: none;
89
+ }
@@ -0,0 +1,6 @@
1
+ module SelectMultipleRails
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module SelectMultipleRails
2
+ module Rails
3
+ class Railtie < ::Rails::Railtie; end
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module SelectMultipleRails
2
+ module Rails
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ require "rails"
2
+ require "select-multiple-rails/version"
3
+
4
+ module SelectMultipleRails
5
+ module Rails
6
+ if ::Rails.version < "3.1"
7
+ require "select-multiple-rails/railtie"
8
+ else
9
+ require "select-multiple-rails/engine"
10
+ end
11
+ end
12
+ end
Binary file
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/select-multiple-rails/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["krazedkrish"]
6
+ gem.email = ["krazedkrish@gmail.com"]
7
+ gem.description = %q{Selectmultiple jQuery plugin for Rails asset pipeline}
8
+ gem.homepage = "https://github.com/krazedkrish/select-multiple-rails"
9
+ gem.summary = gem.description
10
+
11
+ gem.name = "select-multiple-rails"
12
+ gem.require_paths = ["lib"]
13
+ gem.files = `git ls-files`.split("\n")
14
+ gem.version = SelectMultipleRails::Rails::VERSION
15
+
16
+ gem.license = "MIT"
17
+
18
+ gem.add_dependency "railties", ">= 3.0"
19
+ gem.add_development_dependency "bundler", ">= 1.0"
20
+ gem.add_development_dependency "rake"
21
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: select-multiple-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - krazedkrish
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Selectmultiple jQuery plugin for Rails asset pipeline
56
+ email:
57
+ - krazedkrish@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - Gemfile
63
+ - LICENSE
64
+ - README.md
65
+ - Rakefile
66
+ - app/assets/javascripts/select-multiple.js
67
+ - app/assets/stylesheets/select-multiple.scss
68
+ - lib/select-multiple-rails.rb
69
+ - lib/select-multiple-rails/engine.rb
70
+ - lib/select-multiple-rails/railtie.rb
71
+ - lib/select-multiple-rails/version.rb
72
+ - select-multiple-rails-0.1.gem
73
+ - select-multiple-rails.gemspec
74
+ homepage: https://github.com/krazedkrish/select-multiple-rails
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.4.6
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Selectmultiple jQuery plugin for Rails asset pipeline
98
+ test_files: []