Fix migration to select2 4.0.5

This commit is contained in:
Laurent Destailleur 2017-10-26 14:06:23 +02:00
parent 5f5cbec1cf
commit 82b333e423
12 changed files with 6524 additions and 15 deletions

View File

@ -36,7 +36,7 @@ Stripe 4.7.0 MIT licence Yes
JS libraries:
jQuery 3.1.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.4 GPL and Apache License Yes JS library plugin for sexier multiselect
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
jQuery Flot 0.8.3 MIT License Yes JS library to build graph

View File

@ -5498,7 +5498,7 @@ class Form
cache: true
},
language: select2arrayoflanguage,
/* dropdownCssClass: "css-'.$htmlname.'", */
containerCssClass: \':all:\', /* Line to add class or origin SELECT propagated to the new <span class="select2-selection...> tag */
placeholder: "'.dol_escape_js($placeholder).'",
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
minimumInputLength: '.$minimumInputLength.',

View File

@ -411,8 +411,9 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */
minimumInputLength: '.$minLengthToAutocomplete.',
language: select2arrayoflanguage,
containerCssClass: \':all:\', /* Line to add class or origin SELECT propagated to the new <span class="select2-selection...> tag */
templateResult: function (data, container) { /* Format visible output into combo list */
/* Code to add class of origin option propagated to the new select2 li tag */
/* Code to add class of origin OPTION propagated to the new select2 <li> tag */
if (data.element) {
$(container).addClass($(data.element).attr("class"));
}

View File

@ -0,0 +1,56 @@
define([
'jquery',
'./utils'
], function ($, CompatUtils) {
// No-op CSS adapter that discards all classes by default
function _containerAdapter (clazz) {
return null;
}
function ContainerCSS () { }
ContainerCSS.prototype.render = function (decorated) {
var $container = decorated.call(this);
var containerCssClass = this.options.get('containerCssClass') || '';
if ($.isFunction(containerCssClass)) {
containerCssClass = containerCssClass(this.$element);
}
var containerCssAdapter = this.options.get('adaptContainerCssClass');
containerCssAdapter = containerCssAdapter || _containerAdapter;
if (containerCssClass.indexOf(':all:') !== -1) {
containerCssClass = containerCssClass.replace(':all:', '');
var _cssAdapter = containerCssAdapter;
containerCssAdapter = function (clazz) {
var adapted = _cssAdapter(clazz);
if (adapted != null) {
// Append the old one along with the adapted one
return adapted + ' ' + clazz;
}
return clazz;
};
}
var containerCss = this.options.get('containerCss') || {};
if ($.isFunction(containerCss)) {
containerCss = containerCss(this.$element);
}
CompatUtils.syncCssClasses($container, this.$element, containerCssAdapter);
$container.css(containerCss);
$container.addClass(containerCssClass);
return $container;
};
return ContainerCSS;
});

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*!
* Select2 4.0.4
* Select2 4.0.5
* https://select2.github.io
*
* Released under the MIT license
@ -1855,7 +1855,7 @@ S2.define('select2/selection/search',[
var $search = $(
'<li class="select2-search select2-search--inline">' +
'<input class="select2-search__field" type="search" tabindex="-1"' +
' autocomplete="off" autocorrect="off" autocapitalize="off"' +
' autocomplete="off" autocorrect="off" autocapitalize="none"' +
' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
'</li>'
);
@ -3909,7 +3909,7 @@ S2.define('select2/dropdown/search',[
var $search = $(
'<span class="select2-search select2-search--dropdown">' +
'<input class="select2-search__field" type="search" tabindex="-1"' +
' autocomplete="off" autocorrect="off" autocapitalize="off"' +
' autocomplete="off" autocorrect="off" autocapitalize="none"' +
' spellcheck="false" role="textbox" />' +
'</span>'
);

File diff suppressed because one or more lines are too long

View File

@ -1288,7 +1288,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
if (! defined('DISABLE_SELECT2') && (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) // jQuery plugin "mutiselect", "multiple-select", "select2", ...
{
$tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT;
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/'.$tmpplugin.'/dist/js/'.$tmpplugin.'.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/'.$tmpplugin.'/dist/js/'.$tmpplugin.'.full.min.js'.($ext?'?'.$ext:'').'"></script>'."\n"; // We include full because we need the support of containerCssClass
}
}

View File

@ -4319,9 +4319,6 @@ a span.select2-chosen
.select2-results {
max-height: 400px;
}
.css-searchselectcombo ul.select2-results {
max-height: none;
}
.select2-container.select2-container-disabled .select2-choice, .select2-container-multi.select2-container-disabled .select2-choices {
background-color: #FFFFFF;
background-image: none;

View File

@ -4338,9 +4338,6 @@ a span.select2-chosen
.select2-results {
max-height: 400px;
}
.css-searchselectcombo ul.select2-results {
max-height: none;
}
.select2-container.select2-container-disabled .select2-choice, .select2-container-multi.select2-container-disabled .select2-choices {
background-color: #FFFFFF;
background-image: none;

View File

@ -1325,7 +1325,7 @@ if (count($object->records) > 0)
array('type' => 'other','name' => 'newwebsite','label' => $langs->trans("Website"), 'value' => $formwebsite->selectWebsite($object->id, 'newwebsite', 0))
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?pageid=' . $pageid, $langs->trans('ClonePage'), '', 'confirm_createpagefromclone', $formquestion, 0, 1, 250);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?pageid=' . $pageid, $langs->trans('ClonePage'), '', 'confirm_createpagefromclone', $formquestion, 0, 1, 300, 550);
print $formconfirm;
}