Add the ability to explore organizations (#3573)

* Add ability to explore organizations

* Use right icon for org explore links
This commit is contained in:
Daniel Oaks 2016-09-01 23:08:05 +10:00 committed by 无闻
parent 4efaf8e882
commit b3d9ca4ccd
6 changed files with 940 additions and 1104 deletions

View file

@ -214,6 +214,7 @@ func runWeb(ctx *cli.Context) error {
}) })
m.Get("/repos", routers.ExploreRepos) m.Get("/repos", routers.ExploreRepos)
m.Get("/users", routers.ExploreUsers) m.Get("/users", routers.ExploreUsers)
m.Get("/organizations", routers.ExploreOrganizations)
}, ignSignIn) }, ignSignIn)
m.Combo("/install", routers.InstallInit).Get(routers.Install). m.Combo("/install", routers.InstallInit).Get(routers.Install).
Post(bindIgnErr(auth.InstallForm{}), routers.InstallPost) Post(bindIgnErr(auth.InstallForm{}), routers.InstallPost)

View file

@ -137,6 +137,7 @@ issues.in_your_repos = In your repositories
[explore] [explore]
repos = Repositories repos = Repositories
users = Users users = Users
organizations = Organizations
search = Search search = Search
[auth] [auth]

File diff suppressed because one or more lines are too long

View file

@ -20,6 +20,7 @@ const (
HOME base.TplName = "home" HOME base.TplName = "home"
EXPLORE_REPOS base.TplName = "explore/repos" EXPLORE_REPOS base.TplName = "explore/repos"
EXPLORE_USERS base.TplName = "explore/users" EXPLORE_USERS base.TplName = "explore/users"
EXPLORE_ORGANIZATIONS base.TplName = "explore/organizations"
) )
func Home(ctx *context.Context) { func Home(ctx *context.Context) {
@ -180,6 +181,21 @@ func ExploreUsers(ctx *context.Context) {
}) })
} }
func ExploreOrganizations(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("explore")
ctx.Data["PageIsExplore"] = true
ctx.Data["PageIsExploreOrganizations"] = true
RenderUserSearch(ctx, &UserSearchOptions{
Type: models.USER_TYPE_ORGANIZATION,
Counter: models.CountOrganizations,
Ranger: models.Organizations,
PageSize: setting.UI.ExplorePagingNum,
OrderBy: "updated_unix DESC",
TplName: EXPLORE_ORGANIZATIONS,
})
}
func NotFound(ctx *context.Context) { func NotFound(ctx *context.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)

View file

@ -7,5 +7,8 @@
<a class="{{if .PageIsExploreUsers}}active{{end}} item" href="{{AppSubUrl}}/explore/users"> <a class="{{if .PageIsExploreUsers}}active{{end}} item" href="{{AppSubUrl}}/explore/users">
<span class="octicon octicon-person"></span> {{.i18n.Tr "explore.users"}} <span class="octicon octicon-person"></span> {{.i18n.Tr "explore.users"}}
</a> </a>
<a class="{{if .PageIsExploreOrganizations}}active{{end}} item" href="{{AppSubUrl}}/explore/organizations">
<span class="octicon octicon-organization"></span> {{.i18n.Tr "explore.organizations"}}
</a>
</div> </div>
</div> </div>

View file

@ -0,0 +1,35 @@
{{template "base/head" .}}
<div class="explore users">
<div class="ui container">
<div class="ui grid">
{{template "explore/navbar" .}}
<div class="twelve wide column content">
{{template "explore/search" .}}
<div class="ui user list">
{{range .Users}}
<div class="item">
<img class="ui avatar image" src="{{.RelAvatarLink}}">
<div class="content">
<span class="header"><a href="{{.HomeLink}}">{{.Name}}</a> {{.FullName}}</span>
<div class="description">
{{if .Location}}
<i class="octicon octicon-location"></i> {{.Location}}
{{end}}
{{if and .Website}}
<i class="octicon octicon-link"></i>
<a href="{{.Website}}" rel="nofollow">{{.Website}}</a>
{{end}}
<i class="octicon octicon-clock"></i> {{$.i18n.Tr "user.join_on"}} {{DateFmtShort .Created}}
</div>
</div>
</div>
{{end}}
</div>
{{template "explore/page" .}}
</div>
</div>
</div>
</div>
{{template "base/footer" .}}