fix layout problems of select2 menu, allow to add icon to each option

This commit is contained in:
Uwe Steinmann 2020-07-28 15:39:20 +02:00
parent add540c476
commit 15d89c09d6

View File

@ -11,7 +11,10 @@ chzn_template_func = function (state) {
var warning = '';
if($(state.element).data('warning'))
warning = $(state.element).data('warning')+''; /* make sure it is a string */
var html = '<span>'+state.text.replace(/</g, '&lt;')+'';
var html = '<span>';
if($(state.element).data('icon-before'))
html += '<i class="icon-'+$(state.element).data('icon-before')+'"></i> ';
html += state.text.replace(/</g, '&lt;')+'';
if(subtitle)
html += '<br /><i>'+subtitle.replace(/</g, '&lt;')+'</i>';
if(warning)
@ -58,8 +61,8 @@ $(document).ready( function() {
$(".chzn-select").select2({
width: '100%',
templateResult: chzn_template_func,
templateSelection: chzn_template_func
templateResult: chzn_template_func//,
//templateSelection: chzn_template_func
});
/* change the color and length of the bar graph showing the password
@ -377,8 +380,8 @@ $(document).ready( function() {
element.html(data);
$(".chzn-select").select2({
width: '100%',
templateResult: chzn_template_func,
templateSelection: chzn_template_func
templateResult: chzn_template_func//,
//templateSelection: chzn_template_func
});
$(".pwd").passStrength({ /* {{{ */
url: "../op/op.Ajax.php",
@ -426,8 +429,8 @@ $(document).ready( function() {
element.html(data);
$(".chzn-select").select2({
width: '100%',
templateResult: chzn_template_func,
templateSelection: chzn_template_func
templateResult: chzn_template_func//,
//templateSelection: chzn_template_func
});
$(".pwd").passStrength({ /* {{{ */
url: "../op/op.Ajax.php",