trln-chosen-rails 1.30.0.pre.beta → 1.30.0.pre.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -32
- data/lib/chosen-rails/source_file.rb +2 -7
- data/lib/chosen-rails/version.rb +1 -1
- data/trln-chosen-rails.gemspec +6 -5
- data/vendor/assets/javascripts/chosen.jquery.js +616 -0
- data/vendor/assets/javascripts/chosen.proto.js +650 -0
- data/vendor/assets/javascripts/lib/abstract-chosen.js +467 -0
- data/vendor/assets/javascripts/lib/select-parser.js +76 -0
- data/vendor/assets/stylesheets/chosen-base.scss +427 -0
- metadata +43 -32
- data/vendor/assets/javascripts/chosen.jquery.coffee +0 -513
- data/vendor/assets/javascripts/chosen.proto.coffee +0 -523
- data/vendor/assets/javascripts/lib/abstract-chosen.coffee +0 -384
- data/vendor/assets/javascripts/lib/select-parser.coffee +0 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebfd2fd1bca648c424faa4b52323727e26424c05b10d2584208a93adffaa6617
|
4
|
+
data.tar.gz: e2828b44f0394b987d0061728c265bf0005ba4c4412764d8e29fa6a77c04cb0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45374709edbfd144b2e653679f03af29a94f7548f0b1b48704b109a173d3c08a6d8a5d59ac08826746a60959bdab6e89a31bf11f0549167b72de6a87bfb55255
|
7
|
+
data.tar.gz: 95bb7f0c81a74827e1bcb28cc773747ef762ddb1112a7a6e3ef94b1492e70eeb0e6f6697746ea5b02dcd23410bec6d450973fc414210b53b004ae2ff79436ab1
|
data/README.md
CHANGED
@@ -2,7 +2,15 @@
|
|
2
2
|
|
3
3
|
[Chosen](https://github.com/harvesthq/chosen) is a library for making long, unwieldy select boxes more user friendly.
|
4
4
|
|
5
|
-
The `trln-chosen-rails` gem
|
5
|
+
The `trln-chosen-rails` gem is a fork of the original `chosen-rails`
|
6
|
+
gem and integrates the `Chosen` with the Rails asset pipeline. This fork removes dependencies on `coffee-rails` and on any particular Sass implementation (the original had a dependency on `sassc-rails`).
|
7
|
+
|
8
|
+
One tradeoff is that the version of the `chosen` library is frozen at version 1.8.7.
|
9
|
+
|
10
|
+
To make full use of this gem you will need to either add a Sass compilation
|
11
|
+
step to your asset handling or compile the bundled
|
12
|
+
`vendor/assets/stylesheets/chosen-base.scss` file you can find in this gem's
|
13
|
+
directory and add that to your Rails application's `assets/stylesheets` directory. Since the TRLN Blacklight implementations all employ the use of Sass, this should be unnecessary for members of the consortium.
|
6
14
|
|
7
15
|
## Usage
|
8
16
|
|
@@ -20,8 +28,6 @@ Then run `bundle install`
|
|
20
28
|
|
21
29
|
You can get jquery via [jquery-rails](https://github.com/rails/jquery-rails).
|
22
30
|
|
23
|
-
Please consider [jquery-turbolinks](https://github.com/kossnocorp/jquery.turbolinks) if you have turbolinks issues for Rails 4 +.
|
24
|
-
|
25
31
|
### Include chosen javascript assets
|
26
32
|
|
27
33
|
Add to your `app/assets/javascripts/application.js` if use with jQuery
|
@@ -31,13 +37,6 @@ Add to your `app/assets/javascripts/application.js` if use with jQuery
|
|
31
37
|
//= require chosen-jquery
|
32
38
|
```
|
33
39
|
|
34
|
-
Or with Prototype
|
35
|
-
|
36
|
-
```coffee
|
37
|
-
//= require jquery
|
38
|
-
//= require chosen-prototype
|
39
|
-
```
|
40
|
-
|
41
40
|
### Include chosen stylesheet assets
|
42
41
|
|
43
42
|
Add to your `app/assets/stylesheets/application.css`
|
@@ -54,27 +53,7 @@ For rails 6, remember to add `javascript_include_tag` in `app/views/layouts/appl
|
|
54
53
|
<%= javascript_include_tag 'application' %>
|
55
54
|
```
|
56
55
|
|
57
|
-
Add
|
58
|
-
|
59
|
-
```coffee
|
60
|
-
$ ->
|
61
|
-
# enable chosen js
|
62
|
-
$('.chosen-select').chosen
|
63
|
-
allow_single_deselect: true
|
64
|
-
no_results_text: 'No results matched'
|
65
|
-
width: '200px'
|
66
|
-
```
|
67
|
-
|
68
|
-
Notice: `width` option is required since `Chosen 0.9.15`.
|
69
|
-
|
70
|
-
And this file must be included in `application.js`
|
71
|
-
|
72
|
-
```coffee
|
73
|
-
//= require chosen-jquery
|
74
|
-
//= require scaffold
|
75
|
-
```
|
76
|
-
|
77
|
-
Also add the class to your form field
|
56
|
+
Add the class to your form field
|
78
57
|
|
79
58
|
```erb
|
80
59
|
<%= f.select :author,
|
@@ -96,7 +75,7 @@ If you use simple form as form builder
|
|
96
75
|
|
97
76
|
### Deployment
|
98
77
|
|
99
|
-
|
78
|
+
Non-digested assets of `trln-chosen-rails` will simply be copied from digested assets.
|
100
79
|
|
101
80
|
## RSpec helpers
|
102
81
|
`chosen-rails` provides RSpec feature helper methods that allow users to select or unselect options from both single and multiple chosen elements. Add the following to your `spec/rails_helper.rb` (or `spec/spec_helper.rb`):
|
@@ -10,10 +10,6 @@ class SourceFile < Thor
|
|
10
10
|
get "#{remote}/raw/#{branch}/public/chosen-sprite.png", 'images/chosen-sprite.png'
|
11
11
|
get "#{remote}/raw/#{branch}/public/chosen-sprite@2x.png", 'images/chosen-sprite@2x.png'
|
12
12
|
get "#{remote}/raw/#{branch}/sass/chosen.scss", 'stylesheets/chosen-base.scss'
|
13
|
-
get "#{remote}/raw/#{branch}/coffee/lib/abstract-chosen.coffee", 'javascripts/lib/abstract-chosen.coffee'
|
14
|
-
get "#{remote}/raw/#{branch}/coffee/lib/select-parser.coffee", 'javascripts/lib/select-parser.coffee'
|
15
|
-
get "#{remote}/raw/#{branch}/coffee/chosen.jquery.coffee", 'javascripts/chosen.jquery.coffee'
|
16
|
-
get "#{remote}/raw/#{branch}/coffee/chosen.proto.coffee", 'javascripts/chosen.proto.coffee'
|
17
13
|
get "#{remote}/raw/#{branch}/package.json", 'package.json'
|
18
14
|
bump_version
|
19
15
|
end
|
@@ -21,11 +17,10 @@ class SourceFile < Thor
|
|
21
17
|
desc 'eject class from closure', 'eject javascript library class from closure'
|
22
18
|
def eject_javascript_class_from_closure
|
23
19
|
self.destination_root = 'vendor/assets'
|
24
|
-
|
25
|
-
append_to_file 'javascripts/lib/abstract-chosen.coffee' do
|
20
|
+
append_to_file 'javascripts/lib/abstract-chosen.js' do
|
26
21
|
"\nwindow.AbstractChosen = AbstractChosen\n"
|
27
22
|
end
|
28
|
-
append_to_file 'javascripts/lib/select-parser.
|
23
|
+
append_to_file 'javascripts/lib/select-parser.js' do
|
29
24
|
"\n\nwindow.SelectParser = SelectParser\n"
|
30
25
|
end
|
31
26
|
end
|
data/lib/chosen-rails/version.rb
CHANGED
data/trln-chosen-rails.gemspec
CHANGED
@@ -13,12 +13,13 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
14
|
gem.name = 'trln-chosen-rails'
|
15
15
|
gem.require_paths = ['lib']
|
16
|
+
gem.required_ruby_version = '>= 3.0'
|
16
17
|
gem.version = Chosen::Rails::VERSION
|
17
18
|
gem.license = 'MIT'
|
18
19
|
|
19
|
-
gem.add_dependency 'railties', '>=
|
20
|
-
gem.add_dependency 'coffee-rails', '>= 3.2'
|
21
|
-
gem.add_development_dependency 'bundler', '>=
|
22
|
-
gem.add_development_dependency 'rails', '>=
|
23
|
-
gem.add_development_dependency 'thor', '>= 0.14'
|
20
|
+
gem.add_dependency 'railties', '>= 6.0', '< 8'
|
21
|
+
#gem.add_dependency 'coffee-rails', '>= 3.2'
|
22
|
+
gem.add_development_dependency 'bundler', '>= 2.0', '< 3'
|
23
|
+
gem.add_development_dependency 'rails', '>= 6.0', '< 8'
|
24
|
+
gem.add_development_dependency 'thor', '>= 0.14', '< 2'
|
24
25
|
end
|