diff --git a/cmd/web.go b/cmd/web.go index af5d507ed..1e6050183 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -152,6 +152,8 @@ func runWeb(*cli.Context) { r.Post("/settings", repo.SettingPost) r.Get("/settings/collaboration", repo.Collaboration) r.Post("/settings/collaboration", repo.CollaborationPost) + r.Get("/settings/hooks", repo.WebHooks) + r.Get("/settings/hooks/add",repo.WebHooksAdd) r.Get("/action/:action", repo.Action) r.Get("/issues/new", repo.CreateIssue) r.Post("/issues/new", bindIgnErr(auth.CreateIssueForm{}), repo.CreateIssuePost) diff --git a/public/css/gogs.css b/public/css/gogs.css index e84eb1ef1..881860987 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -311,17 +311,17 @@ html, body { border-radius: 2px; } -#user-name,#user-full-name { +#user-name, #user-full-name { font-size: 1.6em; font-weight: bold; } -#user-name{ +#user-name { margin-bottom: 20px; margin-top: 10px; } -#user-full-name{ +#user-full-name { margin-top: 20px; } @@ -446,7 +446,7 @@ html, body { border-left: 4px solid #DD4B39; } -#repo-setting-container{ +#repo-setting-container { padding-right: 0; } @@ -454,41 +454,41 @@ html, body { line-height: 30px; } -#repo-collab-list li.collab{ +#repo-collab-list li.collab { margin-bottom: .6em; } -#repo-collab-list .avatar{ +#repo-collab-list .avatar { margin-right: 1em; width: 40px; } -#repo-collab-list a.member{ +#repo-collab-list a.member { color: #444; } -#repo-collab-list .remove-collab{ +#repo-collab-list .remove-collab, #repo-hooks-list .remove-hook { color: #DD4B39; } -#repo-collab-form .dropdown-menu{ +#repo-collab-form .dropdown-menu { margin-left: 15px; margin-top: 4px; padding: 0; } -#repo-collab-form .dropdown-menu li{ +#repo-collab-form .dropdown-menu li { padding: 0 1em; line-height: 36px; cursor: pointer; font-weight: bold; } -#repo-collab-form .dropdown-menu li:hover{ +#repo-collab-form .dropdown-menu li:hover { background-color: #e8f0ff; } -#repo-collab-form .dropdown-menu img{ +#repo-collab-form .dropdown-menu img { width: 28px; height: 28px; margin-right: 1em; @@ -496,10 +496,26 @@ html, body { margin-top: -3px; } -#repo-collab-form .dropdown-menu ul{ +#repo-collab-form .dropdown-menu ul { margin-bottom: 0; } +#repo-hooks-list li { + line-height: 40px; + border-top: 1px solid #DDD; + height: 40px; +} + +#repo-hooks-list .link { + display: inline-block; + max-width: 360px; + overflow: hidden; + text-overflow: ellipsis; + height: 40px; + line-height: 40px; + white-space: nowrap; +} + /* gogits user ssh keys */ #ssh-keys .list-group-item { diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 8f7b84b69..aee3fe3a1 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -204,3 +204,25 @@ func CollaborationPost(ctx *middleware.Context) { ctx.Flash.Success("New collaborator has been added.") ctx.Redirect(ctx.Req.RequestURI) } + +func WebHooks(ctx *middleware.Context) { + if !ctx.Repo.IsOwner { + ctx.Handle(404, "repo.WebHooks", nil) + return + } + + ctx.Data["IsRepoToolbarWebHooks"] = true + ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Web Hooks" + ctx.HTML(200, "repo/hooks") +} + +func WebHooksAdd(ctx *middleware.Context) { + if !ctx.Repo.IsOwner { + ctx.Handle(404, "repo.WebHooksAdd", nil) + return + } + + ctx.Data["IsRepoToolbarWebHooks"] = true + ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Add Web Hook" + ctx.HTML(200, "repo/hooks_add") +} diff --git a/templates/repo/hooks.tmpl b/templates/repo/hooks.tmpl new file mode 100644 index 000000000..643686aae --- /dev/null +++ b/templates/repo/hooks.tmpl @@ -0,0 +1,37 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +{{template "repo/nav" .}} +{{template "repo/toolbar" .}} +
Webhooks allow external services to be notified when certain events happen on GitHub. When the specified events happen, we'll send a POST request to each of the URLs you provide. Learn more in our Webhooks Guide.
We’ll send a POST request to the URL below with details of any subscribed events.
+