Browse Source

merge

pull/31/head
Lunny Xiao 11 years ago
parent
commit
fecafdca2a
  1. 16
      routers/repo/repo.go
  2. 14
      routers/repo/single.go
  3. 10
      templates/repo/repo.tmpl
  4. 6
      templates/repo/single.tmpl
  5. 2
      web.go

16
routers/repo/repo.go

@ -6,8 +6,6 @@ package repo
import (
"net/http"
"github.com/codegangsta/martini"
"github.com/martini-contrib/render"
"github.com/martini-contrib/sessions"
@ -87,20 +85,6 @@ func Delete(req *http.Request, r render.Render, data base.TmplData, session sess
}
}
func Repo(params martini.Params, req *http.Request, r render.Render, data base.TmplData, session sessions.Session) {
data["Title"] = "Repository"
files, err := models.GetReposFiles(params["username"], params["reponame"], "HEAD", "/")
if err != nil {
data["ErrorMsg"] = err
log.Error("repo.List: %v", err)
r.HTML(200, "base/error", data)
return
}
data["Files"] = files
r.HTML(200, "repo/repo", data)
}
func List(req *http.Request, r render.Render, data base.TmplData, session sessions.Session) {
u := auth.SignedInUser(session)
if u != nil {

14
routers/repo/single.go

@ -1,16 +1,17 @@
package repo
import (
"net/http"
"github.com/codegangsta/martini"
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
"github.com/martini-contrib/render"
"github.com/martini-contrib/sessions"
"net/http"
"github.com/qiniu/log"
)
func Single(params martini.Params, req *http.Request, r render.Render, data base.TmplData, session sessions.Session) {
var (
user *models.User
@ -52,5 +53,14 @@ func Single(params martini.Params, req *http.Request, r render.Render, data base
data["RepositoryLink"] = data["Title"]
data["IsRepoToolbarSource"] = true
files, err := models.GetReposFiles(params["username"], params["reponame"], "HEAD", "/")
if err != nil {
data["ErrorMsg"] = err
log.Error("repo.List: %v", err)
r.HTML(200, "base/error", data)
return
}
data["Files"] = files
r.HTML(200, "repo/single", data)
}

10
templates/repo/repo.tmpl

@ -1,10 +0,0 @@
{{template "base/head" .}}
{{template "base/navbar" .}}
<div class="container" id="gogs-body">
<ul>
{{range .Files}}
<li>{{.Name}} - {{.Type}}</li>
{{end}}
</ul>
</div>
{{template "base/footer" .}}

6
templates/repo/single.tmpl

@ -33,6 +33,10 @@
</div>
{{template "repo/toolbar" .}}
<div id="gogs-body" class="container">
repo single dashboard
<ul>
{{range .Files}}
<li>{{.Name}} - {{.Type}}</li>
{{end}}
</ul>
</div>
{{template "base/footer" .}}

2
web.go

@ -70,8 +70,6 @@ func runWeb(*cli.Context) {
m.Get("/user/:username", auth.SignInRequire(false), user.Profile)
m.Get("/:username/:reponame", repo.Repo)
m.Any("/repo/create", auth.SignInRequire(true), binding.BindIgnErr(auth.CreateRepoForm{}), repo.Create)
m.Any("/repo/delete", auth.SignInRequire(true), repo.Delete)
m.Any("/repo/list", auth.SignInRequire(false), repo.List)

Loading…
Cancel
Save