瀏覽代碼

Added All Users

Yoginth 7 年之前
父節點
當前提交
051db67ee9
共有 3 個文件被更改,包括 43 次插入0 次删除
  1. 1 0
      cmd/web.go
  2. 31 0
      routes/admin/allusers.go
  3. 11 0
      templates/admin/allusers.tmpl

+ 1 - 0
cmd/web.go

@@ -262,6 +262,7 @@ func runWeb(c *cli.Context) error {
 		m.Get("/config", admin.Config)
 		m.Post("/config/test_mail", admin.SendTestMail)
 		m.Get("/monitor", admin.Monitor)
+		m.Get("/allusers", admin.AllUsers)
 		
 		m.Group("/news", func() {
 			m.Get("", admin.News)

+ 31 - 0
routes/admin/allusers.go

@@ -0,0 +1,31 @@
+// Copyright 2015 The Gogs Authors. All rights reserved.
+// Copyright 2018 Gitote. All rights reserved.
+//
+// This source code is licensed under the MIT license found in the
+// LICENSE file in the root directory of this source tree.
+
+package admin
+
+import (
+	"gitote/gitote/models"
+	"gitote/gitote/pkg/context"
+	"gitote/gitote/pkg/setting"
+	"gitote/gitote/routes"
+)
+
+const (
+	// UsersListTPL list page template
+	AllUsersTPL = "admin/allusers"
+)
+
+// AllUsers shows all users page
+func AllUsers(c *context.Context) {
+	routes.RenderUserSearch(c, &routes.UserSearchOptions{
+		Type:     models.UserTypeIndividual,
+		Counter:  models.CountUsers,
+		Ranger:   models.Users,
+		PageSize: setting.UI.Admin.UserPagingNum,
+		OrderBy:  "id ASC",
+		TplName:  AllUsersTPL,
+	})
+}

+ 11 - 0
templates/admin/allusers.tmpl

@@ -0,0 +1,11 @@
+{{range .Users}}
+    <img src="{{AppendAvatarSize .RelAvatarLink 80}}">
+{{end}}
+
+<style>
+    img {
+        margin: 0;
+        height: 40px;
+        float: left;
+    }
+</style>