Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulled from upstream using rake update-chosen (fixes #16) #17

Merged
merged 1 commit into from
Jan 21, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/chosen-rails/source_file.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def fetch
self.destination_root = "vendor/assets" self.destination_root = "vendor/assets"
remote = "https://github.com/harvesthq/chosen" remote = "https://github.com/harvesthq/chosen"
get "#{remote}/raw/master/chosen/chosen-sprite.png", "images/chosen-sprite.png" get "#{remote}/raw/master/chosen/chosen-sprite.png", "images/chosen-sprite.png"
get "#{remote}/raw/master/chosen/chosen-sprite@2x.png", "images/chosen-sprite@2x.png"
get "#{remote}/raw/master/chosen/chosen.css", "stylesheets/chosen.css" get "#{remote}/raw/master/chosen/chosen.css", "stylesheets/chosen.css"
get "#{remote}/raw/master/coffee/lib/abstract-chosen.coffee", "javascripts/lib/abstract-chosen.coffee" get "#{remote}/raw/master/coffee/lib/abstract-chosen.coffee", "javascripts/lib/abstract-chosen.coffee"
get "#{remote}/raw/master/coffee/lib/select-parser.coffee", "javascripts/lib/select-parser.coffee" get "#{remote}/raw/master/coffee/lib/select-parser.coffee", "javascripts/lib/select-parser.coffee"
Expand All @@ -28,6 +29,7 @@ def convert
inside destination_root do inside destination_root do
run("sass-convert -F css -T sass stylesheets/chosen.css stylesheets/chosen.css.sass") run("sass-convert -F css -T sass stylesheets/chosen.css stylesheets/chosen.css.sass")
gsub_file 'stylesheets/chosen.css.sass', '(chosen-sprite.png)', "('chosen-sprite.png')" gsub_file 'stylesheets/chosen.css.sass', '(chosen-sprite.png)', "('chosen-sprite.png')"
gsub_file 'stylesheets/chosen.css.sass', '(chosen-sprite@2x.png)', "('chosen-sprite@2x.png')"
gsub_file 'stylesheets/chosen.css.sass', ' url', ' image-url' gsub_file 'stylesheets/chosen.css.sass', ' url', ' image-url'
end end
end end
Expand Down
Binary file added vendor/assets/images/chosen-sprite@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion vendor/assets/javascripts/chosen.jquery.coffee
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@ $ = jQuery


$.fn.extend({ $.fn.extend({
chosen: (options) -> chosen: (options) ->
ua = navigator.userAgent.toLowerCase();

match = /(msie) ([\w.]+)/.exec( ua ) || [];

browser =
name: match[ 1 ] || ""
version: match[ 2 ] || "0"

# Do no harm and return as soon as possible for unsupported browsers, namely IE6 and IE7 # Do no harm and return as soon as possible for unsupported browsers, namely IE6 and IE7
# Continue on if running IE document type but in compatibility mode # Continue on if running IE document type but in compatibility mode
return this if $.browser.msie and ($.browser.version is "6.0" or ($.browser.version is "7.0" and document.documentMode is 7 )) return this if browser.name is "msie" and (browser.version is "6.0" or (browser.version is "7.0" and document.documentMode is 7 ))
this.each((input_field) -> this.each((input_field) ->
$this = $ this $this = $ this
$this.data('chosen', new Chosen(this, options)) unless $this.hasClass "chzn-done" $this.data('chosen', new Chosen(this, options)) unless $this.hasClass "chzn-done"
Expand Down