Skip to content

Commit

Permalink
Redesign ?_extra=extras a bit, refs #262
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Mar 29, 2023
1 parent c025b01 commit 651b78d
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions datasette/views/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1539,17 +1539,27 @@ async def extra_expandable_columns():

async def extra_extras():
"Available ?_extra= blocks"
return {
"available": [
{
"name": key[len("extra_") :],
"doc": fn.__doc__,
}
for key, fn in registry._registry.items()
if key.startswith("extra_")
],
"selected": list(extras),
}
all_extras = [
(key[len("extra_") :], fn.__doc__)
for key, fn in registry._registry.items()
if key.startswith("extra_")
]
return [
{
"name": name,
"description": doc,
"toggle_url": datasette.absolute_url(
request,
datasette.urls.path(
path_with_added_args(request, {"_extra": name})
if name not in extras
else path_with_removed_args(request, {"_extra": name})
),
),
"selected": name in extras,
}
for name, doc in all_extras
]

async def extra_facets_timed_out(extra_facet_results):
return extra_facet_results["timed_out"]
Expand Down

0 comments on commit 651b78d

Please sign in to comment.