Compare commits

..

No commits in common. "e34ef4f458101610e9cd854056a92eedd8792f83" and "c3e1597972f0401bc8bc757c2503dd508f9007fb" have entirely different histories.

5 changed files with 14 additions and 33 deletions

View File

@ -10,7 +10,6 @@ import (
"math" "math"
"net/http" "net/http"
"strconv" "strconv"
"strings"
"time" "time"
) )
@ -31,12 +30,6 @@ func mustRenderTemplate(wr io.Writer, r *http.Request, layout string, filename s
"currentLocale": func() string { "currentLocale": func() string {
return locale.Language.String() return locale.Language.String()
}, },
"requestURIMatches": func(uri string) bool {
return r.RequestURI == uri
},
"requestURIHasPrefix": func(uri string) bool {
return strings.HasPrefix(r.RequestURI, uri)
},
"companyURI": func(uri string) string { "companyURI": func(uri string) string {
return companyURI(company, uri) return companyURI(company, uri)
}, },

View File

@ -562,12 +562,10 @@ ul[role="menu"].action-menu li i[class^='ri-'] {
text-decoration: underline; text-decoration: underline;
} }
body > nav a[aria-current] {
background-color: yellow;
}
/* menu tauler final */ /* menu tauler final */
main > nav { main > nav {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -1040,6 +1038,10 @@ div[x-data="snackbar"] div[role="alert"].enter.end, div[x-data="snackbar"] div[r
min-width: 33rem; min-width: 33rem;
} }
#income-statement div:first-child {
background-color: var(--numerus--color--yellow);
}
#income-statement div:nth-child(2) { #income-statement div:nth-child(2) {
background-color: var(--numerus--color--green); background-color: var(--numerus--color--green);
} }

View File

@ -753,19 +753,3 @@ htmx.on(document, 'alpine:init', () => {
}, },
})); }));
}); });
function updateCurrentMenuItem() {
const path = window.location.pathname;
const items = document.querySelectorAll('body > nav a');
items.forEach((item, i) => {
const matches = path === item.pathname;
if (matches || (i !== 0 && path.startsWith(item.pathname))) {
item.setAttribute('aria-current', 'page');
} else {
item.removeAttribute('aria-current');
}
});
}
htmx.on('htmx:pushedIntoHistory', updateCurrentMenuItem);
htmx.on('htmx:replacedInHistory', updateCurrentMenuItem);

View File

@ -50,12 +50,12 @@
</header> </header>
<nav aria-label="{{( pgettext "Main" "title" )}}" data-hx-target="main" data-hx-boost="true"> <nav aria-label="{{( pgettext "Main" "title" )}}" data-hx-target="main" data-hx-boost="true">
<ul> <ul>
<li><a{{if requestURIMatches (companyURI "/") }} aria-current="page"{{ end }} href="{{ companyURI "/" }}">{{( pgettext "Dashboard" "nav" )}}</a></li> <li><a href="{{ companyURI "/" }}">{{( pgettext "Dashboard" "nav" )}}</a></li>
<li><a{{if requestURIHasPrefix (companyURI "/quotes") }} aria-current="page"{{ end }} href="{{ companyURI "/quotes" }}">{{( pgettext "Quotations" "nav" )}}</a></li> <li><a href="{{ companyURI "/quotes" }}">{{( pgettext "Quotations" "nav" )}}</a></li>
<li><a{{if requestURIHasPrefix (companyURI "/invoices") }} aria-current="page"{{ end }} href="{{ companyURI "/invoices" }}">{{( pgettext "Invoices" "nav" )}}</a></li> <li><a href="{{ companyURI "/invoices" }}">{{( pgettext "Invoices" "nav" )}}</a></li>
<li><a{{if requestURIHasPrefix (companyURI "/expenses") }} aria-current="page"{{ end }} href="{{ companyURI "/expenses" }}">{{( pgettext "Expenses" "nav" )}}</a></li> <li><a href="{{ companyURI "/expenses" }}">{{( pgettext "Expenses" "nav" )}}</a></li>
<li><a{{if requestURIHasPrefix (companyURI "/products") }} aria-current="page"{{ end }} href="{{ companyURI "/products" }}">{{( pgettext "Products" "nav" )}}</a></li> <li><a href="{{ companyURI "/products" }}">{{( pgettext "Products" "nav" )}}</a></li>
<li><a{{if requestURIHasPrefix (companyURI "/contacts") }} aria-current="page"{{ end }} href="{{ companyURI "/contacts" }}">{{( pgettext "Contacts" "nav" )}}</a></li> <li><a href="{{ companyURI "/contacts" }}">{{( pgettext "Contacts" "nav" )}}</a></li>
</ul> </ul>
</nav> </nav>
<main> <main>

View File

@ -26,6 +26,8 @@
</div> </div>
<dl id="income-statement"> <dl id="income-statement">
<div> <div>
<dt>{{ (pgettext "Sales" "term") }}</dt>
<dd>{{ formatPriceSpan .Sales }}</dd>
</div> </div>
<div> <div>
<dt>{{ (pgettext "Income" "term") }}</dt> <dt>{{ (pgettext "Income" "term") }}</dt>