From dfcae2a97ae57cf8cb9e954b9d69151f5e340745 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 15 Mar 2014 12:13:45 -0400 Subject: [PATCH] Add repo list data, need front-end fix --- routers/repo/repo.go | 17 ----------------- routers/repo/single.go | 1 - routers/user/user.go | 7 ++++++- templates/user/dashboard.tmpl | 8 ++++---- templates/user/profile.tmpl | 8 +++++++- web.go | 1 - 6 files changed, 17 insertions(+), 25 deletions(-) diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 23f8ea107..116c199b7 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -67,20 +67,3 @@ func Delete(ctx *middleware.Context, form auth.DeleteRepoForm) { ctx.Render.Redirect("/", 302) } - -func List(ctx *middleware.Context) { - if ctx.User != nil { - ctx.Render.Redirect("/") - return - } - - ctx.Data["Title"] = "Repositories" - repos, err := models.GetRepositories(ctx.User) - if err != nil { - ctx.Handle(200, "repo.List", err) - return - } - - ctx.Data["Repos"] = repos - ctx.Render.HTML(200, "repo/list", ctx.Data) -} diff --git a/routers/repo/single.go b/routers/repo/single.go index e93395105..d796d9639 100644 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@ -41,7 +41,6 @@ func Single(ctx *middleware.Context, params martini.Params) { ctx.Data["Treenames"] = treenames ctx.Data["IsRepoToolbarSource"] = true ctx.Data["Files"] = files - ctx.Render.HTML(200, "repo/single", ctx.Data) } diff --git a/routers/user/user.go b/routers/user/user.go index 4ba7da161..8d8691a39 100644 --- a/routers/user/user.go +++ b/routers/user/user.go @@ -60,7 +60,12 @@ func Profile(ctx *middleware.Context, params martini.Params) { } ctx.Data["Feeds"] = feeds default: - + repos, err := models.GetRepositories(user) + if err != nil { + ctx.Handle(200, "user.Profile", err) + return + } + ctx.Data["Repos"] = repos } ctx.Render.HTML(200, "user/profile", ctx.Data) diff --git a/templates/user/dashboard.tmpl b/templates/user/dashboard.tmpl index 306c3bc15..547e8ab55 100644 --- a/templates/user/dashboard.tmpl +++ b/templates/user/dashboard.tmpl @@ -4,9 +4,9 @@

News Feed

@@ -29,7 +29,7 @@
Your Repositories - New Repo + New Repo
    {{range .MyRepos}} diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 944445201..aa15cb88b 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -44,7 +44,13 @@
{{else}} -
repo
+ {{$owner := .Owner}} +
+ {{range .Repos}} +

{{.LowerName}} Star:{{.NumStars}} Fork:{{.NumForks}}

+

{{.Description}}

+ {{end}} +
{{end}}
diff --git a/web.go b/web.go index ad19a5da0..8d4fd5b5c 100644 --- a/web.go +++ b/web.go @@ -66,7 +66,6 @@ func runWeb(*cli.Context) { m.Any("/repo/create", middleware.SignInRequire(true), binding.BindIgnErr(auth.CreateRepoForm{}), repo.Create) m.Any("/repo/delete", middleware.SignInRequire(true), binding.Bind(auth.DeleteRepoForm{}), repo.Delete) - m.Any("/repo/list", middleware.SignInRequire(false), repo.List) m.Get("/:username/:reponame/settings", middleware.SignInRequire(false), auth.RepoAssignment(true), repo.Setting) m.Get("/:username/:reponame/tree/:branchname/**",