mirror of
https://github.com/simonw/datasette.git
synced 2026-05-28 04:46:18 +02:00
Fix mobile column actions not showing items for SQL views (#2670)
* Fix mobile column actions not showing items for SQL views
The previous fix to exclude the Link column from mobile column actions
(d02072b) used .dropdown-menu-icon presence as a proxy, but dropdown
icons are only added to sortable columns (those with <a> tags). This
caused all non-sortable columns to be excluded too.
Instead, explicitly mark the Link column with a data-is-link-column
attribute and filter by that in mobileColumnHeaders, so non-sortable
columns on views and tables still appear in the mobile column actions.
* Prettier formatting for mobile-column-actions.js
https://claude.ai/code/session_01CG545gLcZxet7dS5nMzfCd
This commit is contained in:
parent
d02072bc9d
commit
68966880c2
4 changed files with 4 additions and 4 deletions
|
|
@ -5,9 +5,7 @@ var MOBILE_COLUMN_DIALOG_TITLE_ID = "mobile-column-actions-title";
|
|||
function mobileColumnHeaders(manager) {
|
||||
return Array.from(
|
||||
document.querySelectorAll(manager.selectors.tableHeaders),
|
||||
).filter(
|
||||
(th) => th.dataset.column && th.querySelector(".dropdown-menu-icon"),
|
||||
);
|
||||
).filter((th) => th.dataset.column && th.dataset.isLinkColumn !== "1");
|
||||
}
|
||||
|
||||
function mobileColumnMetaText(th) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
{% for column in display_columns %}
|
||||
<th {% if column.description %}data-column-description="{{ column.description }}" {% endif %}class="col-{{ column.name|to_css_class }}" scope="col" data-column="{{ column.name }}" data-column-type="{{ column.type.lower() }}" data-column-not-null="{{ column.notnull }}" data-is-pk="{% if column.is_pk %}1{% else %}0{% endif %}">
|
||||
<th {% if column.description %}data-column-description="{{ column.description }}" {% endif %}class="col-{{ column.name|to_css_class }}" scope="col" data-column="{{ column.name }}" data-column-type="{{ column.type.lower() }}" data-column-not-null="{{ column.notnull }}" data-is-pk="{% if column.is_pk %}1{% else %}0{% endif %}"{% if column.is_special_link_column %} data-is-link-column="1"{% endif %}>
|
||||
{% if not column.sortable %}
|
||||
{{ column.name }}
|
||||
{% else %}
|
||||
|
|
|
|||
|
|
@ -369,6 +369,7 @@ async def display_columns_and_rows(
|
|||
"is_pk": False,
|
||||
"type": "",
|
||||
"notnull": 0,
|
||||
"is_special_link_column": True,
|
||||
}
|
||||
columns = [first_column] + columns
|
||||
return columns, cell_rows
|
||||
|
|
|
|||
|
|
@ -248,6 +248,7 @@ async def test_sort_links(ds_client):
|
|||
"data-column-type": "",
|
||||
"data-column-not-null": "0",
|
||||
"data-is-pk": "0",
|
||||
"data-is-link-column": "1",
|
||||
},
|
||||
"a_href": None,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue