Skip to content

Commit b3d9ca4

Browse files
DanielOaksunknwon
authored andcommitted
Add the ability to explore organizations (#3573)
* Add ability to explore organizations * Use right icon for org explore links
1 parent 4efaf8e commit b3d9ca4

File tree

6 files changed

+940
-1104
lines changed

6 files changed

+940
-1104
lines changed

cmd/web.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ func runWeb(ctx *cli.Context) error {
214214
})
215215
m.Get("/repos", routers.ExploreRepos)
216216
m.Get("/users", routers.ExploreUsers)
217+
m.Get("/organizations", routers.ExploreOrganizations)
217218
}, ignSignIn)
218219
m.Combo("/install", routers.InstallInit).Get(routers.Install).
219220
Post(bindIgnErr(auth.InstallForm{}), routers.InstallPost)

conf/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ issues.in_your_repos = In your repositories
137137
[explore]
138138
repos = Repositories
139139
users = Users
140+
organizations = Organizations
140141
search = Search
141142
142143
[auth]

modules/bindata/bindata.go

Lines changed: 881 additions & 1101 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

routers/home.go

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ import (
1717
)
1818

1919
const (
20-
HOME base.TplName = "home"
21-
EXPLORE_REPOS base.TplName = "explore/repos"
22-
EXPLORE_USERS base.TplName = "explore/users"
20+
HOME base.TplName = "home"
21+
EXPLORE_REPOS base.TplName = "explore/repos"
22+
EXPLORE_USERS base.TplName = "explore/users"
23+
EXPLORE_ORGANIZATIONS base.TplName = "explore/organizations"
2324
)
2425

2526
func Home(ctx *context.Context) {
@@ -180,6 +181,21 @@ func ExploreUsers(ctx *context.Context) {
180181
})
181182
}
182183

184+
func ExploreOrganizations(ctx *context.Context) {
185+
ctx.Data["Title"] = ctx.Tr("explore")
186+
ctx.Data["PageIsExplore"] = true
187+
ctx.Data["PageIsExploreOrganizations"] = true
188+
189+
RenderUserSearch(ctx, &UserSearchOptions{
190+
Type: models.USER_TYPE_ORGANIZATION,
191+
Counter: models.CountOrganizations,
192+
Ranger: models.Organizations,
193+
PageSize: setting.UI.ExplorePagingNum,
194+
OrderBy: "updated_unix DESC",
195+
TplName: EXPLORE_ORGANIZATIONS,
196+
})
197+
}
198+
183199
func NotFound(ctx *context.Context) {
184200
ctx.Data["Title"] = "Page Not Found"
185201
ctx.Handle(404, "home.NotFound", nil)

templates/explore/navbar.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
<a class="{{if .PageIsExploreUsers}}active{{end}} item" href="{{AppSubUrl}}/explore/users">
88
<span class="octicon octicon-person"></span> {{.i18n.Tr "explore.users"}}
99
</a>
10+
<a class="{{if .PageIsExploreOrganizations}}active{{end}} item" href="{{AppSubUrl}}/explore/organizations">
11+
<span class="octicon octicon-organization"></span> {{.i18n.Tr "explore.organizations"}}
12+
</a>
1013
</div>
1114
</div>

templates/explore/organizations.tmpl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{{template "base/head" .}}
2+
<div class="explore users">
3+
<div class="ui container">
4+
<div class="ui grid">
5+
{{template "explore/navbar" .}}
6+
<div class="twelve wide column content">
7+
{{template "explore/search" .}}
8+
9+
<div class="ui user list">
10+
{{range .Users}}
11+
<div class="item">
12+
<img class="ui avatar image" src="{{.RelAvatarLink}}">
13+
<div class="content">
14+
<span class="header"><a href="{{.HomeLink}}">{{.Name}}</a> {{.FullName}}</span>
15+
<div class="description">
16+
{{if .Location}}
17+
<i class="octicon octicon-location"></i> {{.Location}}
18+
{{end}}
19+
{{if and .Website}}
20+
<i class="octicon octicon-link"></i>
21+
<a href="{{.Website}}" rel="nofollow">{{.Website}}</a>
22+
{{end}}
23+
<i class="octicon octicon-clock"></i> {{$.i18n.Tr "user.join_on"}} {{DateFmtShort .Created}}
24+
</div>
25+
</div>
26+
</div>
27+
{{end}}
28+
</div>
29+
30+
{{template "explore/page" .}}
31+
</div>
32+
</div>
33+
</div>
34+
</div>
35+
{{template "base/footer" .}}

0 commit comments

Comments
 (0)