Browse Source

Add repo list data, need front-end fix

for-closed-social
Unknown 10 years ago
parent
commit
dfcae2a97a
6 changed files with 17 additions and 25 deletions
  1. +0
    -17
      routers/repo/repo.go
  2. +0
    -1
      routers/repo/single.go
  3. +6
    -1
      routers/user/user.go
  4. +4
    -4
      templates/user/dashboard.tmpl
  5. +7
    -1
      templates/user/profile.tmpl
  6. +0
    -1
      web.go

+ 0
- 17
routers/repo/repo.go View File

@ -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)
}

+ 0
- 1
routers/repo/single.go View File

@ -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)
}

+ 6
- 1
routers/user/user.go View File

@ -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)

+ 4
- 4
templates/user/dashboard.tmpl View File

@ -4,9 +4,9 @@
<div class="container">
<ul class="nav nav-pills pull-right">
<li class="active"><a href="/">Feed</a></li>
<li><a href="/issues/">Issues</a></li>
<li><a href="/pulls/">Pull Requests</a></li>
<li><a href="/stars/">Stars</a></li>
<li><a href="/issues">Issues</a></li>
<li><a href="/pulls">Pull Requests</a></li>
<li><a href="/stars">Stars</a></li>
</ul>
<h3>News Feed</h3>
</div>
@ -29,7 +29,7 @@
<div id="gogs-feed-right" class="col-md-4">
<div class="panel panel-default repo-panel">
<div class="panel-heading">Your Repositories
<a class="btn btn-success pull-right btn-sm" href="/repo/create/"><i class="fa fa-plus-square"></i>New Repo</a>
<a class="btn btn-success pull-right btn-sm" href="/repo/create"><i class="fa fa-plus-square"></i>New Repo</a>
</div>
<div class="panel-body">
<ul class="list-group">{{range .MyRepos}}

+ 7
- 1
templates/user/profile.tmpl View File

@ -44,7 +44,13 @@
</ul>
</div>
{{else}}
<div class="tab-pane active">repo</div>
{{$owner := .Owner}}
<div class="tab-pane active">
{{range .Repos}}
<h4><a href="/{{$owner.Name}}/{{.LowerName}}">{{.LowerName}}</a> <small>Star:{{.NumStars}} Fork:{{.NumForks}}</small></h4>
<p>{{.Description}}</p>
{{end}}
</div>
{{end}}
</div>
</div>

+ 0
- 1
web.go View File

@ -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/**",

Loading…
Cancel
Save