chosen-dartsass 2.0.0 → 2.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 +4 -4
- data/README.md +4 -4
- data/Rakefile +4 -6
- data/chosen-dartsass.gemspec +1 -2
- data/lib/chosen-dartsass/engine.rb +0 -4
- data/lib/chosen-dartsass/source_file.rb +12 -72
- data/lib/chosen-dartsass/version.rb +2 -2
- data/vendor/assets/javascripts/chosen-jquery.js +3598 -838
- data/vendor/assets/javascripts/chosen-prototype.js +3956 -1187
- data/vendor/assets/stylesheets/chosen.scss +853 -390
- metadata +3 -26
- data/lib/assets/javascripts/chosen.jquery.coffee +0 -513
- data/lib/assets/javascripts/chosen.proto.coffee +0 -523
- data/lib/assets/javascripts/lib/abstract-chosen.coffee +0 -384
- data/lib/assets/javascripts/lib/select-parser.coffee +0 -56
- data/vendor/assets/images/chosen-sprite.png +0 -0
- data/vendor/assets/images/chosen-sprite@2x.png +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 021c2a20279e7208f669f5683fdd42a2d4eccec85cd98b2444a93928c2468011
|
|
4
|
+
data.tar.gz: '0318a4ab5a788c5981c786b33fbb6f6e6cc641d75db714ed4c0725bfbb75860e'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9204bca5a85eccf27f28a9965e57245746eb4895ed997f83f348602afd7694f5584cc56bad93d1cf6a81c6407d7b70adcf6ac01f95ddd35941c5985f29a3d0db
|
|
7
|
+
data.tar.gz: 10c4a1eef1e29383614951c0accec5c82843b51eb0971dd2590723c5ccef9d78da25a3a2e3662116a46e349a097a96fcb2328484be84c442d0435836f6575539
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Chosen for rails asset pipeline
|
|
2
2
|
|
|
3
|
-
[Chosen](https://github.com/
|
|
3
|
+
[Chosen](https://github.com/JJJ/chosen) is a library for making long, unwieldy select boxes more user friendly. This gem packages the actively maintained `chosen-jjj` fork.
|
|
4
4
|
|
|
5
5
|
The `chosen-dartsass` gem integrates the `Chosen` into Rails asset pipeline with the [propshaft](https://github.com/rails/propshaft), using [dartsass-rails](https://github.com/rails/dartsass-rails).
|
|
6
6
|
|
|
@@ -27,7 +27,7 @@ Please consider [jquery-turbolinks](https://github.com/kossnocorp/jquery.turboli
|
|
|
27
27
|
|
|
28
28
|
Add to your `app/assets/javascripts/application.js` if use with jQuery
|
|
29
29
|
|
|
30
|
-
```
|
|
30
|
+
```javascript
|
|
31
31
|
//= require jquery
|
|
32
32
|
//= require chosen-jquery
|
|
33
33
|
```
|
|
@@ -65,7 +65,7 @@ Notice: `width` option is required since `Chosen 0.9.15`.
|
|
|
65
65
|
|
|
66
66
|
And this file must be included in `application.js`
|
|
67
67
|
|
|
68
|
-
```
|
|
68
|
+
```javascript
|
|
69
69
|
//= require chosen-jquery
|
|
70
70
|
//= require scaffold
|
|
71
71
|
```
|
|
@@ -143,7 +143,7 @@ chosen_unselect('Leo Tolstoy', from: '#authors')
|
|
|
143
143
|
|
|
144
144
|
Maintain `chosen-dartsass` gem with `Rake` commands.
|
|
145
145
|
|
|
146
|
-
Update
|
|
146
|
+
Update the chosen-jjj source files.
|
|
147
147
|
|
|
148
148
|
```bash
|
|
149
149
|
rake update-chosen
|
data/Rakefile
CHANGED
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
require 'bundler/gem_tasks'
|
|
3
3
|
require File.expand_path('../lib/chosen-dartsass/source_file', __FILE__)
|
|
4
4
|
|
|
5
|
-
desc "Update with
|
|
5
|
+
desc "Update with the chosen-jjj library"
|
|
6
6
|
task 'update-chosen', 'repository_url', 'branch' do |task, args|
|
|
7
|
-
remote = args['repository_url'] || 'https://github.com/
|
|
8
|
-
branch = args['branch'] || '
|
|
7
|
+
remote = args['repository_url'] || 'https://github.com/JJJ/chosen'
|
|
8
|
+
branch = args['branch'] || 'master'
|
|
9
9
|
files = SourceFile.new
|
|
10
|
-
|
|
11
|
-
#files.eject_javascript_class_from_closure
|
|
12
|
-
files.generate_js
|
|
10
|
+
files.fetch remote, branch
|
|
13
11
|
files.cleanup
|
|
14
12
|
end
|
data/chosen-dartsass.gemspec
CHANGED
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
|
|
|
9
9
|
gem.homepage = 'https://github.com/activescaffold/chosen-dartsass'
|
|
10
10
|
|
|
11
11
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
12
|
-
gem.files = `git ls-files`.split("\n")
|
|
12
|
+
gem.files = `git ls-files`.split("\n").select { |file| File.file?(file) }
|
|
13
13
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
14
14
|
gem.name = 'chosen-dartsass'
|
|
15
15
|
gem.require_paths = ['lib']
|
|
@@ -22,5 +22,4 @@ Gem::Specification.new do |gem|
|
|
|
22
22
|
gem.add_development_dependency 'bundler', '>= 1.0'
|
|
23
23
|
gem.add_development_dependency 'rails', '>= 7.0'
|
|
24
24
|
gem.add_development_dependency 'thor', '>= 0.14'
|
|
25
|
-
gem.add_development_dependency 'coffee-rails', '>= 3.2'
|
|
26
25
|
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
require 'thor'
|
|
2
2
|
require 'json'
|
|
3
|
-
require 'coffee-script'
|
|
4
3
|
|
|
5
4
|
class SourceFile < Thor
|
|
6
5
|
include Thor::Actions
|
|
@@ -8,86 +7,27 @@ class SourceFile < Thor
|
|
|
8
7
|
desc 'fetch source files', 'fetch source files from GitHub'
|
|
9
8
|
def fetch remote, branch
|
|
10
9
|
say "get from #{remote}/raw/#{branch}"
|
|
11
|
-
get "#{remote}/raw/#{branch}/
|
|
12
|
-
get "#{remote}/raw/#{branch}/
|
|
13
|
-
get "#{remote}/raw/#{branch}/
|
|
14
|
-
get "#{remote}/raw/#{branch}/
|
|
15
|
-
get "#{remote}/raw/#{branch}/coffee/lib/select-parser.coffee", 'lib/assets/javascripts/lib/select-parser.coffee'
|
|
16
|
-
get "#{remote}/raw/#{branch}/coffee/chosen.jquery.coffee", 'lib/assets/javascripts/chosen.jquery.coffee'
|
|
17
|
-
get "#{remote}/raw/#{branch}/coffee/chosen.proto.coffee", 'lib/assets/javascripts/chosen.proto.coffee'
|
|
18
|
-
get "#{remote}/raw/#{branch}/package.json", 'lib/assets/javascripts/package.json'
|
|
10
|
+
get "#{remote}/raw/#{branch}/sass/chosen.scss", 'vendor/assets/stylesheets/chosen.scss', force: true
|
|
11
|
+
get "#{remote}/raw/#{branch}/dist/js/chosen.jquery.js", 'vendor/assets/javascripts/chosen-jquery.js', force: true
|
|
12
|
+
get "#{remote}/raw/#{branch}/dist/js/chosen.proto.js", 'vendor/assets/javascripts/chosen-prototype.js', force: true
|
|
13
|
+
get "#{remote}/raw/#{branch}/package.json", 'lib/assets/javascripts/package.json', force: true
|
|
19
14
|
bump_version
|
|
20
15
|
end
|
|
21
16
|
|
|
22
|
-
desc 'eject class from closure', 'eject javascript library class from closure'
|
|
23
|
-
def eject_javascript_class_from_closure
|
|
24
|
-
self.destination_root = 'lib/assets/javascripts'
|
|
25
|
-
inside destination_root do
|
|
26
|
-
append_to_file 'lib/abstract-chosen.coffee' do
|
|
27
|
-
"\nwindow.AbstractChosen = AbstractChosen\n"
|
|
28
|
-
end
|
|
29
|
-
append_to_file 'lib/select-parser.coffee' do
|
|
30
|
-
"\n\nwindow.SelectParser = SelectParser\n"
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
desc 'generate JS files', 'generate JS files from coffee script source'
|
|
36
|
-
def generate_js
|
|
37
|
-
gem_root = File.expand_path('../..', __dir__)
|
|
38
|
-
coffee_dir = File.join(gem_root, 'lib', 'assets', 'javascripts')
|
|
39
|
-
output_dir = File.join(gem_root, 'vendor', 'assets', 'javascripts')
|
|
40
|
-
|
|
41
|
-
# Create output directory
|
|
42
|
-
FileUtils.mkdir_p(output_dir)
|
|
43
|
-
|
|
44
|
-
# Collect all CoffeeScript files to combine
|
|
45
|
-
coffee_files = []
|
|
46
|
-
|
|
47
|
-
# 1. First include your lib coffee scripts
|
|
48
|
-
lib_files = [
|
|
49
|
-
File.join(coffee_dir, 'lib/abstract-chosen.coffee'),
|
|
50
|
-
File.join(coffee_dir, 'lib/select-parser.coffee'),
|
|
51
|
-
]
|
|
52
|
-
coffee_files.concat(lib_files)
|
|
53
|
-
|
|
54
|
-
{'chosen.jquery.coffee' => 'chosen-jquery.js', 'chosen.proto.coffee' => 'chosen-prototype.js'}.each do |coffee, js|
|
|
55
|
-
say "Generating JS #{js} from #{coffee}"
|
|
56
|
-
combined_coffee = [*coffee_files, File.join(coffee_dir, coffee)].map do |file|
|
|
57
|
-
File.read(file)
|
|
58
|
-
end.join("\n\n")
|
|
59
|
-
output_file = File.join(output_dir, js)
|
|
60
|
-
coffee2js(combined_coffee, output_file)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
17
|
desc 'clean up useless files', 'clean up useless files'
|
|
65
18
|
def cleanup
|
|
66
19
|
self.destination_root = 'lib/assets/javascripts'
|
|
67
20
|
remove_file 'package.json'
|
|
68
21
|
end
|
|
69
22
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
rescue => e
|
|
80
|
-
say "❌ Failed to compile: #{e.message}"
|
|
81
|
-
say e.backtrace.first(5).join("\n")
|
|
82
|
-
exit 1
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
def bump_version
|
|
86
|
-
inside destination_root do
|
|
87
|
-
package_json = JSON.load(File.open('lib/assets/javascripts/package.json'))
|
|
88
|
-
version = package_json['version']
|
|
89
|
-
gsub_file 'lib/chosen-dartsass/version.rb', /CHOSEN_VERSION\s=\s'(\d|\.)+'$/ do |match|
|
|
90
|
-
%Q{CHOSEN_VERSION = '#{version}'}
|
|
23
|
+
no_commands do
|
|
24
|
+
def bump_version
|
|
25
|
+
inside destination_root do
|
|
26
|
+
package_json = JSON.load(File.open('lib/assets/javascripts/package.json'))
|
|
27
|
+
version = package_json['version']
|
|
28
|
+
gsub_file 'lib/chosen-dartsass/version.rb', /CHOSEN_VERSION\s=\s'(\d|\.)+'$/ do
|
|
29
|
+
%Q{CHOSEN_VERSION = '#{version}'}
|
|
30
|
+
end
|
|
91
31
|
end
|
|
92
32
|
end
|
|
93
33
|
end
|