diff --git a/nummi/main/static/main/css/main.css b/nummi/main/static/main/css/main.css index f562459..602f2de 100644 --- a/nummi/main/static/main/css/main.css +++ b/nummi/main/static/main/css/main.css @@ -116,7 +116,7 @@ main { row-gap: var(--gap); grid-template-columns: 100%; @media (width > 720px) { - grid-template-columns: max-content 1fr; + grid-template-columns: minmax(20rem, max-content) 1fr; } & > section > :first-child { @@ -334,3 +334,23 @@ ul.messages { } } } + +.accounts { + display: grid; + grid-row-gap: 0.5rem; + + dl { + margin: 0; + .account { + padding: 0.5rem; + margin-bottom: 0.5rem; + border: 1px solid var(--gray); + + display: grid; + grid-template-columns: 1fr min-content; + } + &:not(.show-archive) .account.archived { + display: none; + } + } +} diff --git a/nummi/main/static/main/css/table.css b/nummi/main/static/main/css/table.css index 478dd33..e93c777 100644 --- a/nummi/main/static/main/css/table.css +++ b/nummi/main/static/main/css/table.css @@ -33,9 +33,6 @@ table { border-style: dashed; } } - &:not(.show-archive) tr.archived { - display: none; - } td, th { padding: 0 var(--gap); diff --git a/nummi/main/static/main/js/index.js b/nummi/main/static/main/js/index.js index d506bf1..88438b2 100644 --- a/nummi/main/static/main/js/index.js +++ b/nummi/main/static/main/js/index.js @@ -1,8 +1,10 @@ -for (let table of document.querySelectorAll("table")) { - let btn = table.querySelector("button.show-archive"); - if (btn) { - btn.addEventListener("click", (event) => { - table.classList.toggle("show-archive"); - }); - } +let accounts = document.querySelector(".accounts"); +let toggle = accounts.querySelector("input#show-archived-accounts"); +let dl = accounts.querySelector("dl"); + +dl.classList.toggle("show-archive", toggle.checked); +if (toggle) { + toggle.addEventListener("change", (event) => { + dl.classList.toggle("show-archive", toggle.checked); + }); } diff --git a/nummi/main/templates/main/index.html b/nummi/main/templates/main/index.html index 5a55b85..01006f1 100644 --- a/nummi/main/templates/main/index.html +++ b/nummi/main/templates/main/index.html @@ -12,55 +12,23 @@
{% translate "Account" %} | -{% translate "Balance" %} | -{% translate "Edit" %} | -|
---|---|---|---|
{{ acc.icon|remix }} | -- {{ acc }} - | -- {% if acc.statement_set.first %}{{ acc.statement_set.first.value|value }}{% endif %} - | -- {% translate "Edit" %} - | -
{% translate "No account" %} | -|||
{{ "functions"|remix }} | -{% translate "Total" %} | -{{ accounts|balance|value }} | -- |
- {% translate "Create account" %} - | -|||
- - | -