Refresh menu but keep search text if not focused

fixes #11128
This commit is contained in:
Eric Lippmann 2016-04-11 14:24:23 +02:00
parent 25a85ca36b
commit 93b50fe484
1 changed files with 14 additions and 0 deletions

View File

@ -55,6 +55,20 @@
* @returns {string|NULL} The content to be rendered, or NULL, when nothing should be changed * @returns {string|NULL} The content to be rendered, or NULL, when nothing should be changed
*/ */
Form.prototype.renderHook = function(content, $container, action, autorefresh) { Form.prototype.renderHook = function(content, $container, action, autorefresh) {
if ($container.attr('id') === 'menu') {
var $search = $container.find('#search');
if ($search[0] === document.activeElement) {
return null;
}
var search = $container.find('#search').val();
if (search.length) {
var $content = $('<div></div>').append(content);
$content.find('#search').attr('value', search).addClass('active');
return $content.html();
}
return content;
}
var origFocus = document.activeElement; var origFocus = document.activeElement;
var containerId = $container.attr('id'); var containerId = $container.attr('id');
var icinga = this.icinga; var icinga = this.icinga;