Browse Source

MISC: minor fixes in webhook

pull/4722/merge
Unknwon 7 years ago
parent
commit
0f14b92bce
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 3
      models/webhook.go
  2. 3
      public/css/gogs.css
  3. 4
      public/less/_repository.less
  4. 2
      routes/repo/pull.go
  5. 8
      templates/repo/settings/webhook/list.tmpl

3
models/webhook.go

@ -356,6 +356,7 @@ var hookTaskTypes = map[string]HookTaskType{
"gogs": GOGS, "gogs": GOGS,
"slack": SLACK, "slack": SLACK,
"discord": DISCORD, "discord": DISCORD,
"dingtalk": DINGTALK,
} }
// ToHookTaskType returns HookTaskType by given name. // ToHookTaskType returns HookTaskType by given name.
@ -371,6 +372,8 @@ func (t HookTaskType) Name() string {
return "slack" return "slack"
case DISCORD: case DISCORD:
return "discord" return "discord"
case DINGTALK:
return "dingtalk"
} }
return "" return ""
} }

3
public/css/gogs.css

@ -2399,6 +2399,9 @@ footer .ui.language .menu {
.repository.settings.webhooks .types .menu .item { .repository.settings.webhooks .types .menu .item {
padding: 10px !important; padding: 10px !important;
} }
.repository.settings.webhooks .logo.item img {
margin-top: -4px;
}
.repository.settings.webhook .text.desc { .repository.settings.webhook .text.desc {
margin-top: 5px; margin-top: 5px;
} }

4
public/less/_repository.less

@ -1407,6 +1407,10 @@
padding: 10px !important; padding: 10px !important;
} }
} }
.logo.item img {
margin-top: -4px;
}
} }
&.webhook { &.webhook {

2
routes/repo/pull.go

@ -275,7 +275,7 @@ func ViewPullCommits(c *context.Context) {
if c.Written() { if c.Written() {
return return
} else if prInfo == nil { } else if prInfo == nil {
c.Handle(404, "ViewPullCommits", nil) c.NotFound()
return return
} }
commits = prInfo.Commits commits = prInfo.Commits

8
templates/repo/settings/webhook/list.tmpl

@ -9,19 +9,19 @@
<div class="menu"> <div class="menu">
{{range .Types}} {{range .Types}}
{{if eq . "gogs"}} {{if eq . "gogs"}}
<a class="item" href="{{$.BaseLink}}/settings/hooks/gogs/new"> <a class="item logo" href="{{$.BaseLink}}/settings/hooks/gogs/new">
<img class="img-12" src="{{AppSubURL}}/img/favicon.png">Gogs <img class="img-12" src="{{AppSubURL}}/img/favicon.png">Gogs
</a> </a>
{{else if eq . "slack"}} {{else if eq . "slack"}}
<a class="item" href="{{$.BaseLink}}/settings/hooks/slack/new"> <a class="item logo" href="{{$.BaseLink}}/settings/hooks/slack/new">
<img class="img-12" src="{{AppSubURL}}/img/slack.png">Slack <img class="img-12" src="{{AppSubURL}}/img/slack.png">Slack
</a> </a>
{{else if eq . "discord"}} {{else if eq . "discord"}}
<a class="item" href="{{$.BaseLink}}/settings/hooks/discord/new"> <a class="item logo" href="{{$.BaseLink}}/settings/hooks/discord/new">
<img class="img-12" src="{{AppSubURL}}/img/discord.png">Discord <img class="img-12" src="{{AppSubURL}}/img/discord.png">Discord
</a> </a>
{{else if eq . "dingtalk"}} {{else if eq . "dingtalk"}}
<a class="item" href="{{$.BaseLink}}/settings/hooks/dingtalk/new"> <a class="item logo" href="{{$.BaseLink}}/settings/hooks/dingtalk/new">
<img class="img-12" src="{{AppSubURL}}/img/dingtalk.png">Dingtalk <img class="img-12" src="{{AppSubURL}}/img/dingtalk.png">Dingtalk
</a> </a>
{{end}} {{end}}

Loading…
Cancel
Save