mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Fixed Multiselect dropdown so that an empty value also gets saved.
This commit is contained in:
@@ -63,7 +63,7 @@ function loadJSAddons()
|
||||
e107::css('core', 'bootstrap-select/bootstrap-select.min.css', 'jquery');
|
||||
e107::js('footer', '{e_WEB}js/bootstrap-select/bootstrap-select.min.js', 'jquery', 2);
|
||||
|
||||
// e107::css('core', 'bootstrap-multiselect/css/bootstrap-multiselect.css', 'jquery');
|
||||
// e107::css('core', 'bootstrap-multiselect/css/bootstrap-multiselect.css', 'jquery');
|
||||
e107::js('footer', '{e_WEB}js/bootstrap-multiselect/js/bootstrap-multiselect.js', 'jquery', 2);
|
||||
|
||||
// TODO: remove typeahead.
|
||||
|
@@ -930,7 +930,7 @@ class news_admin_ui extends e_admin_ui
|
||||
$this->fields['news_meta_robots']['writeParms']['optArray'] = e107::getSingleton('eResponse')->getRobotTypes();
|
||||
$this->fields['news_meta_robots']['writeParms']['title'] = e107::getSingleton('eResponse')->getRobotDescriptions();
|
||||
$this->fields['news_meta_robots']['writeParms']['multiple'] = 1;
|
||||
//$this->fields['news_meta_robots']['writeParms']['default'] = 'blank';
|
||||
// $this->fields['news_meta_robots']['writeParms']['default'] = 'blank';
|
||||
// $this->newspost = new admin_newspost;
|
||||
// $this->newspost->news_renderTypes = $this->news_renderTypes;
|
||||
// $this->newspost->observer();
|
||||
|
@@ -3,6 +3,7 @@
|
||||
* https://github.com/davidstutz/bootstrap-multiselect
|
||||
*
|
||||
* Copyright 2012 David Stutz
|
||||
* Modified Dec 2019 by e107
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@@ -565,6 +565,7 @@ $(document).ready(function()
|
||||
$("select.tbox").each(function() {
|
||||
|
||||
var multi = $(this).attr('multiple');
|
||||
var tagName = $(this).attr('name');
|
||||
|
||||
if(multi === undefined)
|
||||
{
|
||||
@@ -573,7 +574,27 @@ $(document).ready(function()
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).multiselect({ buttonClass: 'btn btn-default'} );
|
||||
$(this).multiselect({
|
||||
buttonClass: 'btn btn-default',
|
||||
buttonText: function(options) {
|
||||
if (options.length == 0) {
|
||||
|
||||
return '(Optional) <b class="caret"></b><input type="hidden" name="' + tagName + '" value="" />'; // send empty value to server so value is saved.
|
||||
}
|
||||
else if (options.length > 5) {
|
||||
return options.length + ' selected <b class="caret"></b>';
|
||||
}
|
||||
else {
|
||||
var selected = '';
|
||||
options.each(function() {
|
||||
selected += $(this).text() + ', ';
|
||||
});
|
||||
return selected.substr(0, selected.length -2) + ' <b class="caret"></b>';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user