mirror of
https://github.com/simonw/datasette.git
synced 2026-09-16 05:24:21 +02:00
Tweak display of count all button, refs #2914
This commit is contained in:
parent
1538832830
commit
b0407867cc
3 changed files with 16 additions and 3 deletions
|
|
@ -216,6 +216,18 @@ a:active {
|
|||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.table-summary .count-all ~ .table-summary-description {
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
|
||||
.table-summary .count-error:not(:empty) {
|
||||
display: block;
|
||||
margin-top: 0.25rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
button.count-all {
|
||||
background: none;
|
||||
border: none;
|
||||
|
|
|
|||
|
|
@ -47,12 +47,12 @@
|
|||
{% endif %}
|
||||
|
||||
{% if count or human_description_en %}
|
||||
<h3>
|
||||
<h3 class="table-summary">
|
||||
{% if count_truncated %}<span class="table-count" aria-live="polite">{{ "{:,}".format(count - 1) }}+ rows</span>
|
||||
<button type="button" class="count-all" data-count-url="{{ urls.table(database, table) }}/-/count">count all</button>
|
||||
<span class="count-error" role="alert"></span>
|
||||
{% elif count or count == 0 %}{{ "{:,}".format(count) }} row{% if count == 1 %}{% else %}s{% endif %}{% endif %}
|
||||
{% if human_description_en %}{{ human_description_en }}{% endif %}
|
||||
{% if human_description_en %}<span class="table-summary-description">{{ human_description_en }}</span>{% endif %}
|
||||
</h3>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
|||
|
|
@ -1300,7 +1300,8 @@ async def test_hook_filters_from_request(ds_client):
|
|||
|
||||
ds_client.ds.pm.register(ReturnNothingPlugin(), name="ReturnNothingPlugin")
|
||||
response = await ds_client.get("/fixtures/facetable?_nothing=1")
|
||||
assert "0 rows\n where NOTHING" in response.text
|
||||
summary = Soup(response.text, "html.parser").select_one(".table-summary")
|
||||
assert summary.get_text(" ", strip=True) == "0 rows where NOTHING"
|
||||
json_response = await ds_client.get("/fixtures/facetable.json?_nothing=1")
|
||||
assert json_response.json()["rows"] == []
|
||||
ds_client.ds.pm.unregister(name="ReturnNothingPlugin")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue