Update chosen to latest version and use latest version of jQuery

gh-pages
Patrick Filler 2011-09-22 15:43:46 -05:00
parent 9cd2fcbb3a
commit 31a708028d
3 changed files with 49 additions and 22 deletions

View File

@ -303,6 +303,15 @@
}
/* @end */
/* @group Disabled Support */
.chzn-disabled {
cursor: default;
opacity:0.5 !important;
}
.chzn-disabled .chzn-single {
cursor: default;
}
/* @group Right to Left */
.chzn-rtl { direction:rtl;text-align: right; }
.chzn-rtl .chzn-single { padding-left: 0; padding-right: 8px; }

View File

@ -44,6 +44,9 @@
this.click_test_action = __bind(function(evt) {
return this.test_active_click(evt);
}, this);
this.activate_action = __bind(function(evt) {
return this.activate_field(evt);
}, this);
this.active_field = false;
this.mouse_on_container = false;
this.results_showing = false;
@ -60,7 +63,7 @@
this.default_text = this.form_field_jq.data('placeholder') ? this.form_field_jq.data('placeholder') : this.default_text_default;
container_div = $("<div />", {
id: this.container_id,
"class": "chzn-container " + (this.is_rtl ? 'chzn-rtl' : ''),
"class": "chzn-container" + (this.is_rtl ? ' chzn-rtl' : ''),
style: 'width: ' + this.f_width + 'px;'
});
if (this.is_multiple) {
@ -134,13 +137,26 @@
return this.search_field.focus(__bind(function(evt) {
return this.input_focus(evt);
}, this));
}
};
Chosen.prototype.search_field_disabled = function() {
this.is_disabled = this.form_field_jq.attr('disabled');
if (this.is_disabled) {
this.container.addClass('chzn-disabled');
this.search_field.attr('disabled', true);
if (!this.is_multiple) {
return this.selected_item.unbind("focus", this.activate_action);
}
} else {
return this.selected_item.focus(__bind(function(evt) {
return this.activate_field(evt);
}, this));
this.container.removeClass('chzn-disabled');
this.search_field.attr('disabled', false);
if (!this.is_multiple) {
return this.selected_item.bind("focus", this.activate_action);
}
}
};
Chosen.prototype.container_mousedown = function(evt) {
if (!this.is_disabled) {
if (evt && evt.type === "mousedown") {
evt.stopPropagation();
}
@ -159,6 +175,7 @@
} else {
return this.pending_destroy_click = false;
}
}
};
Chosen.prototype.mouse_enter = function() {
return this.mouse_on_container = true;
@ -243,6 +260,7 @@
}
}
}
this.search_field_disabled();
this.show_search_field_default();
this.search_field_scale();
this.search_results.html(content);

View File

@ -1288,7 +1288,7 @@
</footer>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="chosen/chosen.jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(".chzn-select").chosen();