Remove almost all data-hx-boost attributes

Since 16e80b5ae, <body> no longer has overflow, thus no scroll.  As a
consequence, htmx no longer is able to scroll up <main> when it changes
due to the default, implicit `show:true` applied to the request: is
calls <main>’s scrollIntoView, however there is nothing to scroll to.

I probably could fix it by changing the target of `show`, or even add
a `scroll` directive to all boosted links, but at this point i think it
is better no not boost links at all, as they do what i want—show the new
page from the top—with less markup, plus the browser now show a loading
animation, and it is not that slower, too.
This commit is contained in:
jordi fita mas 2024-09-08 01:29:30 +02:00
parent 2eecdcfc3e
commit 82da7f4697
15 changed files with 35 additions and 54 deletions

View File

@ -15,7 +15,7 @@
<body class="filters-visible"> <body class="filters-visible">
<header> <header>
<h1><img src="/static/numerus.svg" alt="Numerus" width="168" height="21"></h1> <h1><img src="/static/numerus.svg" alt="Numerus" width="168" height="21"></h1>
<nav aria-label="{{( pgettext "Main" "title" )}}" data-hx-target="main" data-hx-boost="true"> <nav aria-label="{{( pgettext "Main" "title" )}}">
<ul> <ul>
<li><a{{if requestURIMatches (companyURI "/") }} aria-current="page"{{ end }} href="{{ companyURI "/" }}">{{( pgettext "Dashboard" "nav" )}}</a></li> <li><a{{if requestURIMatches (companyURI "/") }} aria-current="page"{{ end }} 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{{if requestURIHasPrefix (companyURI "/quotes") }} aria-current="page"{{ end }} href="{{ companyURI "/quotes" }}">{{( pgettext "Quotations" "nav" )}}</a></li>
@ -30,9 +30,10 @@
<summary aria-label="{{( gettext "Profile menu" )}}"> <summary aria-label="{{( gettext "Profile menu" )}}">
<i class="ri-user-6-line ri-2x"></i> <i class="ri-user-6-line ri-2x"></i>
</summary> </summary>
<ul role="menu" class="action-menu" data-hx-push-url="false" data-hx-swap="beforeend"> <ul role="menu" class="action-menu">
<li role="presentation"> <li role="presentation">
<a role="menuitem" href="{{ companyURI "/profile" }}" data-hx-boost="true"> <a role="menuitem" href="{{ companyURI "/profile" }}"
data-hx-push-url="false" data-hx-swap="beforeend" data-hx-boost="true">
<i class="ri-user-6-line"></i> <i class="ri-user-6-line"></i>
{{( pgettext "Account" "menu" )}} {{( pgettext "Account" "menu" )}}
</a> </a>
@ -68,7 +69,8 @@
</a> </a>
</li> </li>
<li role="presentation"> <li role="presentation">
<a role="menuitem" href="{{ companyURI "/switch-company" }}" data-hx-boost="true"> <a role="menuitem" href="{{ companyURI "/switch-company" }}"
data-hx-push-url="false" data-hx-swap="beforeend" data-hx-boost="true">
<i class="ri-briefcase-line"></i> <i class="ri-briefcase-line"></i>
{{( pgettext "Switch Company" "menu" )}} {{( pgettext "Switch Company" "menu" )}}
</a> </a>

View File

@ -4,7 +4,7 @@
{{ define "breadcrumbs" -}} {{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.CompanySwitchPage*/ -}} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.CompanySwitchPage*/ -}}
<nav data-hx-target="main" data-hx-boost="true"> <nav>
<p> <p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> / <a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a>{{ template "title" . }}</a> <a>{{ template "title" . }}</a>
@ -14,7 +14,7 @@
{{ define "content" }} {{ define "content" }}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.CompanySwitchPage*/ -}} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.CompanySwitchPage*/ -}}
<section class="dialog-content" id="switch-company-dialog-content" data-hx-target="this"> <section class="dialog-content">
<h2>{{ template "title" . }}</h2> <h2>{{ template "title" . }}</h2>
<table> <table>
<thead> <thead>

View File

@ -4,7 +4,7 @@
{{ define "breadcrumbs" -}} {{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.TaxDetailsPage*/ -}} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.TaxDetailsPage*/ -}}
<nav data-hx-target="main" data-hx-boost="true"> <nav>
<p> <p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> / <a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a>{{ template "title" . }}</a> <a>{{ template "title" . }}</a>

View File

@ -4,7 +4,7 @@
{{ define "breadcrumbs" -}} {{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.ContactsIndexPage*/ -}} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.ContactsIndexPage*/ -}}
<nav data-hx-boost="true" data-hx-target="main"> <nav>
<p> <p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> / <a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a>{{( pgettext "Contacts" "title" )}}</a> <a>{{( pgettext "Contacts" "title" )}}</a>
@ -55,8 +55,7 @@
{{ with .Contacts }} {{ with .Contacts }}
{{- range $contact := . }} {{- range $contact := . }}
<tr> <tr>
<td><a href="{{ companyURI "/contacts/"}}{{ .Slug }}" data-hx-target="main" <td><a href="{{ companyURI "/contacts/"}}{{ .Slug }}">{{ .Name }}</a></td>
data-hx-boost="true">{{ .Name }}</a></td>
<td><a href="mailto:{{ .Email }}">{{ .Email }}</a></td> <td><a href="mailto:{{ .Email }}">{{ .Email }}</a></td>
<td><a href="tel:{{ .Phone }}">{{ .Phone }}</a></td> <td><a href="tel:{{ .Phone }}">{{ .Phone }}</a></td>
<td <td
@ -75,9 +74,7 @@
<summary aria-label="{{ $label }}"><i class="ri-more-line"></i></summary> <summary aria-label="{{ $label }}"><i class="ri-more-line"></i></summary>
<ul role="menu" class="action-menu"> <ul role="menu" class="action-menu">
<li role="presentation"> <li role="presentation">
<a role="menuitem" href="{{ companyURI "/contacts"}}/{{ .Slug }}" <a role="menuitem" href="{{ companyURI "/contacts"}}/{{ .Slug }}">
data-hx-target="main" data-hx-boost="true"
>
<i class="ri-edit-line"></i> <i class="ri-edit-line"></i>
{{( pgettext "Edit" "action" )}} {{( pgettext "Edit" "action" )}}
</a> </a>

View File

@ -5,8 +5,8 @@
{{ define "breadcrumbs" -}} {{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.expensesIndexPage*/ -}} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.expensesIndexPage*/ -}}
<nav data-hx-target="main"> <nav>
<p data-hx-boost="true"> <p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> / <a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a>{{( pgettext "Expenses" "title" )}}</a> <a>{{( pgettext "Expenses" "title" )}}</a>
</p> </p>
@ -28,7 +28,6 @@
name="action" value="export" name="action" value="export"
>{{( pgettext "Export list" "action" )}}</button> >{{( pgettext "Export list" "action" )}}</button>
<a class="primary button" <a class="primary button"
data-hx-boost="true"
href="{{ companyURI "/expenses/new" }}">{{( pgettext "New expense" "action" )}}</a> href="{{ companyURI "/expenses/new" }}">{{( pgettext "New expense" "action" )}}</a>
</p> </p>
</form> </form>
@ -116,9 +115,7 @@
<details class="menu"> <details class="menu">
{{- $label := .InvoiceNumber | printf (gettext "Actions for expense %s") -}} {{- $label := .InvoiceNumber | printf (gettext "Actions for expense %s") -}}
<summary aria-label="{{ $label }}"><i class="ri-more-line"></i></summary> <summary aria-label="{{ $label }}"><i class="ri-more-line"></i></summary>
<ul role="menu" class="action-menu" <ul role="menu" class="action-menu">
data-hx-target="main" data-hx-boost="true"
>
<li role="presentation"> <li role="presentation">
<a role="menuitem" href="{{ companyURI "/expenses"}}/{{ .Slug }}"> <a role="menuitem" href="{{ companyURI "/expenses"}}/{{ .Slug }}">
<i class="ri-edit-line"></i> <i class="ri-edit-line"></i>

View File

@ -5,7 +5,7 @@
{{ define "breadcrumbs" -}} {{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newExpensePage*/ -}} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newExpensePage*/ -}}
<nav data-hx-target="main" data-hx-boost="true"> <nav>
<p> <p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> / <a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a href="{{ companyURI "/expenses"}}">{{( pgettext "Expenses" "title" )}}</a> / <a href="{{ companyURI "/expenses"}}">{{( pgettext "Expenses" "title" )}}</a> /

View File

@ -5,14 +5,13 @@
{{ define "breadcrumbs" -}} {{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.PaymentAccountIndexPage*/ -}} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.PaymentAccountIndexPage*/ -}}
<nav data-hx-target="main"> <nav>
<p data-hx-boost="true"> <p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> / <a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a>{{( pgettext "Payment Accounts" "title" )}}</a> <a>{{( pgettext "Payment Accounts" "title" )}}</a>
</p> </p>
<a class="primary button" <a class="primary button"
data-hx-boost="true"
href="{{ companyURI "/payment-accounts/new" }}">{{( pgettext "New payment account" "action" )}}</a> href="{{ companyURI "/payment-accounts/new" }}">{{( pgettext "New payment account" "action" )}}</a>
</nav> </nav>
{{- end }} {{- end }}

View File

@ -9,8 +9,8 @@
{{ define "breadcrumbs" -}} {{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.PaymentIndexPage*/ -}} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.PaymentIndexPage*/ -}}
<nav data-hx-target="main"> <nav>
<p data-hx-boost="true"> <p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> / <a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
{{ if .Expense }} {{ if .Expense }}
<a href="{{ companyURI "/expenses" }}">{{( pgettext "Expenses" "title" )}}</a> / <a href="{{ companyURI "/expenses" }}">{{( pgettext "Expenses" "title" )}}</a> /
@ -22,9 +22,7 @@
<a>{{ template "title" . }}</a> <a>{{ template "title" . }}</a>
</p> </p>
<a class="primary button" <a class="primary button" href="{{ .BaseURI }}/new">
data-hx-boost="true"
href="{{ .BaseURI }}/new">
{{- if .Invoice -}} {{- if .Invoice -}}
{{( pgettext "New collection" "action" )}} {{( pgettext "New collection" "action" )}}
{{- else -}} {{- else -}}
@ -101,9 +99,7 @@
<summary aria-label="{{ $label }}"><i class="ri-more-line"></i></summary> <summary aria-label="{{ $label }}"><i class="ri-more-line"></i></summary>
<ul role="menu" class="action-menu"> <ul role="menu" class="action-menu">
<li role="presentation"> <li role="presentation">
<a role="menuitem" href="{{ $.BaseURI }}/{{ .Slug }}" <a role="menuitem" href="{{ $.BaseURI }}/{{ .Slug }}">
data-hx-target="main" data-hx-boost="true"
>
<i class="ri-edit-line"></i> <i class="ri-edit-line"></i>
{{( pgettext "Edit" "action" )}} {{( pgettext "Edit" "action" )}}
</a> </a>

View File

@ -9,7 +9,7 @@
{{ define "breadcrumbs" -}} {{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.PaymentForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.PaymentForm*/ -}}
<nav data-hx-target="main" data-hx-boost="true"> <nav>
<p> <p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> / <a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
{{ if .Expense }} {{ if .Expense }}

View File

@ -4,7 +4,7 @@
{{ define "breadcrumbs" -}} {{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.profileForm*/ -}} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.profileForm*/ -}}
<nav data-hx-target="main" data-hx-boost="true"> <nav>
<p> <p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> / <a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a>{{( pgettext "User Settings" "title" )}}</a> <a>{{( pgettext "User Settings" "title" )}}</a>

View File

@ -4,7 +4,7 @@
{{ define "breadcrumbs" -}} {{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.editQuotationPage*/ -}} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.editQuotationPage*/ -}}
<nav data-hx-target="main" data-hx-boost="true"> <nav>
<p> <p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> / <a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a href="{{ companyURI "/quotes"}}">{{( pgettext "Quotations" "title" )}}</a> / <a href="{{ companyURI "/quotes"}}">{{( pgettext "Quotations" "title" )}}</a> /

View File

@ -4,8 +4,8 @@
{{ define "breadcrumbs" -}} {{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.QuotesIndexPage*/ -}} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.QuotesIndexPage*/ -}}
<nav data-hx-target="main"> <nav>
<p data-hx-boost="true"> <p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> / <a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a>{{( pgettext "Quotations" "title" )}}</a> <a>{{( pgettext "Quotations" "title" )}}</a>
</p> </p>
@ -29,7 +29,7 @@
<button type="submit" <button type="submit"
name="action" value="export" name="action" value="export"
>{{( pgettext "Export list" "action" )}}</button> >{{( pgettext "Export list" "action" )}}</button>
<a class="primary button" data-hx-boost="true" <a class="primary button"
href="{{ companyURI "/quotes/new" }}">{{( pgettext "New quotation" "action" )}}</a> href="{{ companyURI "/quotes/new" }}">{{( pgettext "New quotation" "action" )}}</a>
</p> </p>
</form> </form>
@ -84,8 +84,7 @@
aria-label="{{ $title }}" aria-label="{{ $title }}"
title="{{ $title }}"/></td> title="{{ $title }}"/></td>
<td>{{ .Date|formatDate }}</td> <td>{{ .Date|formatDate }}</td>
<td><a href="{{ companyURI "/quotes/"}}{{ .Slug }}" data-hx-target="main" <td><a href="{{ companyURI "/quotes/"}}{{ .Slug }}">{{ .Number }}</a></td>
data-hx-boost="true">{{ .Number }}</a></td>
<td>{{ .CustomerName }}</td> <td>{{ .CustomerName }}</td>
<td> <td>
<details class="quote-status menu"> <details class="quote-status menu">
@ -130,25 +129,19 @@
<summary aria-label="{{ $label }}"><i class="ri-more-line"></i></summary> <summary aria-label="{{ $label }}"><i class="ri-more-line"></i></summary>
<ul role="menu" class="action-menu"> <ul role="menu" class="action-menu">
<li role="presentation"> <li role="presentation">
<a role="menuitem" href="{{ companyURI "/quotes"}}/{{ .Slug }}/edit" <a role="menuitem" href="{{ companyURI "/quotes"}}/{{ .Slug }}/edit">
data-hx-target="main" data-hx-boost="true"
>
<i class="ri-edit-line"></i> <i class="ri-edit-line"></i>
{{( pgettext "Edit" "action" )}} {{( pgettext "Edit" "action" )}}
</a> </a>
</li> </li>
<li role="presentation"> <li role="presentation">
<a role="menuitem" href="{{ companyURI "/quotes/new"}}?duplicate={{ .Slug }}" <a role="menuitem" href="{{ companyURI "/quotes/new"}}?duplicate={{ .Slug }}">
data-hx-target="main" data-hx-boost="true"
>
<i class="ri-file-copy-line"></i> <i class="ri-file-copy-line"></i>
{{( pgettext "Duplicate" "action" )}} {{( pgettext "Duplicate" "action" )}}
</a> </a>
</li> </li>
<li role="presentation"> <li role="presentation">
<a role="menuitem" href="{{ companyURI "/invoices/new"}}?quote={{ .Slug }}" <a role="menuitem" href="{{ companyURI "/invoices/new"}}?quote={{ .Slug }}">
data-hx-target="main" data-hx-boost="true"
>
<i class="ri-bill-line"></i> <i class="ri-bill-line"></i>
{{( pgettext "Create invoice" "action" )}} {{( pgettext "Create invoice" "action" )}}
</a> </a>

View File

@ -4,7 +4,7 @@
{{ define "breadcrumbs" -}} {{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newQuotePage*/ -}} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newQuotePage*/ -}}
<nav data-hx-target="main" data-hx-boost="true"> <nav>
<p> <p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> / <a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a href="{{ companyURI "/quotes"}}">{{( pgettext "Quotations" "title" )}}</a> / <a href="{{ companyURI "/quotes"}}">{{( pgettext "Quotations" "title" )}}</a> /

View File

@ -4,7 +4,7 @@
{{ define "breadcrumbs" -}} {{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newQuoteProductsPage*/ -}} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newQuoteProductsPage*/ -}}
<nav data-hx-target="main" data-hx-boost="true"> <nav>
<p> <p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> / <a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a href="{{ companyURI "/quotes"}}">{{( pgettext "Quotations" "title" )}}</a> / <a href="{{ companyURI "/quotes"}}">{{( pgettext "Quotations" "title" )}}</a> /

View File

@ -5,20 +5,17 @@
{{ define "breadcrumbs" -}} {{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.quote*/ -}} {{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.quote*/ -}}
<nav> <nav>
<p data-hx-target="main" data-hx-boost="true"> <p>
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> / <a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a href="{{ companyURI "/quotes"}}">{{( pgettext "Quotations" "title" )}}</a> / <a href="{{ companyURI "/quotes"}}">{{( pgettext "Quotations" "title" )}}</a> /
<a>{{ .Number }}</a> <a>{{ .Number }}</a>
</p> </p>
<p> <p>
<a class="button primary" <a class="button primary"
data-hx-target="main" data-hx-boost="true"
href="{{ companyURI "/invoices/new"}}?quote={{ .Slug }}">{{( pgettext "Create invoice" "action" )}}</a> href="{{ companyURI "/invoices/new"}}?quote={{ .Slug }}">{{( pgettext "Create invoice" "action" )}}</a>
<a class="button primary" <a class="button primary"
data-hx-target="main" data-hx-boost="true"
href="{{ companyURI "/quotes/new"}}?duplicate={{ .Slug }}">{{( pgettext "Duplicate" "action" )}}</a> href="{{ companyURI "/quotes/new"}}?duplicate={{ .Slug }}">{{( pgettext "Duplicate" "action" )}}</a>
<a class="button primary" <a class="button primary"
data-hx-target="main" data-hx-boost="true"
href="{{ companyURI "/quotes/"}}{{ .Slug }}/edit">{{( pgettext "Edit" "action" )}}</a> href="{{ companyURI "/quotes/"}}{{ .Slug }}/edit">{{( pgettext "Edit" "action" )}}</a>
<a class="primary button" <a class="primary button"
href="{{ companyURI "/quotes/" }}{{ .Slug }}.pdf" href="{{ companyURI "/quotes/" }}{{ .Slug }}.pdf"