From d34c3bb751b73a447f6011a461cf3051cf607221 Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Mon, 5 May 2014 20:16:24 +0800 Subject: [PATCH] finish webhook ui, some ui fix --- cmd/web.go | 1 + routers/repo/setting.go | 11 ++++++ templates/admin/nav.tmpl | 2 +- templates/repo/hooks_edit.tmpl | 70 ++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 templates/repo/hooks_edit.tmpl diff --git a/cmd/web.go b/cmd/web.go index d6679fa25..bad19bfeb 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 79d5f175d..b0ec76183 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 b9542228b..e22ae0b9f 100644 --- a/templates/admin/nav.tmpl +++ b/templates/admin/nav.tmpl @@ -4,6 +4,6 @@
  • Users
  • Repositories
  • Configuration
  • -
  • Authentication
  • +
  • Authentication
  • \ 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 000000000..b017197c1 --- /dev/null +++ b/templates/repo/hooks_edit.tmpl @@ -0,0 +1,70 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +{{template "repo/nav" .}} +{{template "repo/toolbar" .}} +
    + {{template "repo/setting_nav" .}} +
    + {{template "base/alert" .}} +
    +
    +
    + Manage Webhook +
    +
    +
    +

    We’ll send a POST request to the URL below with details of any subscribed events.

    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    + + +
    + +
    +
    +
    +
    + + +

    We will deliver event details when this hook is triggered.

    +
    +
    +
    + +
    +
    +
    +
    +

    Recent Deliveries

    +
    +
    + Coming soon +
    +
    +
    +
    +{{template "base/footer" .}} \ No newline at end of file