0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-15 14:31:41 +01:00

Extract common code to new template (#26933)

Same as #26903
This commit is contained in:
Kerwin Bryant 2023-09-06 18:11:06 +08:00 committed by GitHub
parent 7812ce86dc
commit 9b0743ae33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 46 deletions

View file

@ -1,33 +1,13 @@
{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin settings new webhook")}} {{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin settings new webhook")}}
<div class="admin-setting-content"> <div class="admin-setting-content">
<h4 class="ui top attached header"> {{$CustomHeaderTitle := .locale.Tr "admin.defaulthooks.update_webhook"}}
{{if .PageIsAdminDefaultHooksNew}} {{if .PageIsAdminDefaultHooksNew}}
{{.locale.Tr "admin.defaulthooks.add_webhook"}} {{$CustomHeaderTitle = .locale.Tr "admin.defaulthooks.add_webhook"}}
{{else if .PageIsAdminSystemHooksNew}} {{else if .PageIsAdminSystemHooksNew}}
{{.locale.Tr "admin.systemhooks.add_webhook"}} {{$CustomHeaderTitle = .locale.Tr "admin.systemhooks.add_webhook"}}
{{else if .Webhook.IsSystemWebhook}} {{else if .Webhook.IsSystemWebhook}}
{{.locale.Tr "admin.systemhooks.update_webhook"}} {{$CustomHeaderTitle = .locale.Tr "admin.systemhooks.update_webhook"}}
{{else}}
{{.locale.Tr "admin.defaulthooks.update_webhook"}}
{{end}} {{end}}
<div class="ui right"> {{template "webhook/new" (dict "ctxData" . "CustomHeaderTitle" $CustomHeaderTitle)}}
{{template "shared/webhook/icon" .}}
</div>
</h4>
<div class="ui attached segment">
{{template "repo/settings/webhook/gitea" .}}
{{template "repo/settings/webhook/gogs" .}}
{{template "repo/settings/webhook/slack" .}}
{{template "repo/settings/webhook/discord" .}}
{{template "repo/settings/webhook/dingtalk" .}}
{{template "repo/settings/webhook/telegram" .}}
{{template "repo/settings/webhook/msteams" .}}
{{template "repo/settings/webhook/feishu" .}}
{{template "repo/settings/webhook/matrix" .}}
{{template "repo/settings/webhook/wechatwork" .}}
{{template "repo/settings/webhook/packagist" .}}
</div>
{{template "repo/settings/webhook/history" .}}
</div> </div>
{{template "admin/layout_footer" .}} {{template "admin/layout_footer" .}}

View file

@ -1,5 +1,7 @@
{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings new webhook")}} {{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings new webhook")}}
<div class="org-setting-content"> <div class="org-setting-content">
{{template "webhook/new" .}} {{$CustomHeaderTitle := .locale.Tr "repo.settings.update_webhook"}}
{{if .PageIsSettingsHooksNew}}{{$CustomHeaderTitle = .locale.Tr "repo.settings.add_webhook"}}{{end}}
{{template "webhook/new" (dict "ctxData" . "CustomHeaderTitle" $CustomHeaderTitle)}}
</div> </div>
{{template "org/settings/layout_footer" .}} {{template "org/settings/layout_footer" .}}

View file

@ -1,5 +1,7 @@
{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings new webhook")}} {{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings new webhook")}}
<div class="repo-setting-content"> <div class="repo-setting-content">
{{template "webhook/new" .}} {{$CustomHeaderTitle := .locale.Tr "repo.settings.update_webhook"}}
{{if .PageIsSettingsHooksNew}}{{$CustomHeaderTitle = .locale.Tr "repo.settings.add_webhook"}}{{end}}
{{template "webhook/new" (dict "ctxData" . "CustomHeaderTitle" $CustomHeaderTitle)}}
</div> </div>
{{template "repo/settings/layout_footer" .}} {{template "repo/settings/layout_footer" .}}

View file

@ -1,5 +1,7 @@
{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings new webhook")}} {{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings new webhook")}}
<div class="user-setting-content"> <div class="user-setting-content">
{{template "webhook/new" .}} {{$CustomHeaderTitle := .locale.Tr "repo.settings.update_webhook"}}
{{if .PageIsSettingsHooksNew}}{{$CustomHeaderTitle = .locale.Tr "repo.settings.add_webhook"}}{{end}}
{{template "webhook/new" (dict "ctxData" . "CustomHeaderTitle" $CustomHeaderTitle)}}
</div> </div>
{{template "user/settings/layout_footer" .}} {{template "user/settings/layout_footer" .}}

View file

@ -1,20 +1,20 @@
<h4 class="ui top attached header"> <h4 class="ui top attached header">
{{if .PageIsSettingsHooksNew}}{{.locale.Tr "repo.settings.add_webhook"}}{{else}}{{.locale.Tr "repo.settings.update_webhook"}}{{end}} {{.CustomHeaderTitle}}
<div class="ui right"> <div class="ui right">
{{template "shared/webhook/icon" .}} {{template "shared/webhook/icon" .ctxData}}
</div> </div>
</h4> </h4>
<div class="ui attached segment"> <div class="ui attached segment">
{{template "repo/settings/webhook/gitea" .}} {{template "repo/settings/webhook/gitea" .ctxData}}
{{template "repo/settings/webhook/gogs" .}} {{template "repo/settings/webhook/gogs" .ctxData}}
{{template "repo/settings/webhook/slack" .}} {{template "repo/settings/webhook/slack" .ctxData}}
{{template "repo/settings/webhook/discord" .}} {{template "repo/settings/webhook/discord" .ctxData}}
{{template "repo/settings/webhook/dingtalk" .}} {{template "repo/settings/webhook/dingtalk" .ctxData}}
{{template "repo/settings/webhook/telegram" .}} {{template "repo/settings/webhook/telegram" .ctxData}}
{{template "repo/settings/webhook/msteams" .}} {{template "repo/settings/webhook/msteams" .ctxData}}
{{template "repo/settings/webhook/feishu" .}} {{template "repo/settings/webhook/feishu" .ctxData}}
{{template "repo/settings/webhook/matrix" .}} {{template "repo/settings/webhook/matrix" .ctxData}}
{{template "repo/settings/webhook/wechatwork" .}} {{template "repo/settings/webhook/wechatwork" .ctxData}}
{{template "repo/settings/webhook/packagist" .}} {{template "repo/settings/webhook/packagist" .ctxData}}
</div> </div>
{{template "repo/settings/webhook/history" .}} {{template "repo/settings/webhook/history" .ctxData}}