Browse Source

Add the ability to explore organizations (#3573)

* Add ability to explore organizations

* Use right icon for org explore links
pull/3225/head
Daniel Oaks 8 years ago committed by 无闻
parent
commit
b3d9ca4ccd
  1. 1
      cmd/web.go
  2. 1
      conf/locale/locale_en-US.ini
  3. 1462
      modules/bindata/bindata.go
  4. 16
      routers/home.go
  5. 3
      templates/explore/navbar.tmpl
  6. 35
      templates/explore/organizations.tmpl

1
cmd/web.go

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

1
conf/locale/locale_en-US.ini

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

1462
modules/bindata/bindata.go

File diff suppressed because one or more lines are too long

16
routers/home.go

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

3
templates/explore/navbar.tmpl

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

35
templates/explore/organizations.tmpl

@ -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" .}}
Loading…
Cancel
Save