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

Fixes #84 and #125 #152

Merged
merged 2 commits into from
Sep 12, 2011
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
18 changes: 10 additions & 8 deletions chosen/chosen.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,23 @@
/*
Chosen source: generate output using 'cake build'
Copyright (c) 2011 by Harvest
*/ var $, Chosen, get_side_border_padding, root;
*/
var $, Chosen, get_side_border_padding, root;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
root = this;
$ = jQuery;
$.fn.extend({
chosen: function(data, options) {
chosen: function(options) {
return $(this).each(function(input_field) {
if (!($(this)).hasClass("chzn-done")) {
return new Chosen(this, data, options);
return new Chosen(this, options);
}
});
}
});
Chosen = (function() {
function Chosen(elmn) {
this.set_default_values();
function Chosen(elmn, options) {
this.set_default_values(options || {});
this.form_field = elmn;
this.form_field_jq = $(this.form_field);
this.is_multiple = this.form_field.multiple;
Expand All @@ -36,7 +37,7 @@
this.register_observers();
this.form_field_jq.addClass("chzn-done");
}
Chosen.prototype.set_default_values = function() {
Chosen.prototype.set_default_values = function(options) {
this.click_test_action = __bind(function(evt) {
return this.test_active_click(evt);
}, this);
Expand All @@ -45,7 +46,8 @@
this.results_showing = false;
this.result_highlighted = null;
this.result_single_selected = null;
return this.choices = 0;
this.choices = 0;
return this.results_none_found = options.no_results_text || "No results match";
};
Chosen.prototype.set_up_html = function() {
var container_div, dd_top, dd_width, sf_width;
Expand Down Expand Up @@ -541,7 +543,7 @@
};
Chosen.prototype.no_results = function(terms) {
var no_results_html;
no_results_html = $('<li class="no-results">No results match "<span></span>"</li>');
no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
no_results_html.find("span").first().html(terms);
return this.search_results.append(no_results_html);
};
Expand Down
Loading