summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2021-01-15 01:24:03 +0200
committerGitHub <noreply@github.com>2021-01-15 01:24:03 +0200
commit6eee9f0f4e56e620b2eacfc9c2b59c6448308290 (patch)
tree8aa10ddcc6c7ae19ce0e6f28edff93a16949058a /templates
parent84b147c7f0c2575723d3471783cb24078232fe7a (diff)
downloadgitea-6eee9f0f4e56e620b2eacfc9c2b59c6448308290.tar.gz
gitea-6eee9f0f4e56e620b2eacfc9c2b59c6448308290.zip
Merge default and system webhooks under one menu (#14244)
Diffstat (limited to 'templates')
-rw-r--r--templates/admin/hook_new.tmpl10
-rw-r--r--templates/admin/hooks.tmpl7
-rw-r--r--templates/admin/navbar.tmpl5
-rw-r--r--templates/repo/settings/webhook/base_list.tmpl60
-rw-r--r--templates/repo/settings/webhook/list.tmpl62
-rw-r--r--templates/repo/settings/webhook/settings.tmpl2
6 files changed, 77 insertions, 69 deletions
diff --git a/templates/admin/hook_new.tmpl b/templates/admin/hook_new.tmpl
index c6f02ee20e..9b251ec4cb 100644
--- a/templates/admin/hook_new.tmpl
+++ b/templates/admin/hook_new.tmpl
@@ -4,10 +4,14 @@
<div class="ui container">
{{template "base/alert" .}}
<h4 class="ui top attached header">
- {{if .PageIsAdminHooksNew}}
- {{.i18n.Tr "admin.hooks.add_webhook"}}
+ {{if .PageIsAdminDefaultHooksNew}}
+ {{.i18n.Tr "admin.defaulthooks.add_webhook"}}
+ {{else if .PageIsAdminSystemHooksNew}}
+ {{.i18n.Tr "admin.systemhooks.add_webhook"}}
+ {{else if .Webhook.IsSystemWebhook}}
+ {{.i18n.Tr "admin.systemhooks.update_webhook"}}
{{else}}
- {{.i18n.Tr "admin.hooks.update_webhook"}}
+ {{.i18n.Tr "admin.defaulthooks.update_webhook"}}
{{end}}
<div class="ui right">
{{if eq .HookType "gitea"}}
diff --git a/templates/admin/hooks.tmpl b/templates/admin/hooks.tmpl
index c09c6fcafe..a23cff4342 100644
--- a/templates/admin/hooks.tmpl
+++ b/templates/admin/hooks.tmpl
@@ -2,7 +2,12 @@
<div class="page-content admin hooks">
{{template "admin/navbar" .}}
<div class="ui container">
- {{template "repo/settings/webhook/list" .}}
+ {{template "base/alert" .}}
+
+ {{template "repo/settings/webhook/base_list" .SystemWebhooks}}
+ {{template "repo/settings/webhook/base_list" .DefaultWebhooks}}
+
+ {{template "repo/settings/webhook/delete_modal" .}}
</div>
</div>
{{template "base/footer" .}}
diff --git a/templates/admin/navbar.tmpl b/templates/admin/navbar.tmpl
index 8c895b8c27..953076d808 100644
--- a/templates/admin/navbar.tmpl
+++ b/templates/admin/navbar.tmpl
@@ -12,12 +12,9 @@
<a class="{{if .PageIsAdminRepositories}}active{{end}} item" href="{{AppSubUrl}}/admin/repos">
{{.i18n.Tr "admin.repositories"}}
</a>
- <a class="{{if .PageIsAdminHooks}}active{{end}} item" href="{{AppSubUrl}}/admin/hooks">
+ <a class="{{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks}}active{{end}} item" href="{{AppSubUrl}}/admin/hooks">
{{.i18n.Tr "admin.hooks"}}
</a>
- <a class="{{if .PageIsAdminSystemHooks}}active{{end}} item" href="{{AppSubUrl}}/admin/system-hooks">
- {{.i18n.Tr "admin.systemhooks"}}
- </a>
<a class="{{if .PageIsAdminAuthentications}}active{{end}} item" href="{{AppSubUrl}}/admin/auths">
{{.i18n.Tr "admin.authentication"}}
</a>
diff --git a/templates/repo/settings/webhook/base_list.tmpl b/templates/repo/settings/webhook/base_list.tmpl
new file mode 100644
index 0000000000..b978a6a19c
--- /dev/null
+++ b/templates/repo/settings/webhook/base_list.tmpl
@@ -0,0 +1,60 @@
+<h4 class="ui top attached header">
+ {{.Title}}
+ <div class="ui right">
+ <div class="ui floating1 jump dropdown">
+ <div class="ui blue tiny button">{{.i18n.Tr "repo.settings.add_webhook"}}</div>
+ <div class="menu">
+ <a class="item" href="{{.BaseLinkNew}}/gitea/new">
+ <img width="20" height="20" src="{{StaticUrlPrefix}}/img/gitea.svg">Gitea
+ </a>
+ <a class="item" href="{{.BaseLinkNew}}/gogs/new">
+ <img width="20" height="20" src="{{StaticUrlPrefix}}/img/gogs.ico">Gogs
+ </a>
+ <a class="item" href="{{.BaseLinkNew}}/slack/new">
+ <img width="20" height="20" src="{{StaticUrlPrefix}}/img/slack.png">Slack
+ </a>
+ <a class="item" href="{{.BaseLinkNew}}/discord/new">
+ <img width="20" height="20" src="{{StaticUrlPrefix}}/img/discord.png">Discord
+ </a>
+ <a class="item" href="{{.BaseLinkNew}}/dingtalk/new">
+ <img width="20" height="20" src="{{StaticUrlPrefix}}/img/dingtalk.ico">Dingtalk
+ </a>
+ <a class="item" href="{{.BaseLinkNew}}/telegram/new">
+ <img width="20" height="20" src="{{StaticUrlPrefix}}/img/telegram.png">Telegram
+ </a>
+ <a class="item" href="{{.BaseLinkNew}}/msteams/new">
+ <img width="20" height="20" src="{{StaticUrlPrefix}}/img/msteams.png">Microsoft Teams
+ </a>
+ <a class="item" href="{{.BaseLinkNew}}/feishu/new">
+ <img width="20" height="20" src="{{StaticUrlPrefix}}/img/feishu.png">Feishu
+ </a>
+ <a class="item" href="{{.BaseLinkNew}}/matrix/new">
+ <img width="20" height="20" src="{{StaticUrlPrefix}}/img/matrix.svg">Matrix
+ </a>
+ </div>
+ </div>
+ </div>
+</h4>
+<div class="ui attached segment">
+ <div class="ui list">
+ <div class="item">
+ {{.Description | Str2html}}
+ </div>
+ {{range .Webhooks}}
+ <div class="item">
+ {{if eq .LastStatus 1}}
+ <span class="text green mr-3">{{svg "octicon-check"}}</span>
+ {{else if eq .LastStatus 2}}
+ <span class="text red mr-3">{{svg "octicon-alert"}}</span>
+ {{else}}
+ <span class="text grey mr-3">{{svg "octicon-dot-fill"}}</span>
+ {{end}}
+ <a class="dont-break-out" href="{{$.BaseLink}}/{{.ID}}">{{.URL}}</a>
+ <div class="ui right">
+ <span class="text blue px-2"><a href="{{$.BaseLink}}/{{.ID}}">{{svg "octicon-pencil"}}</a></span>
+ <span class="text red px-2"><a class="delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trashcan"}}</a></span>
+ </div>
+ </div>
+ {{end}}
+ </div>
+</div>
diff --git a/templates/repo/settings/webhook/list.tmpl b/templates/repo/settings/webhook/list.tmpl
index 5efd6d4a3c..507f5e1f67 100644
--- a/templates/repo/settings/webhook/list.tmpl
+++ b/templates/repo/settings/webhook/list.tmpl
@@ -1,63 +1,5 @@
{{template "base/alert" .}}
-<h4 class="ui top attached header">
- {{.i18n.Tr "repo.settings.hooks"}}
- <div class="ui right">
- <div class="ui floating1 jump dropdown">
- <div class="ui blue tiny button">{{.i18n.Tr "repo.settings.add_webhook"}}</div>
- <div class="menu">
- <a class="item" href="{{.BaseLink}}/gitea/new">
- <img width="20" height="20" src="{{StaticUrlPrefix}}/img/gitea.svg">Gitea
- </a>
- <a class="item" href="{{.BaseLink}}/gogs/new">
- <img width="20" height="20" src="{{StaticUrlPrefix}}/img/gogs.ico">Gogs
- </a>
- <a class="item" href="{{.BaseLink}}/slack/new">
- <img width="20" height="20" src="{{StaticUrlPrefix}}/img/slack.png">Slack
- </a>
- <a class="item" href="{{.BaseLink}}/discord/new">
- <img width="20" height="20" src="{{StaticUrlPrefix}}/img/discord.png">Discord
- </a>
- <a class="item" href="{{.BaseLink}}/dingtalk/new">
- <img width="20" height="20" src="{{StaticUrlPrefix}}/img/dingtalk.ico">Dingtalk
- </a>
- <a class="item" href="{{.BaseLink}}/telegram/new">
- <img width="20" height="20" src="{{StaticUrlPrefix}}/img/telegram.png">Telegram
- </a>
- <a class="item" href="{{.BaseLink}}/msteams/new">
- <img width="20" height="20" src="{{StaticUrlPrefix}}/img/msteams.png">Microsoft Teams
- </a>
- <a class="item" href="{{.BaseLink}}/feishu/new">
- <img width="20" height="20" src="{{StaticUrlPrefix}}/img/feishu.png">Feishu
- </a>
- <a class="item" href="{{.BaseLink}}/matrix/new">
- <img width="20" height="20" src="{{StaticUrlPrefix}}/img/matrix.svg">Matrix
- </a>
- </div>
- </div>
- </div>
-</h4>
-<div class="ui attached segment">
- <div class="ui list">
- <div class="item">
- {{.Description | Str2html}}
- </div>
- {{range .Webhooks}}
- <div class="item">
- {{if eq .LastStatus 1}}
- <span class="text green mr-3">{{svg "octicon-check"}}</span>
- {{else if eq .LastStatus 2}}
- <span class="text red mr-3">{{svg "octicon-alert"}}</span>
- {{else}}
- <span class="text grey mr-3">{{svg "octicon-dot-fill"}}</span>
- {{end}}
- <a class="dont-break-out" href="{{$.BaseLink}}/{{.ID}}">{{.URL}}</a>
- <div class="ui right">
- <span class="text blue px-2"><a href="{{$.BaseLink}}/{{.ID}}">{{svg "octicon-pencil"}}</a></span>
- <span class="text red px-2"><a class="delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trashcan"}}</a></span>
- </div>
- </div>
- {{end}}
- </div>
-</div>
+
+{{template "repo/settings/webhook/base_list" .}}
{{template "repo/settings/webhook/delete_modal" .}}
diff --git a/templates/repo/settings/webhook/settings.tmpl b/templates/repo/settings/webhook/settings.tmpl
index de74dab05d..934794b539 100644
--- a/templates/repo/settings/webhook/settings.tmpl
+++ b/templates/repo/settings/webhook/settings.tmpl
@@ -1,4 +1,4 @@
-{{$isNew:=or .PageIsSettingsHooksNew .PageIsAdminHooksNew}}
+{{$isNew:=or .PageIsSettingsHooksNew .PageIsAdminDefaultHooksNew .PageIsAdminSystemHooksNew}}
<div class="field">
<h4>{{.i18n.Tr "repo.settings.event_desc"}}</h4>
<div class="grouped event type fields">