Remove more table actions dropdown

Add spatial index action icons
This commit is contained in:
2025-04-21 00:26:28 -07:00
parent 083031170c
commit fa1b8d5c94
7 changed files with 66 additions and 257 deletions

View File

@@ -1922,78 +1922,6 @@ $(document).ready(function() {
$("input[id='" + values_id + "']").attr("value", value_array.join(","));
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)
// if the table is not a view or information_schema (otherwise there is only one action to hide and there's no point)
if($("input[type='hidden'][name='table_type']").val() == "table") {
var $table = $("table[id='tablestructure']");
$table.find("td[class='browse']").remove();
$table.find("td[class='primary']").remove();
$table.find("td[class='unique']").remove();
$table.find("td[class='index']").remove();
$table.find("td[class='fulltext']").remove();
$table.find("th[class='action']").attr("colspan", 3);
// Display the "more" text
$table.find("td[class='more_opts']").show();
// Position the dropdown
$(".structure_actions_dropdown").each(function() {
// Optimize DOM querying
var $this_dropdown = $(this);
// The top offset must be set for IE even if it didn't change
var cell_right_edge_offset = $this_dropdown.parent().offset().left + $this_dropdown.parent().innerWidth();
var left_offset = cell_right_edge_offset - $this_dropdown.innerWidth();
var top_offset = $this_dropdown.parent().offset().top + $this_dropdown.parent().innerHeight();
$this_dropdown.offset({ top: top_offset, left: left_offset });
});
// A hack for IE6 to prevent the after_field select element from being displayed on top of the dropdown by
// positioning an iframe directly on top of it
var $after_field = $("select[name='after_field']");
$("iframe[class='IE_hack']")
.width($after_field.width())
.height($after_field.height())
.offset({
top: $after_field.offset().top,
left: $after_field.offset().left
});
// When "more" is hovered over, show the hidden actions
$table.find("td[class='more_opts']")
.mouseenter(function() {
if($.browser.msie && $.browser.version == "6.0") {
$("iframe[class='IE_hack']")
.show()
.width($after_field.width()+4)
.height($after_field.height()+4)
.offset({
top: $after_field.offset().top,
left: $after_field.offset().left
});
}
$(".structure_actions_dropdown").hide(); // Hide all the other ones that may be open
$(this).children(".structure_actions_dropdown").show();
// Need to do this again for IE otherwise the offset is wrong
if($.browser.msie) {
var left_offset_IE = $(this).offset().left + $(this).innerWidth() - $(this).children(".structure_actions_dropdown").innerWidth();
var top_offset_IE = $(this).offset().top + $(this).innerHeight();
$(this).children(".structure_actions_dropdown").offset({
top: top_offset_IE,
left: left_offset_IE });
}
})
.mouseleave(function() {
$(this).children(".structure_actions_dropdown").hide();
if($.browser.msie && $.browser.version == "6.0") {
$("iframe[class='IE_hack']").hide();
}
});
}
});
/* Displays tooltips */