use bootstrap CSS classes for form elements
This commit is contained in:
parent
658420af94
commit
add89bcf2a
6 changed files with 12 additions and 11 deletions
|
@ -1 +0,0 @@
|
||||||
<button type="{{ .type }}" name="{{ .name }}">{{.label}}</button>
|
|
|
@ -1,6 +1,5 @@
|
||||||
{{- $type := .Get "type" | default "button" -}}
|
{{- $type := .Get "type" | default "submit" -}}
|
||||||
{{- $name := .Get "name" | default "submit" -}}
|
{{- $name := .Get "name" | default "submit" -}}
|
||||||
{{- $label := .Get "label" | default (title $name) -}}
|
{{- $label := .Get "label" | default (title $name) -}}
|
||||||
|
<button type="{{ $type }}"
|
||||||
{{- $params := dict "type" $type "name" $name "label" $label -}}
|
class="btn btn-primary">{{ $label }}</button>
|
||||||
{{ partial "hx/button" $params }}
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
{{- $type := .Get "type" | default "text" -}}
|
{{- $type := .Get "type" | default "text" -}}
|
||||||
{{- $name := .Get "name" | default "textline" -}}
|
{{- $name := .Get "name" | default "textline" -}}
|
||||||
|
{{- $label := .Get "label" | default $name -}}
|
||||||
<div>
|
<div>
|
||||||
<input type="{{ $type }}" name="{{ $name }}"
|
<label class="form-label">{{- $label -}}</label>
|
||||||
|
<input type="{{ $type }}" name="{{ $name }}" class="form-control"
|
||||||
{{- with .Get "attrs" }} {{ . }}{{ end }}>
|
{{- with .Get "attrs" }} {{ . }}{{ end }}>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,5 +7,4 @@
|
||||||
<form name="{{ $name }}" hx-target="{{ $target }}"
|
<form name="{{ $name }}" hx-target="{{ $target }}"
|
||||||
hx-post="{{ $root }}/{{ $domain }}/{{ $action }}">
|
hx-post="{{ $root }}/{{ $domain }}/{{ $action }}">
|
||||||
{{ .Inner }}
|
{{ .Inner }}
|
||||||
<button>{{ $label }}</button>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
<button hx-get="/app/demo/"
|
<button class="btn btn-info"
|
||||||
|
hx-get="/app/demo/"
|
||||||
hx-select="[itemprop=articleBody] p">
|
hx-select="[itemprop=articleBody] p">
|
||||||
Hello World!
|
Hello World!
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<form hx-post="/hx/test/data" hx-target="#cs-debug">
|
<form hx-post="/hx/test/data" hx-target="#cs-debug">
|
||||||
<input name="info">
|
<input name="info">
|
||||||
<button>Post to API</button>
|
<button class="btn btn-primary">Post to API</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -22,8 +22,9 @@ Please enter login data:
|
||||||
|
|
||||||
{{< hx/data-form name="login" action="login" >}}
|
{{< hx/data-form name="login" action="login" >}}
|
||||||
|
|
||||||
Login: {{< hx/data-field-line name="login" attrs="autofocus" >}}
|
{{< hx/data-field-line name="login" label="Login" attrs="autofocus" >}}
|
||||||
Password: {{< hx/data-field-line type="password" name="password" >}}
|
{{< hx/data-field-line type="password" name="password" label="Password" >}}
|
||||||
|
{{< hx/button label="Login" >}}
|
||||||
|
|
||||||
{{< /hx/data-form >}}
|
{{< /hx/data-form >}}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue