Fix #348
parent
033a7f0224
commit
ab7206d6b7
|
@ -59,7 +59,7 @@ There are 5 ways to install Gogs:
|
||||||
- [Install from binary](http://gogs.io/docs/installation/install_from_binary.md): **STRONGLY RECOMMENDED**
|
- [Install from binary](http://gogs.io/docs/installation/install_from_binary.md): **STRONGLY RECOMMENDED**
|
||||||
- [Install from source](http://gogs.io/docs/installation/install_from_source.md)
|
- [Install from source](http://gogs.io/docs/installation/install_from_source.md)
|
||||||
- [Install from packages](http://gogs.io/docs/installation/install_from_packages.md)
|
- [Install from packages](http://gogs.io/docs/installation/install_from_packages.md)
|
||||||
- [Ship with Docker](https://github.com/gogits/gogs/tree/master/dockerfiles)
|
- [Ship with Docker](https://github.com/gogits/gogs/tree/master/docker)
|
||||||
- [Install with Vagrant](https://github.com/geerlingguy/ansible-vagrant-examples/tree/master/gogs)
|
- [Install with Vagrant](https://github.com/geerlingguy/ansible-vagrant-examples/tree/master/gogs)
|
||||||
|
|
||||||
## Acknowledgments
|
## Acknowledgments
|
||||||
|
@ -70,7 +70,6 @@ There are 5 ways to install Gogs:
|
||||||
- Usage and modification from [beego](http://beego.me) modules.
|
- Usage and modification from [beego](http://beego.me) modules.
|
||||||
- Thanks [lavachen](http://www.lavachen.cn/) and [Rocker](http://weibo.com/rocker1989) for designing Logo.
|
- Thanks [lavachen](http://www.lavachen.cn/) and [Rocker](http://weibo.com/rocker1989) for designing Logo.
|
||||||
- Thanks [gobuild.io](http://gobuild.io) for providing binary compile and download service.
|
- Thanks [gobuild.io](http://gobuild.io) for providing binary compile and download service.
|
||||||
- Thanks [Docker China](http://www.dockboard.org/) for providing [dockerfiles](https://github.com/gogits/gogs/tree/master/dockerfiles).
|
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自
|
||||||
- [二进制安装](http://gogs.io/docs/installation/install_from_binary.md): **强烈推荐**
|
- [二进制安装](http://gogs.io/docs/installation/install_from_binary.md): **强烈推荐**
|
||||||
- [源码安装](http://gogs.io/docs/installation/install_from_source.md)
|
- [源码安装](http://gogs.io/docs/installation/install_from_source.md)
|
||||||
- [包管理安装](http://gogs.io/docs/installation/install_from_packages.md)
|
- [包管理安装](http://gogs.io/docs/installation/install_from_packages.md)
|
||||||
- [采用 Docker 部署](https://github.com/gogits/gogs/tree/master/dockerfiles)
|
- [采用 Docker 部署](https://github.com/gogits/gogs/tree/master/docker)
|
||||||
- [通过 Vagrant 安装](https://github.com/geerlingguy/ansible-vagrant-examples/tree/master/gogs)
|
- [通过 Vagrant 安装](https://github.com/geerlingguy/ansible-vagrant-examples/tree/master/gogs)
|
||||||
|
|
||||||
## 特别鸣谢
|
## 特别鸣谢
|
||||||
|
@ -61,7 +61,6 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自
|
||||||
- [martini](http://martini.codegangsta.io/) 的路由与中间件机制。
|
- [martini](http://martini.codegangsta.io/) 的路由与中间件机制。
|
||||||
- 感谢 [gobuild.io](http://gobuild.io) 提供二进制编译与下载服务。
|
- 感谢 [gobuild.io](http://gobuild.io) 提供二进制编译与下载服务。
|
||||||
- 感谢 [lavachen](http://www.lavachen.cn/) 和 [Rocker](http://weibo.com/rocker1989) 设计的 Logo。
|
- 感谢 [lavachen](http://www.lavachen.cn/) 和 [Rocker](http://weibo.com/rocker1989) 设计的 Logo。
|
||||||
- 感谢 [Docker 中文社区](http://www.dockboard.org/) 提供的 [dockerfiles](https://github.com/gogits/gogs/tree/master/dockerfiles)。
|
|
||||||
|
|
||||||
## 贡献成员
|
## 贡献成员
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,7 @@ func runWeb(*cli.Context) {
|
||||||
|
|
||||||
// Routers.
|
// Routers.
|
||||||
m.Get("/", ignSignIn, routers.Home)
|
m.Get("/", ignSignIn, routers.Home)
|
||||||
|
m.Get("/explore", routers.Explore)
|
||||||
m.Get("/install", bindIgnErr(auth.InstallForm{}), routers.Install)
|
m.Get("/install", bindIgnErr(auth.InstallForm{}), routers.Install)
|
||||||
m.Post("/install", bindIgnErr(auth.InstallForm{}), routers.InstallPost)
|
m.Post("/install", bindIgnErr(auth.InstallForm{}), routers.InstallPost)
|
||||||
m.Group("", func(r *macaron.Router) {
|
m.Group("", func(r *macaron.Router) {
|
||||||
|
|
|
@ -47,6 +47,9 @@ collaborative_repos = Collaborative Repositories
|
||||||
my_orgs = My Organizations
|
my_orgs = My Organizations
|
||||||
my_mirrors = My Mirrors
|
my_mirrors = My Mirrors
|
||||||
|
|
||||||
|
[explore]
|
||||||
|
repos = Repositories
|
||||||
|
|
||||||
[auth]
|
[auth]
|
||||||
create_new_account = Create New Account
|
create_new_account = Create New Account
|
||||||
register_hepler_msg = Already have an account? Sign in now!
|
register_hepler_msg = Already have an account? Sign in now!
|
||||||
|
|
|
@ -47,6 +47,9 @@ collaborative_repos = 参与协作的仓库
|
||||||
my_orgs = 我的组织
|
my_orgs = 我的组织
|
||||||
my_mirrors = 我的镜像
|
my_mirrors = 我的镜像
|
||||||
|
|
||||||
|
[explore]
|
||||||
|
repos = 探索仓库
|
||||||
|
|
||||||
[auth]
|
[auth]
|
||||||
create_new_account = 创建帐户
|
create_new_account = 创建帐户
|
||||||
register_hepler_msg = 已经注册?立即登录!
|
register_hepler_msg = 已经注册?立即登录!
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.4.9.0902 Beta"
|
const APP_VER = "0.4.9.0905 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
|
@ -972,8 +972,8 @@ func GetRepositories(uid int64, private bool) ([]*Repository, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRecentUpdatedRepositories returns the list of repositories that are recently updated.
|
// GetRecentUpdatedRepositories returns the list of repositories that are recently updated.
|
||||||
func GetRecentUpdatedRepositories() (repos []*Repository, err error) {
|
func GetRecentUpdatedRepositories(num int) (repos []*Repository, err error) {
|
||||||
err = x.Where("is_private=?", false).Limit(5).Desc("updated").Find(&repos)
|
err = x.Where("is_private=?", false).Limit(num).Desc("updated").Find(&repos)
|
||||||
return repos, err
|
return repos, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
package routers
|
package routers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/gogits/gogs/models"
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
"github.com/gogits/gogs/modules/middleware"
|
"github.com/gogits/gogs/modules/middleware"
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
|
@ -12,7 +15,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
HOME base.TplName = "home"
|
HOME base.TplName = "home"
|
||||||
|
EXPLORE_REPOS base.TplName = "explore/repos"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Home(ctx *middleware.Context) {
|
func Home(ctx *middleware.Context) {
|
||||||
|
@ -42,6 +46,26 @@ func Home(ctx *middleware.Context) {
|
||||||
ctx.HTML(200, HOME)
|
ctx.HTML(200, HOME)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Explore(ctx *middleware.Context) {
|
||||||
|
ctx.Data["Title"] = ctx.Tr("explore")
|
||||||
|
ctx.Data["PageIsExploreRepositories"] = true
|
||||||
|
|
||||||
|
repos, err := models.GetRecentUpdatedRepositories(20)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "GetRecentUpdatedRepositories", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, repo := range repos {
|
||||||
|
if err = repo.GetOwner(); err != nil {
|
||||||
|
ctx.Handle(500, "GetOwner", fmt.Errorf("%d: %v", repo.Id, err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctx.Data["Repos"] = repos
|
||||||
|
|
||||||
|
ctx.HTML(200, EXPLORE_REPOS)
|
||||||
|
}
|
||||||
|
|
||||||
func NotFound(ctx *middleware.Context) {
|
func NotFound(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Page Not Found"
|
ctx.Data["Title"] = "Page Not Found"
|
||||||
ctx.Handle(404, "home.NotFound", nil)
|
ctx.Handle(404, "home.NotFound", nil)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.4.9.0902 Beta
|
0.4.9.0905 Beta
|
|
@ -0,0 +1,8 @@
|
||||||
|
<div id="setting-menu" class="grid-1-5 panel panel-radius left">
|
||||||
|
<p class="panel-header"><strong>{{.i18n.Tr "explore"}}</strong></p>
|
||||||
|
<div class="panel-body">
|
||||||
|
<ul class="menu menu-vertical switching-list grid-1-5 left">
|
||||||
|
<li {{if .PageIsExploreRepositories}}class="current"{{end}}><a href="/explore">{{.i18n.Tr "explore.repos"}}</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,25 @@
|
||||||
|
{{template "ng/base/head" .}}
|
||||||
|
{{template "ng/base/header" .}}
|
||||||
|
<div id="setting-wrapper" class="main-wrapper">
|
||||||
|
<div id="org-setting" class="container clear">
|
||||||
|
{{template "explore/nav" .}}
|
||||||
|
<div class="grid-4-5 left">
|
||||||
|
<div class="setting-content">
|
||||||
|
<div id="org-repo-list">
|
||||||
|
{{range .Repos}}
|
||||||
|
<div class="org-repo-item">
|
||||||
|
<ul class="org-repo-status right">
|
||||||
|
<li><i class="octicon octicon-star"></i> {{.NumStars}}</li>
|
||||||
|
<li><i class="octicon octicon-git-branch"></i> {{.NumForks}}</li>
|
||||||
|
</ul>
|
||||||
|
<h2><a href="/{{.Owner.Name}}/{{.Name}}">{{.Name}}</a></h2>
|
||||||
|
<p class="org-repo-description">{{.Description}}</p>
|
||||||
|
<p class="org-repo-updated">{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Updated $.i18n.Lang}}</p>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{template "ng/base/footer" .}}
|
|
@ -3,54 +3,54 @@
|
||||||
{{template "org/base/header" .}}
|
{{template "org/base/header" .}}
|
||||||
<div id="setting-wrapper" class="main-wrapper">
|
<div id="setting-wrapper" class="main-wrapper">
|
||||||
<div id="org-setting" class="container clear">
|
<div id="org-setting" class="container clear">
|
||||||
{{template "org/settings/nav" .}}
|
{{template "org/settings/nav" .}}
|
||||||
<div class="grid-4-5 left">
|
<div class="grid-4-5 left">
|
||||||
<div class="setting-content">
|
<div class="setting-content">
|
||||||
{{template "ng/base/alert" .}}
|
{{template "ng/base/alert" .}}
|
||||||
<div id="setting-content">
|
<div id="setting-content">
|
||||||
<div id="user-profile-setting-content" class="panel panel-radius">
|
<div id="user-profile-setting-content" class="panel panel-radius">
|
||||||
<div class="panel-header">
|
<div class="panel-header">
|
||||||
<strong>{{.i18n.Tr "org.settings.options"}}</strong>
|
<strong>{{.i18n.Tr "org.settings.options"}}</strong>
|
||||||
</div>
|
</div>
|
||||||
<form class="form form-align panel-body" id="org-setting-form" action="/org/{{.Org.LowerName}}/settings" method="post">
|
<form class="form form-align panel-body" id="org-setting-form" action="/org/{{.Org.LowerName}}/settings" method="post">
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
<input type="hidden" name="action" value="update">
|
<input type="hidden" name="action" value="update">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="req" for="orgname">{{.i18n.Tr "username"}}</label>
|
<label class="req" for="orgname">{{.i18n.Tr "username"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_UserName}}ipt-error{{end}}" id="orgname" name="uname" value="{{.Org.Name}}" data-orgname="{{.Org.Name}}" required />
|
<input class="ipt ipt-large ipt-radius {{if .Err_UserName}}ipt-error{{end}}" id="orgname" name="uname" value="{{.Org.Name}}" data-orgname="{{.Org.Name}}" required />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="full-name">{{.i18n.Tr "org.settings.full_name"}}</label>
|
<label for="full-name">{{.i18n.Tr "org.settings.full_name"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_FullName}}ipt-error{{end}}" id="full-name" name="fullname" value="{{.Org.FullName}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_FullName}}ipt-error{{end}}" id="full-name" name="fullname" value="{{.Org.FullName}}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="req" for="email">{{.i18n.Tr "email"}}</label>
|
<label class="req" for="email">{{.i18n.Tr "email"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Email}}ipt-error{{end}}" id="email" name="email" type="email" value="{{.Org.Email}}" required />
|
<input class="ipt ipt-large ipt-radius {{if .Err_Email}}ipt-error{{end}}" id="email" name="email" type="email" value="{{.Org.Email}}" required />
|
||||||
</div>
|
</div>
|
||||||
<div class="field clear">
|
<div class="field clear">
|
||||||
<label class="left" for="desc">{{.i18n.Tr "org.org_desc"}}</label>
|
<label class="left" for="desc">{{.i18n.Tr "org.org_desc"}}</label>
|
||||||
<textarea class="ipt ipt-large ipt-radius {{if .Err_Description}}ipt-error{{end}}" id="desc" name="desc">{{.Org.Description}}</textarea>
|
<textarea class="ipt ipt-large ipt-radius {{if .Err_Description}}ipt-error{{end}}" id="desc" name="desc">{{.Org.Description}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="website">{{.i18n.Tr "org.settings.website"}}</label>
|
<label for="website">{{.i18n.Tr "org.settings.website"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Website}}ipt-error{{end}}" id="website" name="website" type="url" value="{{.Org.Website}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_Website}}ipt-error{{end}}" id="website" name="website" type="url" value="{{.Org.Website}}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="location">{{.i18n.Tr "org.settings.location"}}</label>
|
<label for="location">{{.i18n.Tr "org.settings.location"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Location}}ipt-error{{end}}" id="location" name="location" type="text" value="{{.Org.Location}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_Location}}ipt-error{{end}}" id="location" name="location" type="text" value="{{.Org.Location}}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="gravatar-email">Gravatar {{.i18n.Tr "email"}}</label>
|
<label for="gravatar-email">Gravatar {{.i18n.Tr "email"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Avatar}}ipt-error{{end}}" id="gravatar-email" name="avatar" type="text" value="{{.Org.AvatarEmail}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_Avatar}}ipt-error{{end}}" id="gravatar-email" name="avatar" type="text" value="{{.Org.AvatarEmail}}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<span class="form-label"></span>
|
<span class="form-label"></span>
|
||||||
<button class="btn btn-green btn-large btn-radius">{{.i18n.Tr "org.settings.update_settings"}}</button>
|
<button class="btn btn-green btn-large btn-radius">{{.i18n.Tr "org.settings.update_settings"}}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{{template "ng/base/head" .}}
|
{{template "ng/base/head" .}}
|
||||||
{{template "ng/base/header" .}}
|
{{template "ng/base/header" .}}
|
||||||
<div id="body" class="container text-center">
|
<div class="container text-center">
|
||||||
<p style="margin-top: 100px"><img src="/img/404.png" alt="404"/></p>
|
<p style="margin-top: 100px"><img src="/img/404.png" alt="404"/></p>
|
||||||
<hr/>
|
<hr/>
|
||||||
<br>
|
<br>
|
||||||
<p>Application Version: {{AppVer}}</p>
|
<p>Application Version: {{AppVer}}</p>
|
||||||
<p>If you think this is an error, please open an issue on <a href="https://github.com/gogits/gogs/issues/new">GitHub</a>.</p>
|
<p>If you think this is an error, please open an issue on <a href="https://github.com/gogits/gogs/issues/new">GitHub</a>.</p>
|
||||||
<h3>We're currently working on 0.5 beta version, many pages may be missing at this time. Sorry for confusion!</h3>
|
<!-- <p>We're currently working on 0.5 beta version, many pages may be missing at this time. Sorry for confusion!</p> -->
|
||||||
</div>
|
</div>
|
||||||
{{template "ng/base/footer" .}}
|
{{template "ng/base/footer" .}}
|
||||||
|
|
Loading…
Reference in New Issue