Browse Source

feat(shortcodes): add value attr to button

Josh Habdas 1 year ago
parent
commit
fbf744e757
Signed by: Josh Habdas <jhabdas@protonmail.com> GPG Key ID: B148B31154C75A74
2 changed files with 4 additions and 2 deletions
  1. 1
    0
      layouts/partials/components/button.html
  2. 3
    2
      layouts/shortcodes/hackcss-button.html

+ 1
- 0
layouts/partials/components/button.html View File

@@ -1,6 +1,7 @@
1 1
 <button
2 2
   {{ with .id }}id="{{ . | urlize }}" {{ end }}
3 3
   {{ with .action }}formaction="{{ . | safeURL }}" {{ end }}
4
+  {{ with .value }}value="{{ . | safeHTMLAttr }}" {{ end }}
4 5
   {{ with .target }}formtarget="{{ . }}" {{ end }}
5 6
   {{ with .tabindex }}tabindex="{{ . }}" {{ end }}
6 7
   {{ with .onclick }}onclick={{ . | safeJS }} {{ end }}

+ 3
- 2
layouts/shortcodes/hackcss-button.html View File

@@ -1,5 +1,5 @@
1 1
 <!-- {{/*
2
-HTML attributes: "id", "action", "onclick", "tabindex", "target", "method", "disabled"
2
+HTML attributes: "id", "action", "value", "onclick", "tabindex", "target", "method", "disabled"
3 3
 Custom attributes: "type", "text", "isghost", "isblock"
4 4
 
5 5
 Available types: [default], "primary", "success", "info", "warning", "error"
@@ -35,9 +35,10 @@ Inside a button group:
35 35
 {{ $isblock := .Get "isblock" }}
36 36
 {{ $id := .Get "id" }}
37 37
 {{ $action := .Get "action" }}
38
+{{ $value := .Get "value" }}
38 39
 {{ $onclick := .Get "onclick" }}
39 40
 {{ $disabled := .Get "disabled" }}
40 41
 {{ $tabindex := .Get "tabindex" }}
41 42
 {{ $target := .Get "target" }}
42 43
 {{ $method := .Get "method" }}
43
-{{ partial "components/button.html" (dict "type" $type "body" $body "isghost" $isghost "isblock" $isblock "action" $action "onclick" $onclick "disabled" $disabled "tabindex" $tabindex "target" $target "method" $method) }}
44
+{{ partial "components/button.html" (dict "type" $type "body" $body "isghost" $isghost "isblock" $isblock "action" $action "value" $value "onclick" $onclick "disabled" $disabled "tabindex" $tabindex "target" $target "method" $method) }}

Loading…
Cancel
Save