multi-select-rails 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  .DS_Store
19
+ *.sublime-workspace
@@ -1,5 +1,5 @@
1
1
  module MultiSelectRails
2
2
  module Rails
3
- VERSION = "0.9.1"
3
+ VERSION = "0.9.2"
4
4
  end
5
5
  end
@@ -0,0 +1,13 @@
1
+ {
2
+ "folders":
3
+ [
4
+ {
5
+ "path": "."
6
+ }
7
+ ],
8
+ "settings":
9
+ {
10
+ "tab_size": 2,
11
+ "translate_tabs_to_spaces": true
12
+ }
13
+ }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * MultiSelect v0.9.1
2
+ * MultiSelect v0.9.2
3
3
  * Copyright (c) 2012 Louis Cuny
4
4
  *
5
5
  * This program is free software. It comes without any warranty, to
@@ -44,27 +44,52 @@
44
44
  var optgroupLabel = null,
45
45
  optgroupId = null,
46
46
  optgroupCpt = 0,
47
- scroll = 0;
48
-
47
+ scroll = 0,
48
+ optgroupContainerTemplate = '<li class="ms-optgroup-container"></li>',
49
+ optgroupUlTemplate = '<ul class="ms-optgroup"></ul>',
50
+ optgroupLiTemplate = '<li class="ms-optgroup-label"><span></span></li>';
49
51
 
50
52
  ms.find('optgroup, option').each(function(){
51
53
  if ($(this).is('optgroup')){
52
- optgroupLabel = $(this).attr('label');
54
+ optgroupLabel = '<span>'+$(this).attr('label')+'</span>';
53
55
  optgroupId = 'ms-'+ms.attr('id')+'-optgroup-'+optgroupCpt;
54
56
 
55
- that.$selectableUl.append(
56
- '<li class="ms-optgroup-container" id="'+optgroupId+'-selectable">\
57
- <ul class="ms-optgroup">\
58
- <li class="ms-optgroup-label"><span>'+optgroupLabel+'</span></li>\
59
- </ul>\
60
- </li>');
61
- that.$selectionUl.append(
62
- '<li class="ms-optgroup-container" id="'+optgroupId+'-selection">\
63
- <ul class="ms-optgroup">\
64
- <li class="ms-optgroup-label"><span>'+optgroupLabel+'</span></li>\
65
- </ul>\
66
- </li>');
57
+ var optgroup = $(this),
58
+ optgroupSelectable = $(optgroupContainerTemplate),
59
+ optgroupSelection = $(optgroupContainerTemplate),
60
+ optgroupSelectionLi = $(optgroupLiTemplate),
61
+ optgroupSelectableLi = $(optgroupLiTemplate);
62
+
63
+ if (that.options.selectableOptgroup){
64
+ optgroupSelectableLi.on('click', function(){
65
+ var values = optgroup.children(':not(:selected)').map(function(){ return $(this).val() }).get();
66
+ that.select(values);
67
+ });
68
+
69
+ optgroupSelectionLi.on('click', function(){
70
+ var values = optgroup.children(':selected').map(function(){ return $(this).val() }).get();
71
+ that.deselect(values);
72
+ });
73
+ }
74
+
75
+ optgroupSelectableLi.html(optgroupLabel);
76
+
77
+ optgroupSelectable.attr('id', optgroupId+'-selectable')
78
+ .append($(optgroupUlTemplate)
79
+ .append(optgroupSelectableLi));
80
+
81
+ that.$selectableUl.append(optgroupSelectable);
82
+
83
+ optgroupSelectionLi.html(optgroupLabel);
84
+
85
+ optgroupSelection.attr('id', optgroupId+'-selection')
86
+ .append($(optgroupUlTemplate)
87
+ .append(optgroupSelectionLi));
88
+
89
+ that.$selectionUl.append(optgroupSelection);
90
+
67
91
  optgroupCpt++;
92
+
68
93
  } else {
69
94
 
70
95
  var attributes = "";
@@ -389,6 +414,7 @@
389
414
  }
390
415
 
391
416
  $.fn.multiSelect.defaults = {
417
+ selectableOptgroup: false,
392
418
  disabledClass : 'disabled',
393
419
  dblClick : false
394
420
  }
@@ -1,5 +1,5 @@
1
1
  .ms-container{
2
- background: transparent image-url("switch.png") no-repeat 170px 80px;
2
+ background: transparent image-url('switch.png') no-repeat 170px 80px;
3
3
  }
4
4
 
5
5
  .ms-container:after{
@@ -83,4 +83,4 @@
83
83
  color: #ffffff;
84
84
  text-decoration: none;
85
85
  background-color: #0088cc;
86
- }
86
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi-select-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
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: 2012-12-13 00:00:00.000000000 Z
12
+ date: 2012-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -74,6 +74,7 @@ files:
74
74
  - lib/multi-select-rails/railtie.rb
75
75
  - lib/multi-select-rails/version.rb
76
76
  - multi-select-rails.gemspec
77
+ - multi-select.sublime-project
77
78
  - vendor/assets/images/switch.png
78
79
  - vendor/assets/javascripts/multi-select.js
79
80
  - vendor/assets/stylesheets/multi-select.scss
@@ -89,12 +90,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
90
  - - ! '>='
90
91
  - !ruby/object:Gem::Version
91
92
  version: '0'
93
+ segments:
94
+ - 0
95
+ hash: -2806128788544940467
92
96
  required_rubygems_version: !ruby/object:Gem::Requirement
93
97
  none: false
94
98
  requirements:
95
99
  - - ! '>='
96
100
  - !ruby/object:Gem::Version
97
101
  version: '0'
102
+ segments:
103
+ - 0
104
+ hash: -2806128788544940467
98
105
  requirements: []
99
106
  rubyforge_project:
100
107
  rubygems_version: 1.8.24