sugoi_selectbox-rails 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +52 -0
- data/Rakefile +7 -0
- data/lib/sugoi_selectbox/rails/engine.rb +6 -0
- data/lib/sugoi_selectbox/rails/version.rb +5 -0
- data/lib/sugoi_selectbox/rails.rb +7 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/sugoi_selectbox/rails_spec.rb +11 -0
- data/sugoi_selectbox-rails.gemspec +24 -0
- data/vendor/assets/javascripts/sugoi_selectbox.js +403 -0
- data/vendor/assets/stylesheets/sugoi_selectbox.css +56 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 83b4391f8bc966e7bb1c66aa906e7159e7985e29
|
4
|
+
data.tar.gz: 3cf7aa81dca3386f286ed1d2add5a49e7e4dbfaf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: db7dce00c42828345c1ce56550e35307eceec5545b2b6359c9d12a1d10b7fa207931d87f6c63bb7d5c8f55c99c21fcf8269e0915c929313d9ccfa978e81d7f98
|
7
|
+
data.tar.gz: 573bdddab90f0901626986f1b6f7656e0ff55eba57480c75a6749f7a4b1663cfbdfd773e575a4ed3793cf8936632636e10b780bfcba6474bf00a56a0f4c9454e
|
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
.DS_Store
|
2
|
+
*.gem
|
3
|
+
*.rbc
|
4
|
+
.bundle
|
5
|
+
.config
|
6
|
+
.yardoc
|
7
|
+
Gemfile.lock
|
8
|
+
InstalledFiles
|
9
|
+
_yardoc
|
10
|
+
coverage
|
11
|
+
doc/
|
12
|
+
lib/bundler/man
|
13
|
+
pkg
|
14
|
+
rdoc
|
15
|
+
spec/reports
|
16
|
+
test/tmp
|
17
|
+
test/version_tmp
|
18
|
+
tmp
|
19
|
+
*.bundle
|
20
|
+
*.so
|
21
|
+
*.o
|
22
|
+
*.a
|
23
|
+
mkmf.log
|
24
|
+
*~
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 jiikko
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# sugoi_selectbox-rails
|
2
|
+
|
3
|
+
jQuery based replacement for select boxes.
|
4
|
+
|
5
|
+
![sugoi](https://cloud.githubusercontent.com/assets/1664497/7248919/9405f6fe-e851-11e4-8df6-252d0f948660.gif)
|
6
|
+
|
7
|
+
# Features
|
8
|
+
|
9
|
+
* Sugoi
|
10
|
+
* Lightweight
|
11
|
+
|
12
|
+
# 動作確認しているブラウザ
|
13
|
+
|
14
|
+
* Chrome(PC)
|
15
|
+
* FireFox(PC)
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
Add this line to your application's Gemfile:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
gem 'sugoi_selectbox-rails', github: 'jiikko/sugoi-selectbox-rails'
|
23
|
+
```
|
24
|
+
|
25
|
+
And then execute:
|
26
|
+
|
27
|
+
$ bundle
|
28
|
+
|
29
|
+
Add in your javascript.js
|
30
|
+
```
|
31
|
+
//= require jquery
|
32
|
+
//= require sugoi_selectbox
|
33
|
+
```
|
34
|
+
|
35
|
+
Add in your style.css
|
36
|
+
```
|
37
|
+
//= require sugoi_selectbox
|
38
|
+
```
|
39
|
+
|
40
|
+
## Usage
|
41
|
+
|
42
|
+
```javascript
|
43
|
+
$("#select").suguiSelectbox()
|
44
|
+
```
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
1. Fork it ( https://github.com/[my-github-username]/sugoi_selectbox-rails/fork )
|
49
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
50
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
51
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
52
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'sugoi_selectbox/rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "sugoi_selectbox-rails"
|
8
|
+
spec.version = SugoiSelectbox::Rails::VERSION
|
9
|
+
spec.authors = ["jiikko"]
|
10
|
+
spec.email = ["n905i.1214@gmail.com"]
|
11
|
+
spec.summary = %q{select boxes.}
|
12
|
+
spec.description = %q{jQuery based replacement for select boxes.}
|
13
|
+
spec.homepage = "https://github.com/jiikko/sugoi_selectbox-rails"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
@@ -0,0 +1,403 @@
|
|
1
|
+
(function ($) {
|
2
|
+
var KEY, ResultList, Select, Selectionm, Container, SearchField, HiddenField;
|
3
|
+
|
4
|
+
KEY = {
|
5
|
+
TAB: 9,
|
6
|
+
ENTER: 13,
|
7
|
+
ESC: 27,
|
8
|
+
SPACE: 32,
|
9
|
+
LEFT: 37,
|
10
|
+
UP: 38,
|
11
|
+
RIGHT: 39,
|
12
|
+
DOWN: 40,
|
13
|
+
SHIFT: 16,
|
14
|
+
CTRL: 17,
|
15
|
+
ALT: 18,
|
16
|
+
PAGE_UP: 33,
|
17
|
+
PAGE_DOWN: 34,
|
18
|
+
HOME: 36,
|
19
|
+
END: 35,
|
20
|
+
BACKSPACE: 8,
|
21
|
+
DELETE: 46
|
22
|
+
};
|
23
|
+
|
24
|
+
Container = new String +
|
25
|
+
"<div data-sugoi-selectbox>" +
|
26
|
+
"<div class='data-sugoi-selectbox-close' data-sugoi-selectbox-top>" +
|
27
|
+
"<span class=currentValue data-sugoi-selectbox-current-value></span>" +
|
28
|
+
"<b></b>" +
|
29
|
+
"</div>" +
|
30
|
+
"<div data-sugoi-selectbox-dropdown>" +
|
31
|
+
"<input type='text' autocomplete='off'>" +
|
32
|
+
"<div data-sugoi-selectbox-list></div>" +
|
33
|
+
"</div>" +
|
34
|
+
"<input type='hidden'>" +
|
35
|
+
"</div>";
|
36
|
+
|
37
|
+
Selection = {
|
38
|
+
init: function (select) {
|
39
|
+
var $container = select.$container;
|
40
|
+
var lists = function () {
|
41
|
+
return $container.find("li");
|
42
|
+
};
|
43
|
+
|
44
|
+
return {
|
45
|
+
isOver: function (relative_position) {
|
46
|
+
var next_position = this.getIndex() + relative_position;
|
47
|
+
if(
|
48
|
+
lists().length <= next_position ||
|
49
|
+
next_position < 0
|
50
|
+
) {
|
51
|
+
return true;
|
52
|
+
}
|
53
|
+
},
|
54
|
+
getIndex: function () {
|
55
|
+
var index;
|
56
|
+
lists().each(function (i, item) {
|
57
|
+
if($(item).hasClass("sugoi-highlight")) {
|
58
|
+
index = i;
|
59
|
+
}
|
60
|
+
})
|
61
|
+
return index;
|
62
|
+
},
|
63
|
+
move: function (relative_position) {
|
64
|
+
var current = this.getIndex() + relative_position;
|
65
|
+
var move_to_position = 0
|
66
|
+
if(current > 0) {
|
67
|
+
move_to_position = current;
|
68
|
+
}
|
69
|
+
this.set(move_to_position);
|
70
|
+
},
|
71
|
+
clear: function (index) {
|
72
|
+
lists().removeClass("sugoi-highlight");
|
73
|
+
},
|
74
|
+
get: function () {
|
75
|
+
return $(lists().get(this.getIndex()));
|
76
|
+
},
|
77
|
+
set: function (index) {
|
78
|
+
this.clear();
|
79
|
+
$activeList = $(lists().get(index));
|
80
|
+
$activeList.addClass("sugoi-highlight");
|
81
|
+
$(select.el).trigger("scrollToSelecting");
|
82
|
+
},
|
83
|
+
choose: function () {
|
84
|
+
if(this.getIndex() !== undefined) {
|
85
|
+
li = lists().get(this.getIndex());
|
86
|
+
li.click();
|
87
|
+
}
|
88
|
+
},
|
89
|
+
setDefault: function () {
|
90
|
+
if($(lists()[0]).data("role") === "blank") {
|
91
|
+
return;
|
92
|
+
}
|
93
|
+
|
94
|
+
var currentvalue = $container.find("span");
|
95
|
+
var isFinded;
|
96
|
+
if(currentvalue) {
|
97
|
+
lists().each(function (i, item) {
|
98
|
+
if(currentvalue.attr("data-id") === $(item).attr("data-id")) {
|
99
|
+
select.selection.set(i);
|
100
|
+
isFinded = true;
|
101
|
+
return false;
|
102
|
+
}
|
103
|
+
});
|
104
|
+
if(!isFinded) { this.set(0); }
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
HiddenField = {
|
112
|
+
init: function (select) {
|
113
|
+
var $container = select.$container;
|
114
|
+
var $hiddenField = $container.find("input[type=hidden]");
|
115
|
+
$hiddenField.attr("name", select.el.attr("name"));
|
116
|
+
|
117
|
+
var _set = function () {
|
118
|
+
$container.find("input[type=hidden]").val(
|
119
|
+
$container.find("[data-sugoi-selectbox-current-value]").attr("data-id")
|
120
|
+
);
|
121
|
+
};
|
122
|
+
_set();
|
123
|
+
|
124
|
+
return {
|
125
|
+
set: function () {
|
126
|
+
_set();
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
SearchField = {
|
133
|
+
init: function (select, resultList) {
|
134
|
+
var $container = select.$container;
|
135
|
+
|
136
|
+
$container.find("input").on("keyup", function (e) {
|
137
|
+
if (
|
138
|
+
e.which >= 48 ||
|
139
|
+
e.which === KEY.SPACE ||
|
140
|
+
e.which === KEY.BACKSPACE ||
|
141
|
+
e.which === KEY.DELETE ||
|
142
|
+
e.which === KEY.ENTER ||
|
143
|
+
e.which === KEY.LEFT ||
|
144
|
+
e.which === KEY.RIGHT
|
145
|
+
) {
|
146
|
+
resultList.update();
|
147
|
+
}
|
148
|
+
});
|
149
|
+
|
150
|
+
$container.find("input").on("keydown", function (e) {
|
151
|
+
switch (e.which) {
|
152
|
+
case KEY.TAB:
|
153
|
+
select.selection.choose();
|
154
|
+
return;
|
155
|
+
case KEY.ENTER:
|
156
|
+
e.preventDefault();
|
157
|
+
select.selection.choose();
|
158
|
+
return;
|
159
|
+
case KEY.UP:
|
160
|
+
if(select.selection.isOver(-1)) { return; }
|
161
|
+
select.selection.move(-1);
|
162
|
+
return;
|
163
|
+
case KEY.DOWN:
|
164
|
+
if(select.selection.isOver(1)) { return; }
|
165
|
+
select.selection.move(1);
|
166
|
+
return;
|
167
|
+
case KEY.ESC:
|
168
|
+
$(select.el).trigger("canceled");
|
169
|
+
return;
|
170
|
+
};
|
171
|
+
});
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
ResultList = {
|
176
|
+
init: function (select) {
|
177
|
+
var self = this;
|
178
|
+
var lists = [];
|
179
|
+
var currentIndex = 0;
|
180
|
+
var $container = select.$container;
|
181
|
+
var add = function (obj) {
|
182
|
+
var $li = $("<li>");
|
183
|
+
$li.html(obj.name);
|
184
|
+
$li.attr("data-role", "clickable");
|
185
|
+
$li.attr("data-id", obj["data-id"]);
|
186
|
+
list.push($li);
|
187
|
+
};
|
188
|
+
|
189
|
+
$container.on("click", "li", function (e) {
|
190
|
+
console.log("clicked");
|
191
|
+
|
192
|
+
if($(list[0]).data("role") === "blank") {
|
193
|
+
return;
|
194
|
+
}
|
195
|
+
|
196
|
+
$listItem = $(e.target)
|
197
|
+
$listItem.remove();
|
198
|
+
select.display.show($listItem);
|
199
|
+
select.el.trigger('clickedList');
|
200
|
+
});
|
201
|
+
|
202
|
+
$container.on("mouseenter", "li[data-role=clickable]", function (e) {
|
203
|
+
var self = this;
|
204
|
+
$container.find("li").each(function (i, item) {
|
205
|
+
if(self == item) {
|
206
|
+
select.selection.set(i);
|
207
|
+
return;
|
208
|
+
}
|
209
|
+
});
|
210
|
+
}).on("mouseleave", "li", function (e) {
|
211
|
+
select.selection.clear();
|
212
|
+
});
|
213
|
+
|
214
|
+
return {
|
215
|
+
htmledLists: function() {
|
216
|
+
var $ul = $("<ul>");
|
217
|
+
$.each(list, function(i, item){
|
218
|
+
$ul.append(item);
|
219
|
+
});
|
220
|
+
if(list.length == 0) {
|
221
|
+
var $li = $("<li>");
|
222
|
+
$li.attr("data-role", "blank");
|
223
|
+
$li.html("No matches found");
|
224
|
+
list.push($li);
|
225
|
+
$ul.append($li);
|
226
|
+
}
|
227
|
+
return $ul;
|
228
|
+
},
|
229
|
+
clear: function () {
|
230
|
+
list = [];
|
231
|
+
},
|
232
|
+
result: function () {
|
233
|
+
return $container.find("ul");
|
234
|
+
},
|
235
|
+
update: function () {
|
236
|
+
var query = $container.find("input").val();
|
237
|
+
this.createList(query);
|
238
|
+
select.selection.setDefault();
|
239
|
+
},
|
240
|
+
initSearchField: function () {
|
241
|
+
return SearchField.init(select, this);
|
242
|
+
},
|
243
|
+
createList: function (query) {
|
244
|
+
this.clear();
|
245
|
+
$container.find("[data-sugoi-selectbox-list] ul").remove();
|
246
|
+
$.each(select.el.find("option"), function () {
|
247
|
+
$li = $(this);
|
248
|
+
if($li.html() === '') { return true; }
|
249
|
+
if((new RegExp(query)).test($li.html())) {
|
250
|
+
add(
|
251
|
+
{ "data-id": $li.val(), "name": $li.html() }
|
252
|
+
);
|
253
|
+
}
|
254
|
+
});
|
255
|
+
$container.find("[data-sugoi-selectbox-list]").append(
|
256
|
+
this.htmledLists()
|
257
|
+
);
|
258
|
+
},
|
259
|
+
scrollToSelecting: function (selection) {
|
260
|
+
var listYWithAmariY = selection.get().offset().top + selection.get().outerHeight();
|
261
|
+
var listY = this.result().offset().top + this.result().outerHeight();
|
262
|
+
var amriY = listYWithAmariY - listY;
|
263
|
+
|
264
|
+
// down
|
265
|
+
if(amriY > 0) {
|
266
|
+
this.result().scrollTop(
|
267
|
+
this.result().scrollTop() + amriY
|
268
|
+
);
|
269
|
+
}
|
270
|
+
|
271
|
+
// up
|
272
|
+
var y = selection.get().offset().top - this.result().offset().top;
|
273
|
+
if(y < 0) {
|
274
|
+
this.result().scrollTop(
|
275
|
+
this.result().scrollTop() + y
|
276
|
+
);
|
277
|
+
}
|
278
|
+
},
|
279
|
+
}
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
var Display = {
|
284
|
+
init: function (select) {
|
285
|
+
var $container = select.$container;
|
286
|
+
var $selectedValue = $container.find("[data-sugoi-selectbox-current-value]");
|
287
|
+
var selectorEscape = function (val) {
|
288
|
+
return val.replace(/[ !"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~]/g, '\\$&');
|
289
|
+
};
|
290
|
+
|
291
|
+
(function () {
|
292
|
+
var id = select.el.find("option:selected").val();
|
293
|
+
if(id) {
|
294
|
+
var name = select.$container.find("li[data-id=" + selectorEscape(id) + "]").html();
|
295
|
+
$selectedValue.html(name);
|
296
|
+
$selectedValue.attr("data-id", id);
|
297
|
+
} else {
|
298
|
+
$selectedValue.html('未選択');
|
299
|
+
}
|
300
|
+
})();
|
301
|
+
|
302
|
+
(function () {
|
303
|
+
var width = select.el.outerWidth();
|
304
|
+
var height = select.el.outerHeight();
|
305
|
+
$container.find("[data-sugoi-selectbox]").css({ "width": width });
|
306
|
+
$container.css({ 'height': height });
|
307
|
+
})();
|
308
|
+
|
309
|
+
return {
|
310
|
+
show: function (node) {
|
311
|
+
var $node = $(node);
|
312
|
+
$selectedValue.html($node.html());
|
313
|
+
$selectedValue.attr("data-id", $node.attr("data-id"));
|
314
|
+
select.dropdown.createList();
|
315
|
+
select.hiddenField.set();
|
316
|
+
}
|
317
|
+
}
|
318
|
+
}
|
319
|
+
};
|
320
|
+
|
321
|
+
var DropDown = {
|
322
|
+
init: function (select){ // draw
|
323
|
+
var $el = $(select.el);
|
324
|
+
var $container = select.$container;
|
325
|
+
var $dropdown_div = $container.find("[data-sugoi-selectbox-dropdown]");
|
326
|
+
select.resultList.initSearchField();
|
327
|
+
|
328
|
+
$container.find("[data-sugoi-selectbox-top]").on("click", function () {
|
329
|
+
$(select.el).trigger('clickedList');
|
330
|
+
});
|
331
|
+
select.resultList.createList();
|
332
|
+
|
333
|
+
var isOpen = function () {
|
334
|
+
return $dropdown_div.is(':visible');
|
335
|
+
};
|
336
|
+
|
337
|
+
(function () {
|
338
|
+
var isHover = true;
|
339
|
+
$(select.$container).hover(function () {
|
340
|
+
isHover = true;
|
341
|
+
}, function () {
|
342
|
+
isHover = false;
|
343
|
+
});
|
344
|
+
$(document).on('mouseup', function () {
|
345
|
+
if(!isHover && isOpen()) {
|
346
|
+
$(select.el).trigger("canceled");
|
347
|
+
}
|
348
|
+
});
|
349
|
+
})();
|
350
|
+
|
351
|
+
return {
|
352
|
+
createList: function () {
|
353
|
+
select.resultList.createList();
|
354
|
+
},
|
355
|
+
toggle: function () {
|
356
|
+
var topNode = $container.find("[data-sugoi-selectbox-top]");
|
357
|
+
$dropdown_div.toggle();
|
358
|
+
if(isOpen()) {
|
359
|
+
select.selection.setDefault();
|
360
|
+
select.resultList.update();
|
361
|
+
$dropdown_div.find("input").select();
|
362
|
+
topNode.removeClass("data-sugoi-selectbox-close");
|
363
|
+
} else {
|
364
|
+
topNode.addClass("data-sugoi-selectbox-close");
|
365
|
+
}
|
366
|
+
}
|
367
|
+
}
|
368
|
+
}
|
369
|
+
};
|
370
|
+
|
371
|
+
// あとで名前をかえる
|
372
|
+
Select = {
|
373
|
+
init: function (el) {
|
374
|
+
this.el = $(el);
|
375
|
+
this.el.after(
|
376
|
+
// wrap for height. css no position is yokuwakrann.
|
377
|
+
$("<div>").html(Container)
|
378
|
+
);
|
379
|
+
this.$container = $(this.el.next());
|
380
|
+
this.selection = Selection.init(this);
|
381
|
+
this.resultList = ResultList.init(this);
|
382
|
+
this.dropdown = DropDown.init(this);
|
383
|
+
this.display = Display.init(this);
|
384
|
+
this.hiddenField = HiddenField.init(this); // list構築後に実行する必要あり
|
385
|
+
this.el.hide();
|
386
|
+
|
387
|
+
var self = this;
|
388
|
+
this.el.on('clickedList canceled', this.el, function () {
|
389
|
+
console.log("clickedlist or canceled");
|
390
|
+
self.dropdown.toggle();
|
391
|
+
});
|
392
|
+
this.dropdown.toggle();
|
393
|
+
|
394
|
+
this.el.on('scrollToSelecting', this.el, function () {
|
395
|
+
self.resultList.scrollToSelecting(self.selection);
|
396
|
+
});
|
397
|
+
}
|
398
|
+
};
|
399
|
+
|
400
|
+
$.fn.suguiSelectbox = function () {
|
401
|
+
Select.init(this);
|
402
|
+
};
|
403
|
+
}(jQuery));
|
@@ -0,0 +1,56 @@
|
|
1
|
+
[data-sugoi-selectbox] {
|
2
|
+
border: 1px solid #ccc;
|
3
|
+
margin: 2px;
|
4
|
+
padding-left: 5px;
|
5
|
+
background: #fff;
|
6
|
+
z-index: 999;
|
7
|
+
position: absolute;
|
8
|
+
}
|
9
|
+
|
10
|
+
[data-sugoi-selectbox] input {
|
11
|
+
outline: 0;
|
12
|
+
margin-bottom: 5px;
|
13
|
+
}
|
14
|
+
|
15
|
+
[data-sugoi-selectbox-top] {
|
16
|
+
display: table;
|
17
|
+
width: 100%;
|
18
|
+
cursor: pointer;
|
19
|
+
}
|
20
|
+
|
21
|
+
[data-sugoi-selectbox-top] [data-sugoi-selectbox-current-value] {
|
22
|
+
display: table-cell;
|
23
|
+
width: `100%;
|
24
|
+
}
|
25
|
+
|
26
|
+
.data-sugoi-selectbox-close[data-sugoi-selectbox-top] b {
|
27
|
+
display: table-cell;
|
28
|
+
background: #ccc;
|
29
|
+
height: 100%;
|
30
|
+
width: 20px;
|
31
|
+
}
|
32
|
+
|
33
|
+
[data-sugoi-selectbox-dropdown] {
|
34
|
+
z-index: 1000;
|
35
|
+
}
|
36
|
+
|
37
|
+
[data-sugoi-selectbox-current-value] {
|
38
|
+
display: block;
|
39
|
+
}
|
40
|
+
|
41
|
+
[data-sugoi-selectbox-list] ul {
|
42
|
+
max-height: 300px;
|
43
|
+
padding: 0px;
|
44
|
+
margin: 0px;
|
45
|
+
overflow-y: auto;
|
46
|
+
}
|
47
|
+
|
48
|
+
[data-sugoi-selectbox-list] li {
|
49
|
+
list-style-type: none;
|
50
|
+
cursor: pointer;
|
51
|
+
}
|
52
|
+
|
53
|
+
.sugoi-highlight {
|
54
|
+
background: #3875d7;
|
55
|
+
color: white;
|
56
|
+
}
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sugoi_selectbox-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- jiikko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
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: jQuery based replacement for select boxes.
|
56
|
+
email:
|
57
|
+
- n905i.1214@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- lib/sugoi_selectbox/rails.rb
|
68
|
+
- lib/sugoi_selectbox/rails/engine.rb
|
69
|
+
- lib/sugoi_selectbox/rails/version.rb
|
70
|
+
- spec/spec_helper.rb
|
71
|
+
- spec/sugoi_selectbox/rails_spec.rb
|
72
|
+
- sugoi_selectbox-rails.gemspec
|
73
|
+
- vendor/assets/javascripts/sugoi_selectbox.js
|
74
|
+
- vendor/assets/stylesheets/sugoi_selectbox.css
|
75
|
+
homepage: https://github.com/jiikko/sugoi_selectbox-rails
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.4.5
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: select boxes.
|
99
|
+
test_files:
|
100
|
+
- spec/spec_helper.rb
|
101
|
+
- spec/sugoi_selectbox/rails_spec.rb
|