From 9badb87f1aef2f92552e5545f57628e864d7bcbf Mon Sep 17 00:00:00 2001 From: lorilee Date: Wed, 14 Jul 2010 11:55:31 -0700 Subject: [PATCH] Reveal-on-hover table structure actions --- js/functions.js | 24 ++++++ tbl_structure.php | 98 +++++++++++++++++++++--- themes/original/css/theme_right.css.php | 21 ++++- themes/original/img/more.png | Bin 0 -> 553 bytes 4 files changed, 132 insertions(+), 11 deletions(-) create mode 100644 themes/original/img/more.png diff --git a/js/functions.js b/js/functions.js index 4f425b314339..cbfe0e38ab7d 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1829,4 +1829,28 @@ $(document).ready(function() { disable_popup(); } }); + + /** + * Hides certain table structure actions, replacing them with the word "More". They are displayed + * in a dropdown menu when the user hovers over the word "More." + */ + // Remove the actions from the table cells (they are available by default for JavaScript-disabled browsers) + $("table[id='tablestructure'] td[class='browse']").remove(); + $("table[id='tablestructure'] td[class='primary']").remove(); + $("table[id='tablestructure'] td[class='unique']").remove(); + $("table[id='tablestructure'] td[class='index']").remove(); + $("table[id='tablestructure'] td[class='fulltext']").remove(); + + // Display the "more" text + $("table[id='tablestructure'] td[class='more_opts']").show() + + // When "more" is hovered over, show the hidden actions + $("table[id='tablestructure'] td[class='more_opts']").hover( + function() { + $(this).children(".structure_actions_dropdown").show(); + }, + function() { + $(this).children(".structure_actions_dropdown").hide(); + } + ); }); \ No newline at end of file diff --git a/tbl_structure.php b/tbl_structure.php index 8f1f26db9abd..cfbd961adde6 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -160,6 +160,18 @@ $titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Fulltext'), true); $titles['BrowseDistinctValues'] = PMA_getIcon('b_browse.png', __('Browse distinct values'), true); +// hidden action titles (image and string) +$hidden_titles = array(); +$hidden_titles['BrowseDistinctValues'] = PMA_getIcon('b_browse.png', __('Browse distinct values'), true, true); +$hidden_titles['Primary'] = PMA_getIcon('b_primary.png', __('Primary'), true, true); +$hidden_titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Primary'), true, true); +$hidden_titles['Index'] = PMA_getIcon('b_index.png', __('Index'), true, true); +$hidden_titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Index'), true, true); +$hidden_titles['Unique'] = PMA_getIcon('b_unique.png', __('Unique'), true, true); +$hidden_titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Unique'), true, true); +$hidden_titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Fulltext'), true, true); +$hidden_titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Fulltext'), true, true); + /** * Displays the table structure ('show table' works correct since 3.23.03) */ @@ -361,59 +373,63 @@ echo '' . _pgettext('None for default','None') . ''; } ?> - + - + - + - + hasColumn($field_name))) { echo $titles['NoPrimary'] . "\n"; + $primary = false; } else { echo "\n"; ?> - - + - - + @@ -424,22 +440,84 @@ && (strpos(' ' . $type, 'text') || strpos(' ' . $type, 'char'))) { echo "\n"; ?> - + + - + + + + More +
+ +
+ + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ ; color: ; } @@ -1391,4 +1392,22 @@ #enum_editor_output { margin-top: 50px; +} + +/** + * Table structure styles + */ +.structure_actions_dropdown { + position: absolute; + padding: 3px; + display: none; + margin-left: 30px; +} + +td.more_opts { + display: none; +} + +table#tablestructure { + margin-right: 50px; } \ No newline at end of file diff --git a/themes/original/img/more.png b/themes/original/img/more.png new file mode 100644 index 0000000000000000000000000000000000000000..e83694b3b67f35cc5f73fdfc466a1e9d12c18caa GIT binary patch literal 553 zcmV+^0@nSBP)4Tx0C)kdlFv&5K@`WoZiEolCHp}T?8!W6h!QA7 zpdKphU?N!F)^$@s*JXCJ`UAQP-J(N3pi@Mr=;$BdE$9#t1pNVl&?RJhvqN}D>e37| z`F&qi>mhtUg~bsblXa1vs-dCYW{eHN7x_2!q+Ip zFE$^efPlwO8h=G{P;g1|s^EQYanfW3>s75xOamd7&!vew#8VZ?XM#(TZw0sYirCvF zj+o_|N&HS6FB`TFC?XcuEk+vUlsGK%r!O_00oE3QvEI;Dw1Mj@U@kDU1?Pd80&pK2 z+WOn>op@$@_FgRNy7Tx_!1#;f^aFtR7#MUM=kvmG2A34$8R(jNi?v-X9a2dEf30P1 z(z~nyv8aVxkDn~_cl8nAd;=&<0GT7;?Dv+K#9M74|!MazJ;__ua%g_ zjj}49OS)NaGTYL0!~Ok#6E_a1CP2Dr9kN=b%GD&jE`tI#tQI#|NZmB`<&YYUL{^0E z3wC{RWGy-HPXGV_J4r-AR2Ug!U?2l9LiPM7K`$dr6G#s+8o}z3H4)MXR|{t#IS-qS rDC$r+I5gr?gQOh6#AYKxmQ)r1F-8Ujk9F=x00000NkvXXu0mjf6twCi literal 0 HcmV?d00001