|
|
@ -5,9 +5,9 @@ |
|
|
|
package repo |
|
|
|
package repo |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
|
|
|
|
"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,12 +87,29 @@ func Delete(req *http.Request, r render.Render, data base.TmplData, session sess |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func List(req *http.Request, r render.Render, data base.TmplData, session sessions.Session) { |
|
|
|
func Repo(params martini.Params, req *http.Request, r render.Render, data base.TmplData, session sessions.Session) { |
|
|
|
data["Title"] = "Repositories" |
|
|
|
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) |
|
|
|
u := auth.SignedInUser(session) |
|
|
|
|
|
|
|
if u != nil { |
|
|
|
|
|
|
|
r.Redirect("/") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data["Title"] = "Repositories" |
|
|
|
repos, err := models.GetRepositories(u) |
|
|
|
repos, err := models.GetRepositories(u) |
|
|
|
fmt.Println("repos", repos) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
data["ErrorMsg"] = err |
|
|
|
data["ErrorMsg"] = err |
|
|
|
log.Error("repo.List: %v", err) |
|
|
|
log.Error("repo.List: %v", err) |
|
|
|