diff --git a/themes/default/views/header.php b/themes/default/views/header.php index e480fac..686e705 100644 --- a/themes/default/views/header.php +++ b/themes/default/views/header.php @@ -12,8 +12,33 @@ $(document).click(window.parent.hideMenus); if ($("textarea").length > 0) { $("textarea").tabby(); + + + // Search with ID field + var elTextField = $("").attr({type: 'text', size: 30}).keypress(function(e) { + if (e.keyCode == '13') { + e.preventDefault(); + $(this).parent().find('input:last').click(); + } + }); + var elButton = $("").attr({type: 'button', value: 'Select by ID'}) + .bind('click', function (e) { + var v = $(this).parent().find('input:first').val(); + // заветная строка! + $('#query_form textarea').val('{\n\t\"_id\": ObjectId(\"'+v+'\")\n}'); + $('#query_form').submit(); + }); + $("
") + .html('_id: ') + .css({paddingLeft: 5, paddingTop: 4}) + .append(elTextField) + .append(' ') + .append(elButton) + .prependTo('#query_form'); + + } }); - \ No newline at end of file +