summaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/repo.go6
-rw-r--r--routers/repo/view.go12
2 files changed, 8 insertions, 10 deletions
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index c58d256a72..2879599744 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -244,11 +244,7 @@ func Action(ctx *middleware.Context) {
}
if err != nil {
- log.Error(4, "Action(%s): %v", ctx.Params(":action"), err)
- ctx.JSON(200, map[string]interface{}{
- "ok": false,
- "err": err.Error(),
- })
+ ctx.Handle(500, fmt.Sprintf("Action (%s)", ctx.Params(":action")), err)
return
}
diff --git a/routers/repo/view.go b/routers/repo/view.go
index 191f123454..25e312b1c1 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -217,7 +217,7 @@ func Home(ctx *middleware.Context) {
ctx.HTML(200, HOME)
}
-func renderItems(ctx *middleware.Context, total int, getter func(page int) ([]*models.User, error)) {
+func RenderUserCards(ctx *middleware.Context, total int, getter func(page int) ([]*models.User, error), tpl base.TplName) {
page := ctx.QueryInt("page")
if page <= 0 {
page = 1
@@ -230,21 +230,23 @@ func renderItems(ctx *middleware.Context, total int, getter func(page int) ([]*m
ctx.Handle(500, "getter", err)
return
}
- ctx.Data["Watchers"] = items
+ ctx.Data["Cards"] = items
- ctx.HTML(200, WATCHERS)
+ ctx.HTML(200, tpl)
}
func Watchers(ctx *middleware.Context) {
ctx.Data["Title"] = ctx.Tr("repo.watchers")
+ ctx.Data["CardsTitle"] = ctx.Tr("repo.watchers")
ctx.Data["PageIsWatchers"] = true
- renderItems(ctx, ctx.Repo.Repository.NumWatches, ctx.Repo.Repository.GetWatchers)
+ RenderUserCards(ctx, ctx.Repo.Repository.NumWatches, ctx.Repo.Repository.GetWatchers, WATCHERS)
}
func Stars(ctx *middleware.Context) {
ctx.Data["Title"] = ctx.Tr("repo.stargazers")
+ ctx.Data["CardsTitle"] = ctx.Tr("repo.stargazers")
ctx.Data["PageIsStargazers"] = true
- renderItems(ctx, ctx.Repo.Repository.NumStars, ctx.Repo.Repository.GetStargazers)
+ RenderUserCards(ctx, ctx.Repo.Repository.NumStars, ctx.Repo.Repository.GetStargazers, WATCHERS)
}
func Forks(ctx *middleware.Context) {