chosen-rails 0.9.11.2 → 0.9.12

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -30,6 +30,30 @@ Add to your `app/assets/stylesheets/application.css`
30
30
 
31
31
  *= require chosen
32
32
 
33
+ ### Enable chosen javascript by specific css class
34
+
35
+ Add to one coffee script file, like `scaffold.js.coffee`
36
+
37
+ $ ->
38
+ # enable chosen js
39
+ $('.chzn-select').chosen
40
+ allow_single_deselect: true
41
+ no_results_text: 'No results matched'
42
+
43
+
44
+ And this file must be included in `application.js`
45
+
46
+ //= require chosen-jquery
47
+ //= require scaffold
48
+
49
+ Also add the class to your form field
50
+
51
+ <%= f.text_field :author, class: 'chzn-select' %>
52
+
53
+ If you use simple form as form builder
54
+
55
+ <%= f.input :author, input_html: { class: 'chzn-select' } %>
56
+
33
57
  ## Gem maintenance
34
58
 
35
59
  Maintain `chosen-rails` gem with `Rake` commands.
data/Rakefile CHANGED
@@ -3,9 +3,11 @@ require 'bundler/gem_tasks'
3
3
  require File.expand_path('../lib/chosen-rails/source_file', __FILE__)
4
4
 
5
5
  desc "Update with Harvest's Chosen Library"
6
- task 'update-chosen' do
6
+ task 'update-chosen', 'remote', 'branch' do |task, args|
7
+ remote = args['remote'] || 'https://github.com/harvesthq/chosen'
8
+ branch = args['branch'] || 'master'
7
9
  files = SourceFile.new
8
- files.fetch
10
+ files.fetch remote, branch
9
11
  files.convert
10
12
  files.cleanup
11
13
  end
@@ -4,17 +4,16 @@ class SourceFile < Thor
4
4
  include Thor::Actions
5
5
 
6
6
  desc 'fetch source files', 'fetch source files from GitHub'
7
- def fetch
7
+ def fetch remote, branch
8
8
  self.destination_root = 'vendor/assets'
9
- remote = 'https://github.com/harvesthq/chosen'
10
- get "#{remote}/raw/master/chosen/chosen-sprite.png", 'images/chosen-sprite.png'
11
- get "#{remote}/raw/master/chosen/chosen-sprite@2x.png", 'images/chosen-sprite@2x.png'
12
- get "#{remote}/raw/master/chosen/chosen.css", 'stylesheets/chosen.css'
13
- get "#{remote}/raw/master/coffee/lib/abstract-chosen.coffee", 'javascripts/lib/abstract-chosen.coffee'
14
- get "#{remote}/raw/master/coffee/lib/select-parser.coffee", 'javascripts/lib/select-parser.coffee'
15
- get "#{remote}/raw/master/coffee/chosen.jquery.coffee", 'javascripts/chosen.jquery.coffee'
16
- get "#{remote}/raw/master/coffee/chosen.proto.coffee", 'javascripts/chosen.proto.coffee'
17
- get "#{remote}/raw/master/VERSION", 'VERSION'
9
+ get "#{remote}/raw/#{branch}/chosen/chosen-sprite.png", 'images/chosen-sprite.png'
10
+ get "#{remote}/raw/#{branch}/chosen/chosen-sprite@2x.png", 'images/chosen-sprite@2x.png'
11
+ get "#{remote}/raw/#{branch}/chosen/chosen.css", 'stylesheets/chosen.css'
12
+ get "#{remote}/raw/#{branch}/coffee/lib/abstract-chosen.coffee", 'javascripts/lib/abstract-chosen.coffee'
13
+ get "#{remote}/raw/#{branch}/coffee/lib/select-parser.coffee", 'javascripts/lib/select-parser.coffee'
14
+ get "#{remote}/raw/#{branch}/coffee/chosen.jquery.coffee", 'javascripts/chosen.jquery.coffee'
15
+ get "#{remote}/raw/#{branch}/coffee/chosen.proto.coffee", 'javascripts/chosen.proto.coffee'
16
+ get "#{remote}/raw/#{branch}/VERSION", 'VERSION'
18
17
  bump_version
19
18
  end
20
19
 
@@ -1,6 +1,6 @@
1
1
  module Chosen
2
2
  module Rails
3
- VERSION = '0.9.11.2'
4
- CHOSEN_VERSION = '0.9.11'
3
+ VERSION = '0.9.12'
4
+ CHOSEN_VERSION = '0.9.12'
5
5
  end
6
6
  end
@@ -87,28 +87,28 @@ class Chosen extends AbstractChosen
87
87
  @form_field_jq.trigger("liszt:ready", {chosen: this})
88
88
 
89
89
  register_observers: ->
90
- @container.mousedown (evt) => this.container_mousedown(evt)
91
- @container.mouseup (evt) => this.container_mouseup(evt)
92
- @container.mouseenter (evt) => this.mouse_enter(evt)
93
- @container.mouseleave (evt) => this.mouse_leave(evt)
90
+ @container.mousedown (evt) => this.container_mousedown(evt); return
91
+ @container.mouseup (evt) => this.container_mouseup(evt); return
92
+ @container.mouseenter (evt) => this.mouse_enter(evt); return
93
+ @container.mouseleave (evt) => this.mouse_leave(evt); return
94
94
 
95
- @search_results.mouseup (evt) => this.search_results_mouseup(evt)
96
- @search_results.mouseover (evt) => this.search_results_mouseover(evt)
97
- @search_results.mouseout (evt) => this.search_results_mouseout(evt)
95
+ @search_results.mouseup (evt) => this.search_results_mouseup(evt); return
96
+ @search_results.mouseover (evt) => this.search_results_mouseover(evt); return
97
+ @search_results.mouseout (evt) => this.search_results_mouseout(evt); return
98
98
 
99
- @form_field_jq.bind "liszt:updated", (evt) => this.results_update_field(evt)
100
- @form_field_jq.bind "liszt:activate", (evt) => this.activate_field(evt)
101
- @form_field_jq.bind "liszt:open", (evt) => this.container_mousedown(evt)
99
+ @form_field_jq.bind "liszt:updated", (evt) => this.results_update_field(evt); return
100
+ @form_field_jq.bind "liszt:activate", (evt) => this.activate_field(evt); return
101
+ @form_field_jq.bind "liszt:open", (evt) => this.container_mousedown(evt); return
102
102
 
103
- @search_field.blur (evt) => this.input_blur(evt)
104
- @search_field.keyup (evt) => this.keyup_checker(evt)
105
- @search_field.keydown (evt) => this.keydown_checker(evt)
106
- @search_field.focus (evt) => this.input_focus(evt)
103
+ @search_field.blur (evt) => this.input_blur(evt); return
104
+ @search_field.keyup (evt) => this.keyup_checker(evt); return
105
+ @search_field.keydown (evt) => this.keydown_checker(evt); return
106
+ @search_field.focus (evt) => this.input_focus(evt); return
107
107
 
108
108
  if @is_multiple
109
- @search_choices.click (evt) => this.choices_click(evt)
109
+ @search_choices.click (evt) => this.choices_click(evt); return
110
110
  else
111
- @container.click (evt) => evt.preventDefault() # gobble click of anchor
111
+ @container.click (evt) => evt.preventDefault(); return # gobble click of anchor
112
112
 
113
113
 
114
114
  search_field_disabled: ->
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chosen-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.11.2
4
+ version: 0.9.12
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: 2013-01-21 00:00:00.000000000 Z
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -149,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  segments:
151
151
  - 0
152
- hash: 2483525102989245458
152
+ hash: -1794190038984535268
153
153
  required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  none: false
155
155
  requirements:
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  version: '0'
159
159
  segments:
160
160
  - 0
161
- hash: 2483525102989245458
161
+ hash: -1794190038984535268
162
162
  requirements: []
163
163
  rubyforge_project:
164
164
  rubygems_version: 1.8.24