mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Add the ability to explore organizations (#3573)
* Add ability to explore organizations * Use right icon for org explore links
This commit is contained in:
		@@ -214,6 +214,7 @@ func runWeb(ctx *cli.Context) error {
 | 
			
		||||
		})
 | 
			
		||||
		m.Get("/repos", routers.ExploreRepos)
 | 
			
		||||
		m.Get("/users", routers.ExploreUsers)
 | 
			
		||||
		m.Get("/organizations", routers.ExploreOrganizations)
 | 
			
		||||
	}, ignSignIn)
 | 
			
		||||
	m.Combo("/install", routers.InstallInit).Get(routers.Install).
 | 
			
		||||
		Post(bindIgnErr(auth.InstallForm{}), routers.InstallPost)
 | 
			
		||||
 
 | 
			
		||||
@@ -137,6 +137,7 @@ issues.in_your_repos = In your repositories
 | 
			
		||||
[explore]
 | 
			
		||||
repos = Repositories
 | 
			
		||||
users = Users
 | 
			
		||||
organizations = Organizations
 | 
			
		||||
search = Search
 | 
			
		||||
 | 
			
		||||
[auth]
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -17,9 +17,10 @@ import (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	HOME          base.TplName = "home"
 | 
			
		||||
	EXPLORE_REPOS base.TplName = "explore/repos"
 | 
			
		||||
	EXPLORE_USERS base.TplName = "explore/users"
 | 
			
		||||
	HOME                  base.TplName = "home"
 | 
			
		||||
	EXPLORE_REPOS         base.TplName = "explore/repos"
 | 
			
		||||
	EXPLORE_USERS         base.TplName = "explore/users"
 | 
			
		||||
	EXPLORE_ORGANIZATIONS base.TplName = "explore/organizations"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
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) {
 | 
			
		||||
	ctx.Data["Title"] = "Page Not Found"
 | 
			
		||||
	ctx.Handle(404, "home.NotFound", nil)
 | 
			
		||||
 
 | 
			
		||||
@@ -7,5 +7,8 @@
 | 
			
		||||
		<a class="{{if .PageIsExploreUsers}}active{{end}} item" href="{{AppSubUrl}}/explore/users">
 | 
			
		||||
			<span class="octicon octicon-person"></span> {{.i18n.Tr "explore.users"}}
 | 
			
		||||
		</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>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										35
									
								
								templates/explore/organizations.tmpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								templates/explore/organizations.tmpl
									
									
									
									
									
										Normal 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" .}}
 | 
			
		||||
		Reference in New Issue
	
	Block a user