diff --git a/README.md b/README.md index ddb8367e9..689b0df4f 100644 --- a/README.md +++ b/README.md @@ -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 source](http://gogs.io/docs/installation/install_from_source.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) ## Acknowledgments @@ -70,7 +70,6 @@ There are 5 ways to install Gogs: - 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 [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 diff --git a/README_ZH.md b/README_ZH.md index de982baf3..401c8186c 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -50,7 +50,7 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自 - [二进制安装](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_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) ## 特别鸣谢 @@ -61,7 +61,6 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自 - [martini](http://martini.codegangsta.io/) 的路由与中间件机制。 - 感谢 [gobuild.io](http://gobuild.io) 提供二进制编译与下载服务。 - 感谢 [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)。 ## 贡献成员 diff --git a/cmd/web.go b/cmd/web.go index 57164683a..cad1db336 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -124,6 +124,7 @@ func runWeb(*cli.Context) { // Routers. m.Get("/", ignSignIn, routers.Home) + m.Get("/explore", routers.Explore) m.Get("/install", bindIgnErr(auth.InstallForm{}), routers.Install) m.Post("/install", bindIgnErr(auth.InstallForm{}), routers.InstallPost) m.Group("", func(r *macaron.Router) { diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini index 946d56046..e8329933a 100644 --- a/conf/locale/locale_en-US.ini +++ b/conf/locale/locale_en-US.ini @@ -47,6 +47,9 @@ collaborative_repos = Collaborative Repositories my_orgs = My Organizations my_mirrors = My Mirrors +[explore] +repos = Repositories + [auth] create_new_account = Create New Account register_hepler_msg = Already have an account? Sign in now! diff --git a/conf/locale/locale_zh-CN.ini b/conf/locale/locale_zh-CN.ini index 55d22f23e..a61a54ceb 100644 --- a/conf/locale/locale_zh-CN.ini +++ b/conf/locale/locale_zh-CN.ini @@ -47,6 +47,9 @@ collaborative_repos = 参与协作的仓库 my_orgs = 我的组织 my_mirrors = 我的镜像 +[explore] +repos = 探索仓库 + [auth] create_new_account = 创建帐户 register_hepler_msg = 已经注册?立即登录! diff --git a/gogs.go b/gogs.go index a11601907..1c012d409 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.4.9.0902 Beta" +const APP_VER = "0.4.9.0905 Beta" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/models/repo.go b/models/repo.go index 23d44a6b8..341e7e47a 100644 --- a/models/repo.go +++ b/models/repo.go @@ -972,8 +972,8 @@ func GetRepositories(uid int64, private bool) ([]*Repository, error) { } // GetRecentUpdatedRepositories returns the list of repositories that are recently updated. -func GetRecentUpdatedRepositories() (repos []*Repository, err error) { - err = x.Where("is_private=?", false).Limit(5).Desc("updated").Find(&repos) +func GetRecentUpdatedRepositories(num int) (repos []*Repository, err error) { + err = x.Where("is_private=?", false).Limit(num).Desc("updated").Find(&repos) return repos, err } diff --git a/routers/home.go b/routers/home.go index 5ea3e2a02..36a4f50fd 100644 --- a/routers/home.go +++ b/routers/home.go @@ -5,6 +5,9 @@ package routers import ( + "fmt" + + "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" @@ -12,7 +15,8 @@ import ( ) const ( - HOME base.TplName = "home" + HOME base.TplName = "home" + EXPLORE_REPOS base.TplName = "explore/repos" ) func Home(ctx *middleware.Context) { @@ -42,6 +46,26 @@ func Home(ctx *middleware.Context) { 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) { ctx.Data["Title"] = "Page Not Found" ctx.Handle(404, "home.NotFound", nil) diff --git a/templates/.VERSION b/templates/.VERSION index 5f3c51819..6e361299e 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.4.9.0902 Beta \ No newline at end of file +0.4.9.0905 Beta \ No newline at end of file diff --git a/templates/explore/nav.tmpl b/templates/explore/nav.tmpl new file mode 100644 index 000000000..1310bccf0 --- /dev/null +++ b/templates/explore/nav.tmpl @@ -0,0 +1,8 @@ +
+

{{.i18n.Tr "explore"}}

+
+ +
+
\ No newline at end of file diff --git a/templates/explore/repos.tmpl b/templates/explore/repos.tmpl new file mode 100644 index 000000000..a1e3d408e --- /dev/null +++ b/templates/explore/repos.tmpl @@ -0,0 +1,25 @@ +{{template "ng/base/head" .}} +{{template "ng/base/header" .}} +
+
+ {{template "explore/nav" .}} +
+
+
+ {{range .Repos}} +
+
    +
  • {{.NumStars}}
  • +
  • {{.NumForks}}
  • +
+

{{.Name}}

+

{{.Description}}

+

{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Updated $.i18n.Lang}}

+
+ {{end}} +
+
+
+
+
+{{template "ng/base/footer" .}} \ No newline at end of file diff --git a/templates/org/settings/options.tmpl b/templates/org/settings/options.tmpl index ae225a9ca..14ea1b349 100644 --- a/templates/org/settings/options.tmpl +++ b/templates/org/settings/options.tmpl @@ -3,54 +3,54 @@ {{template "org/base/header" .}}
- {{template "org/settings/nav" .}} -
-
- {{template "ng/base/alert" .}} -
-
-
- {{.i18n.Tr "org.settings.options"}} -
-
- {{.CsrfTokenHtml}} - -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
-
-
+ {{template "org/settings/nav" .}} +
+
+ {{template "ng/base/alert" .}} +
+
+
+ {{.i18n.Tr "org.settings.options"}} +
+
+ {{.CsrfTokenHtml}} + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
diff --git a/templates/status/404.tmpl b/templates/status/404.tmpl index 2d04b5591..e024715ed 100644 --- a/templates/status/404.tmpl +++ b/templates/status/404.tmpl @@ -1,11 +1,11 @@ {{template "ng/base/head" .}} {{template "ng/base/header" .}} -
+

404



Application Version: {{AppVer}}

If you think this is an error, please open an issue on GitHub.

-

We're currently working on 0.5 beta version, many pages may be missing at this time. Sorry for confusion!

+
{{template "ng/base/footer" .}}