From 59335bd83a8a2041337f92c7e96bc7c4bd40ac2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Niclas=20Oelschl=C3=A4ger?= Date: Fri, 9 Feb 2024 13:45:24 +0100 Subject: [PATCH 1/5] enhancement: Change webhook-type in create-view --- routers/web/repo/setting/webhook.go | 1 + .../repo/settings/webhook/base_list.tmpl | 47 +---------------- .../repo/settings/webhook/link_menu.tmpl | 50 +++++++++++++++++++ templates/shared/webhook/icon.tmpl | 22 ++++---- templates/webhook/new.tmpl | 9 +++- 5 files changed, 70 insertions(+), 59 deletions(-) create mode 100644 templates/repo/settings/webhook/link_menu.tmpl diff --git a/routers/web/repo/setting/webhook.go b/routers/web/repo/setting/webhook.go index ab3c70006f795..c12d7e82a6672 100644 --- a/routers/web/repo/setting/webhook.go +++ b/routers/web/repo/setting/webhook.go @@ -151,6 +151,7 @@ func WebhooksNew(ctx *context.Context) { } } ctx.Data["BaseLink"] = orCtx.LinkNew + ctx.Data["BaseLinkNew"] = orCtx.LinkNew ctx.HTML(http.StatusOK, orCtx.NewTemplate) } diff --git a/templates/repo/settings/webhook/base_list.tmpl b/templates/repo/settings/webhook/base_list.tmpl index ed6e670d60c78..5a3fc0e7b88d9 100644 --- a/templates/repo/settings/webhook/base_list.tmpl +++ b/templates/repo/settings/webhook/base_list.tmpl @@ -3,52 +3,7 @@
diff --git a/templates/repo/settings/webhook/link_menu.tmpl b/templates/repo/settings/webhook/link_menu.tmpl new file mode 100644 index 0000000000000..2cf9843263c51 --- /dev/null +++ b/templates/repo/settings/webhook/link_menu.tmpl @@ -0,0 +1,50 @@ +{{$size := 20}} +{{if .Size}} + {{$size = .Size}} +{{end}} + \ No newline at end of file diff --git a/templates/shared/webhook/icon.tmpl b/templates/shared/webhook/icon.tmpl index 84f9de266fab6..b1422d875b564 100644 --- a/templates/shared/webhook/icon.tmpl +++ b/templates/shared/webhook/icon.tmpl @@ -3,25 +3,25 @@ {{$size = .Size}} {{end}} {{if eq .HookType "gitea"}} - + {{else if eq .HookType "gogs"}} - + {{else if eq .HookType "slack"}} - + {{else if eq .HookType "discord"}} - + {{else if eq .HookType "dingtalk"}} - + {{else if eq .HookType "telegram"}} - + {{else if eq .HookType "msteams"}} - + {{else if eq .HookType "feishu"}} - + {{else if eq .HookType "matrix"}} - {{svg "gitea-matrix" $size "img"}} + {{else if eq .HookType "wechatwork"}} - + {{else if eq .HookType "packagist"}} - + {{end}} diff --git a/templates/webhook/new.tmpl b/templates/webhook/new.tmpl index a185c42b51ea0..324fada6b37c2 100644 --- a/templates/webhook/new.tmpl +++ b/templates/webhook/new.tmpl @@ -1,7 +1,12 @@

{{.CustomHeaderTitle}} -
- {{template "shared/webhook/icon" .ctxData}} +

From a6b2f4ee44fb48659cfb8c50495ddcdd62da8ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Niclas=20Oelschl=C3=A4ger?= Date: Fri, 9 Feb 2024 15:09:15 +0100 Subject: [PATCH 2/5] lint: missing new line --- templates/repo/settings/webhook/link_menu.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/settings/webhook/link_menu.tmpl b/templates/repo/settings/webhook/link_menu.tmpl index 2cf9843263c51..e2c86dcc3c089 100644 --- a/templates/repo/settings/webhook/link_menu.tmpl +++ b/templates/repo/settings/webhook/link_menu.tmpl @@ -47,4 +47,4 @@ {{template "shared/webhook/icon" (dict "HookType" "packagist" "Size" $size)}} {{ctx.Locale.Tr "repo.settings.web_hook_name_packagist"}} -
\ No newline at end of file + From 0898a7eeb86e6e2ee82a10eb569d46b8dc0f2569 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 11 Feb 2024 15:03:53 +0100 Subject: [PATCH 3/5] use svg tag for svg --- templates/shared/webhook/icon.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/shared/webhook/icon.tmpl b/templates/shared/webhook/icon.tmpl index b1422d875b564..a82fceeb6aeec 100644 --- a/templates/shared/webhook/icon.tmpl +++ b/templates/shared/webhook/icon.tmpl @@ -3,7 +3,7 @@ {{$size = .Size}} {{end}} {{if eq .HookType "gitea"}} - + {{svg "gitea-gitea" $size "img"}} {{else if eq .HookType "gogs"}} {{else if eq .HookType "slack"}} @@ -19,7 +19,7 @@ {{else if eq .HookType "feishu"}} {{else if eq .HookType "matrix"}} - + {{svg "gitea-matrix" $size "img"}} {{else if eq .HookType "wechatwork"}} {{else if eq .HookType "packagist"}} From 29718ccbf8e4497d4c6ecd69298b0cdce6deb45b Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 11 Feb 2024 15:13:21 +0100 Subject: [PATCH 4/5] vertical center with flexbox and fix for svg.img --- templates/shared/webhook/icon.tmpl | 18 +++++++++--------- templates/webhook/new.tmpl | 4 ++-- web_src/css/base.css | 7 +++++++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/templates/shared/webhook/icon.tmpl b/templates/shared/webhook/icon.tmpl index a82fceeb6aeec..1abfe363f4cfa 100644 --- a/templates/shared/webhook/icon.tmpl +++ b/templates/shared/webhook/icon.tmpl @@ -5,23 +5,23 @@ {{if eq .HookType "gitea"}} {{svg "gitea-gitea" $size "img"}} {{else if eq .HookType "gogs"}} - + {{else if eq .HookType "slack"}} - + {{else if eq .HookType "discord"}} - + {{else if eq .HookType "dingtalk"}} - + {{else if eq .HookType "telegram"}} - + {{else if eq .HookType "msteams"}} - + {{else if eq .HookType "feishu"}} - + {{else if eq .HookType "matrix"}} {{svg "gitea-matrix" $size "img"}} {{else if eq .HookType "wechatwork"}} - + {{else if eq .HookType "packagist"}} - + {{end}} diff --git a/templates/webhook/new.tmpl b/templates/webhook/new.tmpl index 324fada6b37c2..305133c03a164 100644 --- a/templates/webhook/new.tmpl +++ b/templates/webhook/new.tmpl @@ -1,8 +1,8 @@

{{.CustomHeaderTitle}}