From 7263b3effe34a8f0de337365d659e48f389ea1c7 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 (cherry picked from commit 374e886f5113a996e1e927a60d1775e77262c364) Conflicts: templates/repo/settings/webhook/base_list.tmpl templates/shared/webhook/icon.tmpl --- routers/web/repo/setting/webhook.go | 1 + .../repo/settings/webhook/base_list.tmpl | 51 +----------------- .../repo/settings/webhook/link_menu.tmpl | 54 +++++++++++++++++++ templates/shared/webhook/icon.tmpl | 2 +- templates/webhook/new.tmpl | 9 +++- web_src/css/base.css | 7 +++ 6 files changed, 71 insertions(+), 53 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 2ae4cf9f1..7bbe4d81a 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 1f38c035c..5a3fc0e7b 100644 --- a/templates/repo/settings/webhook/base_list.tmpl +++ b/templates/repo/settings/webhook/base_list.tmpl @@ -3,56 +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 000000000..811e262db --- /dev/null +++ b/templates/repo/settings/webhook/link_menu.tmpl @@ -0,0 +1,54 @@ +{{$size := 20}} +{{if .Size}} + {{$size = .Size}} +{{end}} + diff --git a/templates/shared/webhook/icon.tmpl b/templates/shared/webhook/icon.tmpl index a6507bab5..3c84f117e 100644 --- a/templates/shared/webhook/icon.tmpl +++ b/templates/shared/webhook/icon.tmpl @@ -5,7 +5,7 @@ {{if eq .HookType "forgejo"}} {{else 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 60c729eee..63bd8363b 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 198e87c0e..ff72376a3 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);