From 3a3ac1f0f32d44330d513cfea9ca3560bc41671e Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Mon, 17 Mar 2014 17:14:31 +0800 Subject: [PATCH] repo branch page ui --- public/css/gogs.css | 63 ++++++++++++++++++++++++++++++++++++ routers/repo/single.go | 20 ++++++++++++ templates/repo/branches.tmpl | 42 ++++++++++++++++++++++++ templates/repo/single.tmpl | 51 +++++++++++++++-------------- templates/repo/toolbar.tmpl | 8 ++--- web.go | 1 + 6 files changed, 157 insertions(+), 28 deletions(-) create mode 100644 templates/repo/branches.tmpl diff --git a/public/css/gogs.css b/public/css/gogs.css index 3d0a31e6f5..668df4f7c7 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -67,6 +67,8 @@ html, body { #gogs-nav-logo{ padding-left: 0; + padding-right: 0; + margin-right: 10px; } .gogs-nav-item:hover, @@ -619,6 +621,67 @@ html, body { padding: 30px 30px 50px; } +.branch-list th{ + background-color: #FFF; + line-height: 28px !important; +} + +.branch-list td{ + line-height: 36px !important; +} + +.branch-box tr:hover td{ + background-color: rgba(19, 95, 215, 0.06) !important; +} + +.branch-box .name{ + padding-left: 20px; + font-size: 15px; +} + +.branch-box .action{ + width: 150px; +} + +.branch-box td.date,.branch-box td.behind,.branch-box td.ahead{ + width: 120px; + font-family: Verdana, Arial, sans-serif; +} + +.branch-box .graph{ + display: block; + height: 3px; +} + +.branch-box .behind{ + text-align: right; + direction: rtl; +} + +.branch-box .behind .graph{ + background-color: #888; +} + +.branch-box .ahead .graph{ + background-color: #0093c4; +} + +.branch-box .branch-main{ + background-color: #444; + color: #FFF; + border-color: #444; +} + +.branch-box .branch-main a{ + color: #FFF; +} + +.branch-box .branch-main .name .btn{ + margin-left: .5em; +} + +/* wrapper and footer */ + #wrapper { min-height: 100%; height: auto !important; diff --git a/routers/repo/single.go b/routers/repo/single.go index fdc4e6e7f8..625fe9f193 100644 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@ -13,6 +13,26 @@ import ( "github.com/gogits/gogs/modules/middleware" ) +func Branches(ctx *middleware.Context, params martini.Params) { + if !ctx.Repo.IsValid { + return + } + + ctx.Data["Username"] = params["username"] + ctx.Data["Reponame"] = params["reponame"] + + brs, err := models.GetBranches(params["username"], params["reponame"]) + if err != nil { + ctx.Handle(200, "repo.Branches", err) + return + } + + ctx.Data["Branches"] = brs + ctx.Data["IsRepoToolbarBranches"] = true + + ctx.Render.HTML(200, "repo/branches", ctx.Data) +} + func Single(ctx *middleware.Context, params martini.Params) { if !ctx.Repo.IsValid { return diff --git a/templates/repo/branches.tmpl b/templates/repo/branches.tmpl new file mode 100644 index 0000000000..63e77ab924 --- /dev/null +++ b/templates/repo/branches.tmpl @@ -0,0 +1,42 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +{{template "repo/nav" .}} +{{template "repo/toolbar" .}} +
+
+
+
+

Branches

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+{{template "base/footer" .}} \ No newline at end of file diff --git a/templates/repo/single.tmpl b/templates/repo/single.tmpl index 4c6c7dd941..153910f78a 100644 --- a/templates/repo/single.tmpl +++ b/templates/repo/single.tmpl @@ -24,13 +24,15 @@ {{$paths := .Paths}} {{ $l := Subtract $n 1}} @@ -43,20 +45,21 @@ - - - - - - + + + + + + - {{range .Files}} - - - + + - + - + - - {{end}} + + + {{end}} diff --git a/templates/repo/toolbar.tmpl b/templates/repo/toolbar.tmpl index 3729edaf5c..49a37ef466 100644 --- a/templates/repo/toolbar.tmpl +++ b/templates/repo/toolbar.tmpl @@ -4,10 +4,10 @@