diff options
-rw-r--r-- | cmd/web.go | 1 | ||||
-rw-r--r-- | routers/repo/setting.go | 11 | ||||
-rw-r--r-- | templates/admin/nav.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/hooks_edit.tmpl | 70 |
4 files changed, 83 insertions, 1 deletions
diff --git a/cmd/web.go b/cmd/web.go index d6679fa254..bad19bfeb1 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -163,6 +163,7 @@ func runWeb(*cli.Context) { r.Post("/settings/collaboration", repo.CollaborationPost) r.Get("/settings/hooks", repo.WebHooks) r.Get("/settings/hooks/add", repo.WebHooksAdd) + r.Get("/settings/hooks/id", repo.WebHooksEdit) r.Get("/action/:action", repo.Action) r.Get("/issues/new", repo.CreateIssue) r.Post("/issues/new", bindIgnErr(auth.CreateIssueForm{}), repo.CreateIssuePost) diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 79d5f175da..b0ec761830 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -235,3 +235,14 @@ func WebHooksAdd(ctx *middleware.Context) { ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Add Web Hook" ctx.HTML(200, "repo/hooks_add") } + +func WebHooksEdit(ctx *middleware.Context) { + if !ctx.Repo.IsOwner { + ctx.Handle(404, "repo.WebHooksEdit", nil) + return + } + + ctx.Data["IsRepoToolbarWebHooks"] = true + ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Web Hook Name" + ctx.HTML(200, "repo/hooks_edit") +} diff --git a/templates/admin/nav.tmpl b/templates/admin/nav.tmpl index b9542228bc..e22ae0b9f5 100644 --- a/templates/admin/nav.tmpl +++ b/templates/admin/nav.tmpl @@ -4,6 +4,6 @@ <li class="list-group-item{{if .PageIsUsers}} active{{end}}"><a href="/admin/users"><i class="fa fa-users fa-lg"></i> Users</a></li> <li class="list-group-item{{if .PageIsRepos}} active{{end}}"><a href="/admin/repos"><i class="fa fa-book fa-lg"></i> Repositories</a></li> <li class="list-group-item{{if .PageIsConfig}} active{{end}}"><a href="/admin/config"><i class="fa fa-cogs fa-lg"></i> Configuration</a></li> - <li class="list-group-item{{if .PageIsAuths}} active{{end}}"><a href="/admin/auths"><i class="fa fa-cogs fa-lg"></i> Authentication</a></li> + <li class="list-group-item{{if .PageIsAuths}} active{{end}}"><a href="/admin/auths"><i class="fa fa-check-square-o fa-lg"></i> Authentication</a></li> </ul> </div>
\ No newline at end of file diff --git a/templates/repo/hooks_edit.tmpl b/templates/repo/hooks_edit.tmpl new file mode 100644 index 0000000000..b017197c10 --- /dev/null +++ b/templates/repo/hooks_edit.tmpl @@ -0,0 +1,70 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +{{template "repo/nav" .}} +{{template "repo/toolbar" .}} +<div id="body" class="container"> + {{template "repo/setting_nav" .}} + <div id="repo-setting-container" class="col-md-10"> + {{template "base/alert" .}} + <form id="repo-hooks-edit-form" action="/{{.Owner.Name}}/{{.Repository.Name}}/settings/hooks/edit" method="post"> + <div class="panel panel-default"> + <div class="panel-heading"> + Manage Webhook + </div> + <div class="panel-body"> + <div class="col-md-7"> + <p>We’ll send a POST request to the URL below with details of any subscribed events.</p> + <hr/> + <div class="form-group"> + <label for="payload-url">Payload URL</label> + <input id="payload-url" class="form-control" type="url" required="required" name="url"/> + </div> + <div class="form-group"> + <label for="payload-version">Payload Version</label> + <select name="version" id="payload-version" class="form-control"> + <option value="json">application/json</option> + </select> + </div> + <div class="form-group"> + <label for="payload-secret">Secret</label> + <input id="payload-secret" class="form-control" type="text" required="required" name="secret"/> + </div> + <hr/> + <div class="form-group"> + <label>Which events would you like to trigger this webhook?</label> + + <div class="radio"> + <label> + <input class="form-control" type="radio" value="push" name="trigger"/> Just the + <i>push</i> event. + </label> + </div> + </div> + <hr/> + <div class="form-group"> + <label> + <input type="checkbox" name="active" value="Active" checked/> + Active + </label> + + <p class="help-block">We will deliver event details when this hook is triggered.</p> + </div> + </div> + </div> + <div class="panel-footer"> + <button class="btn btn-primary">Update Webhook</button> + <a href="/{{.Owner.Name}}/{{.Repository.Name}}/settings/hooks?remove="><button class="btn btn-danger">Delete Webhook</button></a> + </div> + </div> + </form> + <div class="panel panel-default"> + <div class="panel-heading"> + <h3 class="panel-title">Recent Deliveries</h3> + </div> + <div class="panel-body"> + Coming soon + </div> + </div> + </div> +</div> +{{template "base/footer" .}}
\ No newline at end of file |