Remove scroll after update quote or invoice form
By default, when using hx-boost, HTMx adds the `show:top` modifier to `hx-swap`. This is actually the wanted behaviour in these cases, because it means that you are following a link to a “different” page, and it makes sense to start from the top. However, for quote and invoice forms is a hindrance because you are usually editing the bottom-most product, as new lines are appended, therefore you are all the time having to scroll down to the line. Every. Single. Time. Here i reverted the show:top to just show:false to keep the scroll as is. I also added the show:bottom to the new product button, because that way the window show entirely the new line. I could not use `show🪟bottom`, however, despite appearing in the documentation, because that, somehow, ended up doing the same as `show🪟top`. Not sure if a bug or something i did not understand. Closes #58.
This commit is contained in:
parent
596120d84a
commit
d697b340e9
|
@ -17,7 +17,10 @@
|
||||||
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.editInvoicePage*/ -}}
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.editInvoicePage*/ -}}
|
||||||
<section id="invoice-dialog-content" data-hx-target="main">
|
<section id="invoice-dialog-content" data-hx-target="main">
|
||||||
<h2>{{ printf (pgettext "Edit Invoice “%s”" "title") .Number }}</h2>
|
<h2>{{ printf (pgettext "Edit Invoice “%s”" "title") .Number }}</h2>
|
||||||
<form method="POST" action="{{ companyURI "/invoices/" }}{{ .Slug }}/edit" data-hx-boost="true">
|
<form method="POST" action="{{ companyURI "/invoices/" }}{{ .Slug }}/edit"
|
||||||
|
data-hx-boost="true"
|
||||||
|
data-hx-swap="innerHTML show:false"
|
||||||
|
>
|
||||||
{{ csrfToken }}
|
{{ csrfToken }}
|
||||||
|
|
||||||
{{ with .Form -}}
|
{{ with .Form -}}
|
||||||
|
@ -78,7 +81,8 @@
|
||||||
<button formnovalidate
|
<button formnovalidate
|
||||||
name="action" value="select-products"
|
name="action" value="select-products"
|
||||||
data-hx-get="{{ companyURI "/invoices/product-form" }}"
|
data-hx-get="{{ companyURI "/invoices/product-form" }}"
|
||||||
data-hx-target="#invoice-summary" data-hx-swap="beforebegin"
|
data-hx-target="#invoice-summary"
|
||||||
|
data-hx-swap="beforebegin show:bottom"
|
||||||
data-hx-select="unset"
|
data-hx-select="unset"
|
||||||
data-hx-vals="js:{index: document.querySelectorAll('.new-invoice-product').length}"
|
data-hx-vals="js:{index: document.querySelectorAll('.new-invoice-product').length}"
|
||||||
type="submit">{{( pgettext "Add products" "action" )}}</button>
|
type="submit">{{( pgettext "Add products" "action" )}}</button>
|
||||||
|
|
|
@ -17,7 +17,10 @@
|
||||||
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newInvoicePage*/ -}}
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newInvoicePage*/ -}}
|
||||||
<section id="invoice-dialog-content" data-hx-target="main">
|
<section id="invoice-dialog-content" data-hx-target="main">
|
||||||
<h2>{{(pgettext "New Invoice" "title")}}</h2>
|
<h2>{{(pgettext "New Invoice" "title")}}</h2>
|
||||||
<form method="POST" action="{{ companyURI "/invoices/new" }}" data-hx-boost="true">
|
<form method="POST" action="{{ companyURI "/invoices/new" }}"
|
||||||
|
data-hx-boost="true"
|
||||||
|
data-hx-swap="innerHTML show:false"
|
||||||
|
>
|
||||||
{{ csrfToken }}
|
{{ csrfToken }}
|
||||||
|
|
||||||
{{ with .Form -}}
|
{{ with .Form -}}
|
||||||
|
@ -77,7 +80,8 @@
|
||||||
<button formnovalidate
|
<button formnovalidate
|
||||||
name="action" value="select-products"
|
name="action" value="select-products"
|
||||||
data-hx-get="{{ companyURI "/invoices/product-form" }}"
|
data-hx-get="{{ companyURI "/invoices/product-form" }}"
|
||||||
data-hx-target="#invoice-summary" data-hx-swap="beforebegin"
|
data-hx-target="#invoice-summary"
|
||||||
|
data-hx-swap="beforebegin show:bottom"
|
||||||
data-hx-select="unset"
|
data-hx-select="unset"
|
||||||
data-hx-vals="js:{index: document.querySelectorAll('.new-invoice-product').length}"
|
data-hx-vals="js:{index: document.querySelectorAll('.new-invoice-product').length}"
|
||||||
type="submit">{{( pgettext "Add products" "action" )}}</button>
|
type="submit">{{( pgettext "Add products" "action" )}}</button>
|
||||||
|
|
|
@ -17,7 +17,10 @@
|
||||||
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.editQuotationPage*/ -}}
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.editQuotationPage*/ -}}
|
||||||
<section id="quote-dialog-content" data-hx-target="main">
|
<section id="quote-dialog-content" data-hx-target="main">
|
||||||
<h2>{{ printf (pgettext "Edit Quotation “%s”" "title") .Number }}</h2>
|
<h2>{{ printf (pgettext "Edit Quotation “%s”" "title") .Number }}</h2>
|
||||||
<form method="POST" action="{{ companyURI "/quotes/" }}{{ .Slug }}/edit" data-hx-boost="true">
|
<form method="POST" action="{{ companyURI "/quotes/" }}{{ .Slug }}/edit"
|
||||||
|
data-hx-boost="true"
|
||||||
|
data-hx-swap="innerHTML show:false"
|
||||||
|
>
|
||||||
{{ csrfToken }}
|
{{ csrfToken }}
|
||||||
|
|
||||||
{{ with .Form -}}
|
{{ with .Form -}}
|
||||||
|
@ -79,7 +82,8 @@
|
||||||
<button formnovalidate
|
<button formnovalidate
|
||||||
name="action" value="select-products"
|
name="action" value="select-products"
|
||||||
data-hx-get="{{ companyURI "/quotes/product-form" }}"
|
data-hx-get="{{ companyURI "/quotes/product-form" }}"
|
||||||
data-hx-target="#quote-summary" data-hx-swap="beforebegin"
|
data-hx-target="#quote-summary"
|
||||||
|
data-hx-swap="beforebegin show:bottom"
|
||||||
data-hx-select="unset"
|
data-hx-select="unset"
|
||||||
data-hx-vals="js:{index: document.querySelectorAll('.new-quote-product').length}"
|
data-hx-vals="js:{index: document.querySelectorAll('.new-quote-product').length}"
|
||||||
type="submit">{{( pgettext "Add products" "action" )}}</button>
|
type="submit">{{( pgettext "Add products" "action" )}}</button>
|
||||||
|
|
|
@ -17,7 +17,10 @@
|
||||||
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newQuotePage*/ -}}
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.newQuotePage*/ -}}
|
||||||
<section id="quote-dialog-content" data-hx-target="main">
|
<section id="quote-dialog-content" data-hx-target="main">
|
||||||
<h2>{{(pgettext "New Quotation" "title")}}</h2>
|
<h2>{{(pgettext "New Quotation" "title")}}</h2>
|
||||||
<form method="POST" action="{{ companyURI "/quotes/new" }}" data-hx-boost="true">
|
<form method="POST" action="{{ companyURI "/quotes/new" }}"
|
||||||
|
data-hx-boost="true"
|
||||||
|
data-hx-swap="innerHTML show:false"
|
||||||
|
>
|
||||||
{{ csrfToken }}
|
{{ csrfToken }}
|
||||||
|
|
||||||
{{ with .Form -}}
|
{{ with .Form -}}
|
||||||
|
@ -78,7 +81,8 @@
|
||||||
<button formnovalidate
|
<button formnovalidate
|
||||||
name="action" value="select-products"
|
name="action" value="select-products"
|
||||||
data-hx-get="{{ companyURI "/quotes/product-form" }}"
|
data-hx-get="{{ companyURI "/quotes/product-form" }}"
|
||||||
data-hx-target="#quote-summary" data-hx-swap="beforebegin"
|
data-hx-target="#quote-summary"
|
||||||
|
data-hx-swap="beforebegin show:bottom"
|
||||||
data-hx-select="unset"
|
data-hx-select="unset"
|
||||||
data-hx-vals="js:{index: document.querySelectorAll('.new-quote-product').length}"
|
data-hx-vals="js:{index: document.querySelectorAll('.new-quote-product').length}"
|
||||||
type="submit">{{( pgettext "Add products" "action" )}}</button>
|
type="submit">{{( pgettext "Add products" "action" )}}</button>
|
||||||
|
|
Loading…
Reference in New Issue