1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 12:54:53 -05:00

Add repo list data, need front-end fix

This commit is contained in:
Unknown 2014-03-15 12:13:45 -04:00
parent f047df6e2b
commit dfcae2a97a
6 changed files with 17 additions and 25 deletions

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

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

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)

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

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>

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