mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-01 22:47:19 +00:00
put template func of chzn select into var and reuse it
This commit is contained in:
parent
33881582de
commit
bd616ac46e
|
@ -1,3 +1,16 @@
|
||||||
|
/* Template function which outputs an option in a chzn-select */
|
||||||
|
chzn_template_func = function (state) {
|
||||||
|
var subtitle = $(state.element).data('subtitle');
|
||||||
|
var warning = $(state.element).data('warning');
|
||||||
|
var html = '<span>'+state.text+'';
|
||||||
|
if(subtitle)
|
||||||
|
html += '<br /><i>'+subtitle+'</i>';
|
||||||
|
if(warning)
|
||||||
|
html += '<br /><i class="icon-warning-sign"></i> '+warning+'';
|
||||||
|
html += '</span>';
|
||||||
|
var $newstate = $(html);
|
||||||
|
return $newstate;
|
||||||
|
};
|
||||||
$(document).ready( function() {
|
$(document).ready( function() {
|
||||||
/* close popovers when clicking somewhere except in the popover or the
|
/* close popovers when clicking somewhere except in the popover or the
|
||||||
* remove icon
|
* remove icon
|
||||||
|
@ -27,28 +40,12 @@ $(document).ready( function() {
|
||||||
|
|
||||||
$(".chzn-select").select2({
|
$(".chzn-select").select2({
|
||||||
width: '100%',
|
width: '100%',
|
||||||
templateResult: function (state) {
|
templateResult: chzn_template_func
|
||||||
var subtitle = $(state.element).data('subtitle');
|
|
||||||
var html = '<span>'+state.text+'';
|
|
||||||
if(subtitle)
|
|
||||||
html += '<br /><i>'+subtitle+'</i>';
|
|
||||||
html += '</span>';
|
|
||||||
var $newstate = $(html);
|
|
||||||
return $newstate;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
$(".chzn-select-deselect").select2({
|
$(".chzn-select-deselect").select2({
|
||||||
allowClear:true,
|
allowClear:true,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
templateResult: function (state) {
|
templateResult: chzn_template_func
|
||||||
var subtitle = $(state.element).data('subtitle');
|
|
||||||
var html = '<span>'+state.text+'';
|
|
||||||
if(subtitle)
|
|
||||||
html += '<br /><i>'+subtitle+'</i>';
|
|
||||||
html += '</span>';
|
|
||||||
var $newstate = $(html);
|
|
||||||
return $newstate;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* change the color and length of the bar graph showing the password
|
/* change the color and length of the bar graph showing the password
|
||||||
|
@ -382,15 +379,7 @@ $(document).ready( function() {
|
||||||
// $(".chzn-select").chosen();
|
// $(".chzn-select").chosen();
|
||||||
$(".chzn-select").select2({
|
$(".chzn-select").select2({
|
||||||
width: '100%',
|
width: '100%',
|
||||||
templateResult: function (state) {
|
templateResult: chzn_template_func
|
||||||
var subtitle = $(state.element).data('subtitle');
|
|
||||||
var html = '<span>'+state.text+'';
|
|
||||||
if(subtitle)
|
|
||||||
html += '<br /><i>'+subtitle+'</i>';
|
|
||||||
html += '</span>';
|
|
||||||
var $newstate = $(html);
|
|
||||||
return $newstate;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}); /* }}} */
|
}); /* }}} */
|
||||||
|
@ -424,15 +413,7 @@ $(document).ready( function() {
|
||||||
// $(".chzn-select").chosen();
|
// $(".chzn-select").chosen();
|
||||||
$(".chzn-select").select2({
|
$(".chzn-select").select2({
|
||||||
width: '100%',
|
width: '100%',
|
||||||
templateResult: function (state) {
|
templateResult: chzn_template_func
|
||||||
var subtitle = $(state.element).data('subtitle');
|
|
||||||
var html = '<span>'+state.text+'';
|
|
||||||
if(subtitle)
|
|
||||||
html += '<br /><i>'+subtitle+'</i>';
|
|
||||||
html += '</span>';
|
|
||||||
var $newstate = $(html);
|
|
||||||
return $newstate;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
$(".pwd").passStrength({ /* {{{ */
|
$(".pwd").passStrength({ /* {{{ */
|
||||||
url: "../op/op.Ajax.php",
|
url: "../op/op.Ajax.php",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user