forked from Shiloh/githaven
single repository page ui, add spec handler to get repo
This commit is contained in:
parent
b1fe498eb9
commit
f65d8f9144
@ -6,8 +6,6 @@ package repo
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/codegangsta/martini"
|
|
||||||
"github.com/martini-contrib/render"
|
"github.com/martini-contrib/render"
|
||||||
"github.com/martini-contrib/sessions"
|
"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) {
|
func List(req *http.Request, r render.Render, data base.TmplData, session sessions.Session) {
|
||||||
u := auth.SignedInUser(session)
|
u := auth.SignedInUser(session)
|
||||||
if u != nil {
|
if u != nil {
|
||||||
|
@ -1,14 +1,26 @@
|
|||||||
package repo
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/codegangsta/martini"
|
||||||
|
"github.com/gogits/gogs/models"
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
|
"github.com/gogits/gogs/modules/log"
|
||||||
"github.com/martini-contrib/render"
|
"github.com/martini-contrib/render"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Single(r render.Render, data base.TmplData) {
|
func Single(params martini.Params, r render.Render, data base.TmplData) {
|
||||||
if !data["IsRepositoryValid"].(bool) {
|
if !data["IsRepositoryValid"].(bool) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
data["IsRepoToolbarSource"] = true
|
data["IsRepoToolbarSource"] = true
|
||||||
r.HTML(200, "repo/single", data)
|
r.HTML(200, "repo/single", data)
|
||||||
}
|
}
|
||||||
|
@ -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" .}}
|
|
@ -33,6 +33,11 @@
|
|||||||
</div>
|
</div>
|
||||||
{{template "repo/toolbar" .}}
|
{{template "repo/toolbar" .}}
|
||||||
<div id="gogs-body" class="container">
|
<div id="gogs-body" class="container">
|
||||||
repo single dashboard
|
<h4>Source Files:</h4>
|
||||||
|
<ul>
|
||||||
|
{{range .Files}}
|
||||||
|
<li>{{.Name}} - {{.Type}}</li>
|
||||||
|
{{end}}
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{{template "base/footer" .}}
|
{{template "base/footer" .}}
|
Loading…
Reference in New Issue
Block a user