Add 'Click to mark' hint

This commit is contained in:
Aris Feryanto 2011-06-14 09:37:51 +07:00
parent 8493052a2f
commit 823decbaf4
2 changed files with 20 additions and 10 deletions

View File

@ -13,8 +13,10 @@
hintShown: false, // true if hint balloon is shown, used by updateHint() method
reorderHint: '', // string, hint for column reordering
sortHint: '', // string, hint for column sorting
markHint: '', // string, hint for column marking
showReorderHint: false, // boolean, used by showHint() method
showSortHint: false, // boolean, used by showHint() method
showMarkHint: false,
hintIsHiding: false, // true when hint is still shown, but hide() already called
// functions
@ -349,9 +351,13 @@
text += this.reorderHint;
}
if (this.showSortHint) {
text += this.showReorderHint ? '<br />' : '';
text += text.length > 0 ? '<br />' : '';
text += this.sortHint;
}
if (this.showMarkHint) {
text += text.length > 0 ? '<br />' : '';
text += this.markHint;
}
// hide the hint if no text
if (!text) {
@ -448,6 +454,7 @@
// assign column reorder & column sort hint
g.reorderHint = $('#col_order_hint').val();
g.sortHint = $('#sort_hint').val();
g.markHint = $('#col_mark_hint').val();
// determine whether to show the column reordering hint or not
g.showReorderHint = $firstRowCols.length > 1;
@ -488,22 +495,25 @@
$(t).find('th.draggable')
.mousedown(function(e) {
g.dragStartMove(e, this);
})
// show/hide draggable column
.mouseenter(function(e) {
g.showHint(e);
})
.mouseleave(function(e) {
g.hideHint();
});
}
$(t).find('th.draggable')
.mouseenter(function(e) {
g.showMarkHint = !g.showSortHint;
g.showHint(e);
})
.mouseleave(function(e) {
g.hideHint();
});
$(t).find('th.draggable a')
.mouseenter(function(e) {
g.showSortHint = true;
g.showMarkHint = false;
g.showHint(e);
})
.mouseleave(function(e) {
g.showSortHint = false;
g.showMarkHint = true;
g.showHint(e);
});
$(document).mousemove(function(e) {

View File

@ -406,10 +406,10 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di
echo '<input id="table_create_time" type="hidden" value="' .
PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'CREATE_TIME') . '" />';
}
// generate text for draggable column hint
// generate hints
echo '<input id="col_order_hint" type="hidden" value="' . __('Drag to reorder') . '" />';
// generate text for sortable column hint
echo '<input id="sort_hint" type="hidden" value="' . __('Click to sort') . '" />';
echo '<input id="col_mark_hint" type="hidden" value="' . __('Click to mark/unmark') . '" />';
?>
</td>
</tr>