From 374e886f5113a996e1e927a60d1775e77262c364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Nicas=20Oelschl=C3=A4ger?= <72873130+zokkis@users.noreply.github.com> Date: Thu, 15 Feb 2024 14:59:48 +0100 Subject: [PATCH] Change webhook-type in create-view (#29114) It's now possible to change webhook-type in create-view. before: ![image](https://github.com/go-gitea/gitea/assets/72873130/9ee1b9fb-843b-4f28-b8d6-6361e5d184f1) after: ![image](https://github.com/go-gitea/gitea/assets/72873130/9dbf058f-5912-43af-9acd-487271212f2d) --------- Co-authored-by: silverwind Co-authored-by: Giteabot --- 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 | 2 +- templates/webhook/new.tmpl | 9 +++- web_src/css/base.css | 7 +++ 6 files changed, 67 insertions(+), 49 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 ab3c70006f79..c12d7e82a667 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 ed6e670d60c7..5a3fc0e7b88d 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 000000000000..e2c86dcc3c08 --- /dev/null +++ b/templates/repo/settings/webhook/link_menu.tmpl @@ -0,0 +1,50 @@ +{{$size := 20}} +{{if .Size}} + {{$size = .Size}} +{{end}} + diff --git a/templates/shared/webhook/icon.tmpl b/templates/shared/webhook/icon.tmpl index 84f9de266fab..0f80787c574a 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"}} diff --git a/templates/webhook/new.tmpl b/templates/webhook/new.tmpl index a185c42b51ea..305133c03a16 100644 --- a/templates/webhook/new.tmpl +++ b/templates/webhook/new.tmpl @@ -1,7 +1,12 @@

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

diff --git a/web_src/css/base.css b/web_src/css/base.css index ea32aac6f777..0d547f16ffad 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -413,6 +413,13 @@ ol.ui.list li, color: var(--color-text-light-2); } +/* extend fomantic style '.ui.dropdown > .text > img' to include svg.img */ +.ui.dropdown > .text > .img { + margin-left: 0; + float: none; + margin-right: 0.78571429rem; +} + .ui.dropdown > .text > .description, .ui.dropdown .menu > .item > .description { color: var(--color-text-light-2);