hide pagination totals on empty response

This commit is contained in:
yggverse 2025-08-11 19:48:00 +03:00
parent 3f536fd316
commit 6a9a312b00
2 changed files with 9 additions and 7 deletions

View file

@ -94,12 +94,14 @@ fn index(
} }
}) })
.collect::<Vec<R>>(), .collect::<Vec<R>>(),
pagination_totals: format!( pagination_totals: if total > 0 {
Some(format!(
"Page {} / {} ({total} {} total)", "Page {} / {} ({total} {} total)",
page.unwrap_or(1), page.unwrap_or(1),
(total as f64 / public.default_limit as f64).ceil(), (total as f64 / public.default_limit as f64).ceil(),
total.plurify(&["torrent", "torrents", "torrents"]) total.plurify(&["torrent", "torrents", "torrents"])
), ))
} else { None },
search search
}, },
)) ))

View file

@ -29,5 +29,5 @@
{% endif %} {% endif %}
{% if next %}<a href="{{ next }}">Next</a>{% endif %} {% if next %}<a href="{{ next }}">Next</a>{% endif %}
{% if back %}<a href="{{ back }}">Back</a>{% endif %} {% if back %}<a href="{{ back }}">Back</a>{% endif %}
<span>{{ pagination_totals }}</span> {% if pagination_totals %}<span>{{ pagination_totals }}</span>{% endif %}
{% endblock content %} {% endblock content %}