Merge remote-tracking branch 'origin/main' into billing-thanks
2 files changed,
+10
−2
internal/console/templates/billing.html+2 −2internal/console/templates/layout.html+8 −0
CI passed — run details
diff --git a/internal/console/templates/billing.html b/internal/console/templates/billing.html| index 2a1a82d8d..cecc780b8 100644 |
| --- a/internal/console/templates/billing.html |
| +++ b/internal/console/templates/billing.html |
| @@ -99,7 +99,7 @@ |
| <table class="packs" aria-labelledby="packs-title"> |
| {{range .Packs}}<tr data-pack="{{.Name}}"> |
| <td><label for="pack-{{.Name}}">{{.Label}}</label>{{if .Adds}}<span class="small" id="pack-{{.Name}}-adds">{{.Adds}}</span>{{end}}</td> |
| - <td><input type="number" id="pack-{{.Name}}" name="pack_{{.Name}}" min="0" max="{{.Max}}" step="1" value="{{.Value}}" inputmode="numeric"{{if .Adds}} aria-describedby="pack-{{.Name}}-adds"{{end}}></td> |
| + <td><input type="number" id="pack-{{.Name}}" name="pack_{{.Name}}" min="0" max="{{.Max}}" step="1" value="{{.Value}}" inputmode="numeric" data-select{{if .Adds}} aria-describedby="pack-{{.Name}}-adds"{{end}}></td> |
| <td>{{range .Prices}}<span class="small price price-{{.Code}}" data-currency="{{.Code}}">{{.Text}}</span> |
| {{end}}</td> |
| </tr> |
| @@ -121,7 +121,7 @@ |
| <td><form method="post" action="{{$.Base}}/billing/change"> |
| <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| <input type="hidden" name="pack" value="{{.Name}}"> |
| - <input type="number" id="change-{{.Name}}" name="quantity" value="{{.Value}}" min="0" max="{{.Max}}" step="1" inputmode="numeric"{{if .Adds}} aria-describedby="change-{{.Name}}-adds"{{end}}> |
| + <input type="number" id="change-{{.Name}}" name="quantity" value="{{.Value}}" min="0" max="{{.Max}}" step="1" inputmode="numeric" data-select{{if .Adds}} aria-describedby="change-{{.Name}}-adds"{{end}}> |
| <button class="btn-sm btn-secondary" type="submit">{{billingText "button.change"}}</button> |
| </form></td> |
| </tr> |
diff --git a/internal/console/templates/layout.html b/internal/console/templates/layout.html| index ccfb16369..20b5604da 100644 |
| --- a/internal/console/templates/layout.html |
| +++ b/internal/console/templates/layout.html |
| @@ -799,6 +799,14 @@ |
| f.submit(); |
| }, minBusy); |
| }); |
| + // A quantity box marked data-select selects its number when it gets |
| + // focus, so typing replaces the 0 instead of adding to it. |
| + document.addEventListener("focusin", function (e) { |
| + var t = e.target; |
| + if (t.matches && t.matches("input[data-select]")) { |
| + setTimeout(function () { t.select(); }, 0); |
| + } |
| + }); |
| // Coming back with the Back button restores the page from cache with the |
| // button still busy; give it back. |
| window.addEventListener("pageshow", function (e) { |