mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-21 01:14:31 +08:00
single repository page ui preview
This commit is contained in:
parent
3c67318d8f
commit
4fff38856e
@ -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;
|
||||
}
|
56
routers/repo/single.go
Normal file
56
routers/repo/single.go
Normal file
@ -0,0 +1,56 @@
|
||||
package repo
|
||||
|
||||
import (
|
||||
"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"
|
||||
)
|
||||
|
||||
|
||||
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
|
||||
|
||||
r.HTML(200, "repo/single", data)
|
||||
}
|
38
templates/repo/single.tmpl
Normal file
38
templates/repo/single.tmpl
Normal file
@ -0,0 +1,38 @@
|
||||
{{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 {{.Repository.NumStars}}</button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default"><i class="fa fa-code-fork"></i>Fork {{.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">
|
||||
repo single dashboard
|
||||
</div>
|
||||
{{template "base/footer" .}}
|
41
templates/repo/toolbar.tmpl
Normal file
41
templates/repo/toolbar.tmpl
Normal 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>
|
@ -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
1
web.go
@ -73,6 +73,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)
|
||||
|
||||
listenAddr := fmt.Sprintf("%s:%s",
|
||||
base.Cfg.MustValue("server", "HTTP_ADDR"),
|
||||
|
Loading…
Reference in New Issue
Block a user