new Show/Hide query box message; display as link

This commit is contained in:
Marc Delisle
2010-10-04 06:10:44 -04:00
parent d1bebc67f6
commit f506fd6e39
2 changed files with 16 additions and 7 deletions

View File

@@ -81,7 +81,8 @@ $js_messages['strNo'] = __('No');
$js_messages['strSearching'] = __('Searching'); $js_messages['strSearching'] = __('Searching');
/* For sql.js */ /* For sql.js */
$js_messages['strToggleQueryBox'] = __('Toggle Query Box Visibility'); $js_messages['strHideQueryBox'] = __('Hide query box');
$js_messages['strShowQueryBox'] = __('Show query box');
$js_messages['strInlineEdit'] = __('Inline Edit'); $js_messages['strInlineEdit'] = __('Inline Edit');
/* For tbl_change.js */ /* For tbl_change.js */

View File

@@ -150,20 +150,28 @@ $(document).ready(function() {
$("#sqlqueryresults").trigger('appendAnchor'); $("#sqlqueryresults").trigger('appendAnchor');
/** /**
* Append the Toggle Query Box message to the query input form * Append the "Show/Hide query box" message to the query input form
* *
* @memberOf jQuery * @memberOf jQuery
* @name appendToggleSpan * @name appendToggleSpan
*/ */
// do not add this span more than once // do not add this link more than once
if (! $('#sqlqueryform').find('span').is('#togglequerybox')) { if (! $('#sqlqueryform').find('a').is('#togglequerybox')) {
$('<span id="togglequerybox"></span>') $('<a id="togglequerybox"></a>')
.html(PMA_messages['strToggleQueryBox']) .html(PMA_messages['strHideQueryBox'])
.appendTo("#sqlqueryform"); .appendTo("#sqlqueryform");
// Attach the toggling of the query box visibility to a click // Attach the toggling of the query box visibility to a click
$("#togglequerybox").bind('click', function() { $("#togglequerybox").bind('click', function() {
$(this).siblings().slideToggle("medium"); var $link = $(this)
$link.siblings().slideToggle("medium");
if ($link.text() == PMA_messages['strHideQueryBox']) {
$link.text(PMA_messages['strShowQueryBox']);
} else {
$link.text(PMA_messages['strHideQueryBox']);
}
// avoid default click action
return false;
}) })
} }