From 28814564212b7c64136cc3eda3774af56983557e Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 26 Aug 2015 21:45:51 +0800 Subject: new webhooks list UI --- routers/org/setting.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'routers/org') diff --git a/routers/org/setting.go b/routers/org/setting.go index 7a76199502..a15af26d43 100644 --- a/routers/org/setting.go +++ b/routers/org/setting.go @@ -105,9 +105,11 @@ func SettingsDelete(ctx *middleware.Context) { ctx.HTML(200, SETTINGS_DELETE) } -func SettingsHooks(ctx *middleware.Context) { +func Webhooks(ctx *middleware.Context) { ctx.Data["Title"] = ctx.Tr("org.settings") ctx.Data["PageIsSettingsHooks"] = true + ctx.Data["BaseLink"] = ctx.Org.OrgLink + ctx.Data["Description"] = ctx.Tr("org.settings.hooks_desc") // Delete web hook. remove := com.StrTo(ctx.Query("remove")).MustInt64() @@ -130,3 +132,15 @@ func SettingsHooks(ctx *middleware.Context) { ctx.Data["Webhooks"] = ws ctx.HTML(200, SETTINGS_HOOKS) } + +func DeleteWebhook(ctx *middleware.Context) { + if err := models.DeleteWebhook(ctx.QueryInt64("id")); err != nil { + ctx.Flash.Error("DeleteWebhook: " + err.Error()) + } else { + ctx.Flash.Success(ctx.Tr("repo.settings.webhook_deletion_success")) + } + + ctx.JSON(200, map[string]interface{}{ + "redirect": ctx.Org.OrgLink + "/settings/hooks", + }) +} -- cgit v1.2.3