Browse Source

Merge branch 'master' of github.com:gogits/gogs

pull/31/head
slene 11 years ago
parent
commit
3d032dfb5a
  1. 17
      routers/repo/repo.go
  2. 1
      routers/repo/single.go
  3. 7
      routers/user/user.go
  4. 8
      templates/user/dashboard.tmpl
  5. 8
      templates/user/profile.tmpl
  6. 1
      web.go

17
routers/repo/repo.go

@ -67,20 +67,3 @@ func Delete(ctx *middleware.Context, form auth.DeleteRepoForm) {
ctx.Render.Redirect("/", 302) 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)
}

1
routers/repo/single.go

@ -43,7 +43,6 @@ func Single(ctx *middleware.Context, params martini.Params) {
ctx.Data["Treenames"] = treenames ctx.Data["Treenames"] = treenames
ctx.Data["IsRepoToolbarSource"] = true ctx.Data["IsRepoToolbarSource"] = true
ctx.Data["Files"] = files ctx.Data["Files"] = files
ctx.Render.HTML(200, "repo/single", ctx.Data) ctx.Render.HTML(200, "repo/single", ctx.Data)
} }

7
routers/user/user.go

@ -60,7 +60,12 @@ func Profile(ctx *middleware.Context, params martini.Params) {
} }
ctx.Data["Feeds"] = feeds ctx.Data["Feeds"] = feeds
default: 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) ctx.Render.HTML(200, "user/profile", ctx.Data)

8
templates/user/dashboard.tmpl

@ -4,9 +4,9 @@
<div class="container"> <div class="container">
<ul class="nav nav-pills pull-right"> <ul class="nav nav-pills pull-right">
<li class="active"><a href="/">Feed</a></li> <li class="active"><a href="/">Feed</a></li>
<li><a href="/issues/">Issues</a></li> <li><a href="/issues">Issues</a></li>
<li><a href="/pulls/">Pull Requests</a></li> <li><a href="/pulls">Pull Requests</a></li>
<li><a href="/stars/">Stars</a></li> <li><a href="/stars">Stars</a></li>
</ul> </ul>
<h3>News Feed</h3> <h3>News Feed</h3>
</div> </div>
@ -29,7 +29,7 @@
<div id="gogs-feed-right" class="col-md-4"> <div id="gogs-feed-right" class="col-md-4">
<div class="panel panel-default repo-panel"> <div class="panel panel-default repo-panel">
<div class="panel-heading">Your Repositories <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>
<div class="panel-body"> <div class="panel-body">
<ul class="list-group">{{range .MyRepos}} <ul class="list-group">{{range .MyRepos}}

8
templates/user/profile.tmpl

@ -44,7 +44,13 @@
</ul> </ul>
</div> </div>
{{else}} {{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}} {{end}}
</div> </div>
</div> </div>

1
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/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/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), middleware.RepoAssignment(true), repo.Setting) m.Get("/:username/:reponame/settings", middleware.SignInRequire(false), middleware.RepoAssignment(true), repo.Setting)
m.Get("/:username/:reponame/tree/:branchname/**", m.Get("/:username/:reponame/tree/:branchname/**",

Loading…
Cancel
Save