1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-02 08:57:32 -04:00

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

This commit is contained in:
Unknown 2014-03-13 01:01:28 -04:00
commit 8c96091727
8 changed files with 234 additions and 27 deletions

View File

@ -372,8 +372,89 @@ body {
line-height: 32px;
border-bottom: 1px solid #DDD;
padding-left: 15px;
clear: both;
}
#gogs-feed-right .repo-panel .list-group-item:last-child {
border-bottom: none;
}
#gogs-feed-right .repo-panel .list-group-item:hover {
background-color: rgba(65, 131, 196, 0.1);
}
#gogs-feed-right .repo-panel span.stars {
color: #666;
line-height: 44px;
margin-right: 1em;
}
/* gogits repo single page */
.gogs-repo-nav h3 .fa {
color: #BBB;
}
.gogs-repo-btns {
margin-top: 18px;
}
.gogs-repo-btns .btn-group {
margin-left: 1em;
}
.gogs-repo-btns .btn-group .btn {
padding-left: 6px;
}
#gogs-repo-watching .dropdown-menu {
width: 280px;
padding: 0;
}
#gogs-repo-watching .dropdown-menu .dropdown-item:hover .dropdown-header {
color: rgb(65, 131, 196);
cursor: pointer;
}
#gogs-repo-watching .dropdown-menu .description {
padding: 0 20px;
color: #888;
}
#gogs-repo-watching .dropdown-menu .dropdown-header {
color: #444;
font-weight: bold;
font-size: 14px;
margin-bottom: 4px;
}
#gogs-repo-toolbar{
margin-top: 51px;
margin-bottom: -50px;
border-bottom: 1px solid #BBB;
background-color: #FFF;
height: 40px;
}
#gogs-repo-toolbar .navbar-default{
border: none;
height: 39px;
}
#gogs-repo-toolbar .nav > li > a{
height: 39px;
}
#gogs-repo-toolbar .navbar-toolbar.navbar-default .navbar-nav>.active>a:after{
border-bottom-color: #999;
}
#gogs-repo-toolbar .navbar.nav-toolbar{
margin-bottom: 0;
}
#gogs-repo-toolbar .navbar-collapse{
padding: 0;
}

View File

@ -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 {

66
routers/repo/single.go Normal file
View File

@ -0,0 +1,66 @@
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"
"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
err error
)
// get repository owner
isOwner := (data["SignedUserName"] == params["username"])
if !isOwner {
user, err = models.GetUserByName(params["username"])
if err != nil {
data["ErrorMsg"] = err
//log.Error("repo.Single: %v", err)
r.HTML(200, "base/error", data)
return
}
} else {
user = auth.SignedInUser(session)
}
if user == nil {
data["ErrorMsg"] = "invliad user account for single repository"
//log.Error("repo.Single: %v", err)
r.HTML(200, "base/error", data)
return
}
data["IsRepositoryOwner"] = isOwner
// get repository
repo, err := models.GetRepositoryByName(user, params["reponame"])
if err != nil {
data["ErrorMsg"] = err
//log.Error("repo.Single: %v", err)
r.HTML(200, "base/error", data)
return
}
data["Repository"] = repo
data["Owner"] = user
data["Title"] = user.Name + "/" + repo.Name
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)
}

View File

@ -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" .}}

View File

@ -0,0 +1,42 @@
{{template "base/head" .}}
{{template "base/navbar" .}}
<div id="gogs-body-nav" class="gogs-repo-nav">
<div class="container">
<div class="gogs-repo-btns pull-right">
<div class="btn-group" id="gogs-repo-watching">
<button type="button" class="btn btn-default"><i class="fa fa-eye"></i>Watch {x}</button>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu" role="menu">
<div class="dropdown-item" data-val="not-watching">
<h4 role="presentation" class="dropdown-header">Not Watching</h4>
<p class="description">You only receive notifications for conversations in which you participate or are @mentioned.</p>
<p class="divider"></p>
</div>
<div class="dropdown-item" data-val="watching">
<h4 role="presentation" class="dropdown-header">Watching</h4>
<p class="description">You receive notifications for all conversations in this repository.</p>
</div>
</div>
</div>
<div class="btn-group">
<button type="button" class="btn btn-default"><i class="fa fa-star"></i>Star&nbsp;&nbsp;{{.Repository.NumStars}}</button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-default"><i class="fa fa-code-fork"></i>Fork&nbsp;&nbsp;{{.Repository.NumForks}}</button>
</div>
</div>
<h3><i class="fa fa-book fa-lg"></i><a href="/{{.Owner.Name}}/">{{.Owner.Name}}</a> / {{.Repository.Name}}</h3>
</div>
</div>
{{template "repo/toolbar" .}}
<div id="gogs-body" class="container">
<ul>
{{range .Files}}
<li>{{.Name}} - {{.Type}}</li>
{{end}}
</ul>
</div>
{{template "base/footer" .}}

View File

@ -0,0 +1,41 @@
<div id="gogs-repo-toolbar">
<div class="container">
<nav class="navbar navbar-toolbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Branches <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">master</a></li>
<li><a href="#">develop</a></li>
</ul>
</li>
<li class="{{if .IsRepoToolbarSource}}active{{end}}"><a href="#">Source</a></li>
<li><a href="#">Commits</a></li>
<li><a href="#">Issues <span class="badge">42</span></a></li>
<li><a href="#">Pull Requests</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">More <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Release</a></li>
<li><a href="#">Wiki</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Statics <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Graphic</a></li>
<li><a href="#">Pulse</a></li>
<li><a href="#">Network</a></li>
</ul>
</li>{{if .IsRepositoryOwner}}
<li class="{{if .IsRepoToolbarSetting}}active{{end}}"><a href="/{{.RepositoryLink}}/settings/">Settings</a></li>{{end}}
</ul>
</div>
</div>
</nav>
</div>
</div>

View File

@ -22,7 +22,9 @@
</div>
<div class="panel-body">
<ul class="list-group">{{range .MyRepos}}
<li class="list-group-item"><i class="fa fa-book"></i><a href="/{{$.SignedUserName}}/{{.Name}}/">{{.Name}}</a></li>{{end}}
<li class="list-group-item"><i class="fa fa-book"></i><a href="/{{$.SignedUserName}}/{{.Name}}/">{{.Name}}</a>
<span class="stars pull-right"><i class="fa fa-star"></i>{{.NumStars}}</span>
</li>{{end}}
</ul>
</div>
</div>

1
web.go
View File

@ -74,6 +74,7 @@ func runWeb(*cli.Context) {
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)
m.Get("/:username/:reponame", auth.SignInRequire(false), repo.Single)
m.Get("/:username/:reponame", repo.Repo)