Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

Commit

Permalink
Don't rearrange tables on mobile screens, closes #380
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Apr 21, 2021
1 parent ee8f972 commit ce0fe4d
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions vaccinate/templates/admin/base_site.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,20 @@ <h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('D
function resizeTable() {
/* So Windows mouse users can see the horizontal scrollbar
https://github.com/CAVaccineInventory/vial/issues/363 */
let container = document.querySelector("#changelist-form .results");
let paginator = document.querySelector("p.paginator");
if (!container || !paginator) {
return;
if (window.matchMedia('screen and (min-width: 800px)').matches) {
let container = document.querySelector("#changelist-form .results");
let paginator = document.querySelector("p.paginator");
if (!container || !paginator) {
return;
}
let height =
window.innerHeight -
container.getBoundingClientRect().top -
paginator.getBoundingClientRect().height -
10;
container.style.overflowY = "auto";
container.style.height = height + "px";
}
let height =
window.innerHeight -
container.getBoundingClientRect().top -
paginator.getBoundingClientRect().height -
10;
container.style.overflowY = "auto";
container.style.height = height + "px";
}

window.addEventListener("load", () => {
Expand Down

0 comments on commit ce0fe4d

Please sign in to comment.