diff options
author | silverwind <me@silverwind.io> | 2020-09-11 22:19:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-11 16:19:00 -0400 |
commit | ffddf3f8a6ca5e3db46e5731d717a55eb58e858f (patch) | |
tree | de8b73f1346e81d2bb9acf042bd33eafd0df26c1 /modules/templates | |
parent | 26c4a049da178993e5ccddcb50e7edc70a6bde5d (diff) | |
download | gitea-ffddf3f8a6ca5e3db46e5731d717a55eb58e858f.tar.gz gitea-ffddf3f8a6ca5e3db46e5731d717a55eb58e858f.zip |
Make SVG size argument optional (#12814)
Now defaults to 16 on both frontend and backend.
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'modules/templates')
-rw-r--r-- | modules/templates/helper.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 9037af8991..9e1c2fd381 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -470,7 +470,10 @@ var heightRe = regexp.MustCompile(`height="[0-9]+?"`) // SVG render icons - arguments icon name (string), size (int), class (string) func SVG(icon string, others ...interface{}) template.HTML { - var size = others[0].(int) + size := 16 + if len(others) > 0 && others[0].(int) != 0 { + size = others[0].(int) + } class := "" if len(others) > 1 && others[1].(string) != "" { |