mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX SSF-53 : apply a patch with fix chosen.js messed the width up if the select element is single select and having initial width as percentage
This commit is contained in:
parent
97386413d6
commit
a73c8bcbf0
23
admin/thirdparty/chosen/chosen/chosen.jquery.js
vendored
23
admin/thirdparty/chosen/chosen/chosen.jquery.js
vendored
@ -1,12 +1,6 @@
|
|||||||
// Chosen, a Select Box Enhancer for jQuery and Protoype
|
//based on version 0.9.7 and applied a very simple patch that fix percentaage width support on select tag
|
||||||
// by Patrick Filler for Harvest, http://getharvest.com
|
//the patch has been documented https://github.com/harvesthq/chosen/issues/300.
|
||||||
//
|
|
||||||
// Version 0.9.7
|
|
||||||
// Full source at https://github.com/harvesthq/chosen
|
|
||||||
// Copyright (c) 2011 Harvest http://getharvest.com
|
|
||||||
|
|
||||||
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
|
||||||
// This file is generated by `cake build`, do not edit it by hand.
|
|
||||||
(function() {
|
(function() {
|
||||||
var SelectParser;
|
var SelectParser;
|
||||||
|
|
||||||
@ -302,8 +296,10 @@ Copyright (c) 2011 by Harvest
|
|||||||
container_div = $("<div />", {
|
container_div = $("<div />", {
|
||||||
id: this.container_id,
|
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;'
|
//patch applied: https://github.com/harvesthq/chosen/issues/300
|
||||||
|
style: 'width: ' + (this.options.width || this.f_width + 'px;')
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.is_multiple) {
|
if (this.is_multiple) {
|
||||||
container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
|
container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
|
||||||
} else {
|
} else {
|
||||||
@ -314,10 +310,13 @@ Copyright (c) 2011 by Harvest
|
|||||||
this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
|
this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
|
||||||
this.dropdown = this.container.find('div.chzn-drop').first();
|
this.dropdown = this.container.find('div.chzn-drop').first();
|
||||||
dd_top = this.container.height();
|
dd_top = this.container.height();
|
||||||
dd_width = this.f_width - get_side_border_padding(this.dropdown);
|
//patch applied: https://github.com/harvesthq/chosen/issues/300
|
||||||
|
dd_width = this.container.width() - get_side_border_padding(this.dropdown);
|
||||||
this.dropdown.css({
|
this.dropdown.css({
|
||||||
"width": dd_width + "px",
|
"width": dd_width + "px",
|
||||||
"top": dd_top + "px"
|
"top": dd_top + "px",
|
||||||
|
//patch applied: https://github.com/harvesthq/chosen/issues/300
|
||||||
|
"width": dd_width
|
||||||
});
|
});
|
||||||
this.search_field = this.container.find('input').first();
|
this.search_field = this.container.find('input').first();
|
||||||
this.search_results = this.container.find('ul.chzn-results').first();
|
this.search_results = this.container.find('ul.chzn-results').first();
|
||||||
@ -558,6 +557,8 @@ Copyright (c) 2011 by Harvest
|
|||||||
"left": 0
|
"left": 0
|
||||||
});
|
});
|
||||||
this.results_showing = true;
|
this.results_showing = true;
|
||||||
|
//patch applied: https://github.com/harvesthq/chosen/issues/300
|
||||||
|
this.search_field.css('width', (dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field)) + 'px');
|
||||||
this.search_field.focus();
|
this.search_field.focus();
|
||||||
this.search_field.val(this.search_field.val());
|
this.search_field.val(this.search_field.val());
|
||||||
return this.winnow_results();
|
return this.winnow_results();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user