Wrap filter buttons with <noscript>

Since forms are already submitted on change, Oriol does not like the
idea of having a useless button around breaking the form grid.
This commit is contained in:
jordi fita mas 2023-05-23 14:34:46 +02:00
parent e974406870
commit 9096cfe4f2
5 changed files with 19 additions and 7 deletions

View File

@ -29,7 +29,9 @@
{{ template "tags-field" .Tags | addTagsAttr (print `data-conditions="` .TagsCondition.Name `-field"`) }} {{ template "tags-field" .Tags | addTagsAttr (print `data-conditions="` .TagsCondition.Name `-field"`) }}
{{ template "toggle-field" .TagsCondition }} {{ template "toggle-field" .TagsCondition }}
{{ end }} {{ end }}
<button type="submit">{{( pgettext "Filter" "action" )}}</button> <noscript>
<button type="submit">{{( pgettext "Filter" "action" )}}</button>
</noscript>
</form> </form>
</div> </div>
<table> <table>
@ -46,7 +48,8 @@
{{ with .Contacts }} {{ with .Contacts }}
{{- range $contact := . }} {{- range $contact := . }}
<tr> <tr>
<td><a href="{{ companyURI "/contacts/"}}{{ .Slug }}" data-hx-target="main" data-hx-boost="true">{{ .Name }}</a></td> <td><a href="{{ companyURI "/contacts/"}}{{ .Slug }}" data-hx-target="main"
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

View File

@ -19,7 +19,9 @@
{{ with .Filters }} {{ with .Filters }}
{{ template "radio-field" .Period }} {{ template "radio-field" .Period }}
{{ end }} {{ end }}
<button type="submit">{{( pgettext "Filter" "action" )}}</button> <noscript>
<button type="submit">{{( pgettext "Filter" "action" )}}</button>
</noscript>
</form> </form>
</div> </div>
<dl id="income-statement"> <dl id="income-statement">

View File

@ -31,7 +31,9 @@
{{ template "tags-field" .Tags | addTagsAttr (print `data-conditions="` .TagsCondition.Name `-field"`) }} {{ template "tags-field" .Tags | addTagsAttr (print `data-conditions="` .TagsCondition.Name `-field"`) }}
{{ template "toggle-field" .TagsCondition }} {{ template "toggle-field" .TagsCondition }}
{{ end }} {{ end }}
<button type="submit">{{( pgettext "Filter" "action" )}}</button> <noscript>
<button type="submit">{{( pgettext "Filter" "action" )}}</button>
</noscript>
</form> </form>
</div> </div>
<table> <table>

View File

@ -37,7 +37,9 @@
{{ template "tags-field" .Tags | addTagsAttr (print `data-conditions="` .TagsCondition.Name `-field"`) }} {{ template "tags-field" .Tags | addTagsAttr (print `data-conditions="` .TagsCondition.Name `-field"`) }}
{{ template "toggle-field" .TagsCondition }} {{ template "toggle-field" .TagsCondition }}
{{ end }} {{ end }}
<button type="submit">{{( pgettext "Filter" "action" )}}</button> <noscript>
<button type="submit">{{( pgettext "Filter" "action" )}}</button>
</noscript>
</form> </form>
</div> </div>
<table class="no-padding"> <table class="no-padding">

View File

@ -29,7 +29,9 @@
{{ template "tags-field" .Tags | addTagsAttr (print `data-conditions="` .TagsCondition.Name `-field"`) }} {{ template "tags-field" .Tags | addTagsAttr (print `data-conditions="` .TagsCondition.Name `-field"`) }}
{{ template "toggle-field" .TagsCondition }} {{ template "toggle-field" .TagsCondition }}
{{ end }} {{ end }}
<button type="submit">{{( pgettext "Filter" "action" )}}</button> <noscript>
<button type="submit">{{( pgettext "Filter" "action" )}}</button>
</noscript>
</form> </form>
</div> </div>
<table> <table>
@ -45,7 +47,8 @@
{{ with .Products }} {{ with .Products }}
{{- range $product := . }} {{- range $product := . }}
<tr> <tr>
<td><a href="{{ companyURI "/products/"}}{{ .Slug }}" data-hx-target="main" data-hx-boost="true">{{ .Name }}</a></td> <td><a href="{{ companyURI "/products/"}}{{ .Slug }}" data-hx-target="main"
data-hx-boost="true">{{ .Name }}</a></td>
<td <td
data-hx-get="{{companyURI "/products/"}}{{ .Slug }}/tags/edit" data-hx-get="{{companyURI "/products/"}}{{ .Slug }}/tags/edit"
data-hx-target="this" data-hx-target="this"