diff --git a/styles/bootstrap/application.js b/styles/bootstrap/application.js
index c4968940f..65fccac65 100644
--- a/styles/bootstrap/application.js
+++ b/styles/bootstrap/application.js
@@ -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 = ''+state.text+'';
+ if(subtitle)
+ html += '
'+subtitle+'';
+ if(warning)
+ html += '
'+warning+'';
+ html += '';
+ var $newstate = $(html);
+ return $newstate;
+};
$(document).ready( function() {
/* close popovers when clicking somewhere except in the popover or the
* remove icon
@@ -27,28 +40,12 @@ $(document).ready( function() {
$(".chzn-select").select2({
width: '100%',
- templateResult: function (state) {
- var subtitle = $(state.element).data('subtitle');
- var html = ''+state.text+'';
- if(subtitle)
- html += '
'+subtitle+'';
- html += '';
- var $newstate = $(html);
- return $newstate;
- }
+ templateResult: chzn_template_func
});
$(".chzn-select-deselect").select2({
allowClear:true,
width: '100%',
- templateResult: function (state) {
- var subtitle = $(state.element).data('subtitle');
- var html = ''+state.text+'';
- if(subtitle)
- html += '
'+subtitle+'';
- html += '';
- var $newstate = $(html);
- return $newstate;
- }
+ templateResult: chzn_template_func
});
/* change the color and length of the bar graph showing the password
@@ -382,15 +379,7 @@ $(document).ready( function() {
// $(".chzn-select").chosen();
$(".chzn-select").select2({
width: '100%',
- templateResult: function (state) {
- var subtitle = $(state.element).data('subtitle');
- var html = ''+state.text+'';
- if(subtitle)
- html += '
'+subtitle+'';
- html += '';
- var $newstate = $(html);
- return $newstate;
- }
+ templateResult: chzn_template_func
});
});
}); /* }}} */
@@ -424,15 +413,7 @@ $(document).ready( function() {
// $(".chzn-select").chosen();
$(".chzn-select").select2({
width: '100%',
- templateResult: function (state) {
- var subtitle = $(state.element).data('subtitle');
- var html = ''+state.text+'';
- if(subtitle)
- html += '
'+subtitle+'';
- html += '';
- var $newstate = $(html);
- return $newstate;
- }
+ templateResult: chzn_template_func
});
$(".pwd").passStrength({ /* {{{ */
url: "../op/op.Ajax.php",