diff --git a/e107_admin/header.php b/e107_admin/header.php index 4876a9160..3982752a1 100644 --- a/e107_admin/header.php +++ b/e107_admin/header.php @@ -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. diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index 961424aa7..6328dfe48 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -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(); diff --git a/e107_web/js/bootstrap-multiselect/js/bootstrap-multiselect.js b/e107_web/js/bootstrap-multiselect/js/bootstrap-multiselect.js index c4b46f752..4c62b7dea 100644 --- a/e107_web/js/bootstrap-multiselect/js/bootstrap-multiselect.js +++ b/e107_web/js/bootstrap-multiselect/js/bootstrap-multiselect.js @@ -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. diff --git a/e107_web/js/core/admin.jquery.js b/e107_web/js/core/admin.jquery.js index 125df9331..f39f44a0d 100644 --- a/e107_web/js/core/admin.jquery.js +++ b/e107_web/js/core/admin.jquery.js @@ -565,7 +565,8 @@ $(document).ready(function() $("select.tbox").each(function() { var multi = $(this).attr('multiple'); - + var tagName = $(this).attr('name'); + if(multi === undefined) { // $(this).selectpicker(); // causes HTML5 validation alert to be hidden. @@ -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) '; // send empty value to server so value is saved. + } + else if (options.length > 5) { + return options.length + ' selected '; + } + else { + var selected = ''; + options.each(function() { + selected += $(this).text() + ', '; + }); + return selected.substr(0, selected.length -2) + ' '; + } + }, + + + }); }