chosen-awesome-rails 1.1.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 753b8b56b10d8afabb1b00e40537ce896906728f
|
4
|
+
data.tar.gz: 6a12cdd3920ce72b0c343445397ae463dda8b098
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f08674691cb3adc8ee5206ce8d25085b994c9b7598b5330f3bf4e7a8d01ea562f12c0efdf537ef6d31f85da114ab7e7362be77161b81563fffe36463182c2909
|
7
|
+
data.tar.gz: 5d705d50f2263136a0307bbe5644946366c618235fc46db7e39786ae8b06721e36dc85f5a3be9635a7bf1089d73afb8ecf3e64e72580475b7d60326131d0481d
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: chosen-awesome-rails 1.0
|
2
|
+
# stub: chosen-awesome-rails 1.2.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "chosen-awesome-rails".freeze
|
6
|
-
s.version = "1.1
|
6
|
+
s.version = "1.2.1"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["heaven".freeze]
|
11
|
-
s.date = "
|
11
|
+
s.date = "2017-09-01"
|
12
12
|
s.description = "Chosen is a javascript library of select box enhancer for jQuery, integrates with Rails asset pipeline for ease of use.".freeze
|
13
13
|
s.email = ["alex@codeart.pw".freeze]
|
14
14
|
s.files = [".gitignore".freeze, "Gemfile".freeze, "Gemfile.lock".freeze, "LICENSE.txt".freeze, "README.md".freeze, "Rakefile".freeze, "chosen-awesome-rails.gemspec".freeze, "lib/chosen-awesome-rails.rb".freeze, "lib/chosen-awesome-rails/engine.rb".freeze, "lib/chosen-awesome-rails/engine3.rb".freeze, "lib/chosen-awesome-rails/version.rb".freeze, "vendor/assets/images/chosen-arrow.gif".freeze, "vendor/assets/javascripts/chosen.coffee".freeze, "vendor/assets/javascripts/chosen/chosen.coffee".freeze, "vendor/assets/javascripts/chosen/multiple.coffee".freeze, "vendor/assets/javascripts/chosen/parser.coffee".freeze, "vendor/assets/javascripts/chosen/single.coffee".freeze, "vendor/assets/stylesheets/chosen.scss".freeze, "vendor/assets/stylesheets/chosen/_bootstrap2.scss".freeze, "vendor/assets/stylesheets/chosen/_bootstrap3.scss".freeze, "vendor/assets/stylesheets/chosen/_default.scss".freeze]
|
@@ -53,23 +53,28 @@ class Chosen
|
|
53
53
|
Chosen.pool.splice(index, 1) if index >= 0
|
54
54
|
|
55
55
|
build: ->
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
# TODO: improve iOS support
|
57
|
+
# * don't pass focus to the search field when clicked (avoid virtual keyboard)
|
58
|
+
# * add "tap for search" placeholder when dropdown is shown
|
59
|
+
# * add "done" button next to the search field so iOS users can hide the virtual keyboard
|
60
|
+
is_ios = Chosen.is_ios()
|
61
|
+
container_classes = ["chosen-container"]
|
62
|
+
|
63
|
+
container_classes.push "ios" if is_ios
|
64
|
+
container_classes.push if @is_multiple then "multiple" else "single"
|
65
|
+
container_classes.push "rtl" if @is_rtl
|
66
|
+
container_classes.push @target.className if @inherit_classes and @target.className
|
61
67
|
|
62
68
|
container_props =
|
63
|
-
class:
|
69
|
+
class: container_classes.join ' '
|
64
70
|
css: if @width then { width: @width } else @getCSSProperties(@target, ["width", "min-width", "max-width"])
|
65
71
|
|
66
72
|
@$target.addClass("chosen")
|
73
|
+
@$target.addClass("ios") if is_ios
|
67
74
|
|
68
75
|
attrs = @getCSSProperties(@target, ["height"])
|
69
76
|
|
70
|
-
if attrs.height
|
71
|
-
container_props.css['min-height'] = attrs.height
|
72
|
-
|
77
|
+
container_props.css['min-height'] = attrs.height if attrs.height
|
73
78
|
container_props.title = @target.title if @target.title.length
|
74
79
|
container_props.id = @target.id.replace(/[^\w]/g, '-') + "-chosen" if @target.id
|
75
80
|
|
@@ -83,12 +88,6 @@ class Chosen
|
|
83
88
|
input_attrs["data-required"] = @target.required
|
84
89
|
@target.required = false
|
85
90
|
|
86
|
-
@$container = $("<div />", container_props)
|
87
|
-
@$container.html "<ul class=\"chosen-choices\"><li class=\"chosen-search-field\"><input type=\"text\" /></li></ul>"
|
88
|
-
@$container.$choices = @$container.find("ul.chosen-choices")
|
89
|
-
@$container.$search_container = @$container.$choices.find("li.chosen-search-field")
|
90
|
-
@$container.$search = @$container.$choices.find("input[type=text]").attr(input_attrs)
|
91
|
-
|
92
91
|
dropdown_classes = ["chosen-dropdown"]
|
93
92
|
|
94
93
|
dropdown_classes.push if @is_multiple then "multiple" else "single"
|
@@ -99,6 +98,12 @@ class Chosen
|
|
99
98
|
unselectable: "on"
|
100
99
|
html: "<ul></ul>"
|
101
100
|
|
101
|
+
@$container = $("<div />", container_props)
|
102
|
+
@$container.html "<ul class=\"chosen-choices\"><li class=\"chosen-search-field\"><input type=\"text\" /></li></ul>"
|
103
|
+
@$container.$choices = @$container.find("ul.chosen-choices")
|
104
|
+
@$container.$search_container = @$container.$choices.find("li.chosen-search-field")
|
105
|
+
@$container.$search = @$container.$choices.find("input[type=text]").attr(input_attrs)
|
106
|
+
|
102
107
|
@$dropdown = $("<div />", dropdown_props)
|
103
108
|
@$dropdown.$list = @$dropdown.find("ul").first()
|
104
109
|
@$dropdown.$list.$no_results = $("<li />", class: "chosen-noresults")
|
@@ -560,8 +565,11 @@ class Chosen
|
|
560
565
|
|
561
566
|
return @
|
562
567
|
|
568
|
+
@is_ios: ->
|
569
|
+
/iPad|iPhone|iPod/.test(navigator.userAgent) and not window.MSStream
|
570
|
+
|
563
571
|
@is_crappy_browser: (version) ->
|
564
|
-
window.navigator.appName
|
572
|
+
window.navigator.appName is "Microsoft Internet Explorer" and document.documentMode <= version
|
565
573
|
|
566
574
|
@is_supported: ->
|
567
575
|
not Chosen.is_crappy_browser(6)
|
@@ -20,7 +20,7 @@ $placeholder_color: #989898 !default;
|
|
20
20
|
$icon_delete_color: #777 !default;
|
21
21
|
$icon_delete_color_hover: #333 !default;
|
22
22
|
|
23
|
-
.chosen {
|
23
|
+
.chosen:not(.ios) {
|
24
24
|
display: none !important;
|
25
25
|
}
|
26
26
|
|
@@ -36,6 +36,10 @@ $icon_delete_color_hover: #333 !default;
|
|
36
36
|
background-color: $background_color_default;
|
37
37
|
zoom: 1;
|
38
38
|
|
39
|
+
&.ios {
|
40
|
+
display: none !important;
|
41
|
+
}
|
42
|
+
|
39
43
|
a.chosen-delete {
|
40
44
|
padding: 0 5px;
|
41
45
|
margin: 0;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chosen-awesome-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- heaven
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|