-
+
{{template "base/alert" .ctxData}}
diff --git a/templates/admin/user/list.tmpl b/templates/admin/user/list.tmpl index 45fed87a40..b3e0caa169 100644 --- a/templates/admin/user/list.tmpl +++ b/templates/admin/user/list.tmpl @@ -68,36 +68,35 @@ {{.locale.Tr "email"}} {{.locale.Tr "admin.users.activated"}} - {{.locale.Tr "admin.users.admin"}} {{.locale.Tr "admin.users.restricted"}} {{.locale.Tr "admin.users.2fa"}} - {{.locale.Tr "admin.users.repos"}} {{.locale.Tr "admin.users.created"}} {{.locale.Tr "admin.users.last_login"}} {{SortArrow "lastlogin" "reverselastlogin" $.SortType false}} - {{.locale.Tr "admin.users.edit"}} {{range .Users}} {{.ID}} - {{.Name}} + + {{.Name}} + {{if .IsAdmin}} + {{$.locale.Tr "admin.users.admin"}} + {{end}} + {{.Email}} {{if .IsActive}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}} - {{if .IsAdmin}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}} {{if .IsRestricted}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}} {{if index $.UsersTwoFaStatus .ID}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}} - {{.NumRepos}} {{DateTime "short" .CreatedUnix}} {{if .LastLoginUnix}} {{DateTime "short" .LastLoginUnix}} {{else}} {{$.locale.Tr "admin.users.never_login"}} {{end}} - {{svg "octicon-pencil"}} {{end}} diff --git a/templates/admin/user/view.tmpl b/templates/admin/user/view.tmpl new file mode 100644 index 0000000000..fd3017607c --- /dev/null +++ b/templates/admin/user/view.tmpl @@ -0,0 +1,48 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin view user")}} + +
+
+
+

+ {{.Title}} + +

+
+ {{template "admin/user/view_details" .}} +
+
+
+

+ {{ctx.Locale.Tr "admin.emails"}} +
+ {{.EmailsTotal}} +
+

+
+ {{template "admin/user/view_emails" .}} +
+
+
+

+ {{ctx.Locale.Tr "admin.repositories"}} +
+ {{.ReposTotal}} +
+

+
+ {{template "explore/repo_list" .}} +
+

+ {{ctx.Locale.Tr "settings.organization"}} +
+ {{.OrgsTotal}} +
+

+
+ {{template "explore/user_list" .}} +
+
+ +{{template "admin/layout_footer" .}} diff --git a/templates/admin/user/view_details.tmpl b/templates/admin/user/view_details.tmpl new file mode 100644 index 0000000000..ceb3b9a055 --- /dev/null +++ b/templates/admin/user/view_details.tmpl @@ -0,0 +1,65 @@ +
+
+
+ {{ctx.AvatarUtils.Avatar .User 48}} +
+
+
+ {{template "shared/user/name" .User}} + {{if .User.IsAdmin}} + {{ctx.Locale.Tr "admin.users.admin"}} + {{end}} +
+
+ {{ctx.Locale.Tr "admin.users.auth_source"}}: + {{if eq .LoginSource.ID 0}} + {{ctx.Locale.Tr "admin.users.local"}} + {{else}} + {{.LoginSource.Name}} + {{end}} +
+
+ {{ctx.Locale.Tr "admin.users.activated"}}: + {{if .User.IsActive}} + {{svg "octicon-check"}} + {{else}} + {{svg "octicon-x"}} + {{end}} +
+
+ {{ctx.Locale.Tr "admin.users.restricted"}}: + {{if .User.IsRestricted}} + {{svg "octicon-check"}} + {{else}} + {{svg "octicon-x"}} + {{end}} +
+
+ {{ctx.Locale.Tr "settings.visibility"}}: + {{if .User.Visibility.IsLimited}}{{ctx.Locale.Tr "settings.visibility.limited"}}{{end}} + {{if .User.Visibility.IsPrivate}}{{ctx.Locale.Tr "settings.visibility.private"}}{{end}} +
+
+ {{ctx.Locale.Tr "admin.users.2fa"}}: + {{if .TwoFactorEnabled}} + {{svg "octicon-check"}} + {{else}} + {{svg "octicon-x"}} + {{end}} +
+ {{if .User.Location}} +
+ {{svg "octicon-location"}}{{.User.Location}} +
+ {{end}} + {{if .User.Website}} +
+ + {{svg "octicon-link"}} + {{.User.Website}} + +
+ {{end}} +
+
+
diff --git a/templates/admin/user/view_emails.tmpl b/templates/admin/user/view_emails.tmpl new file mode 100644 index 0000000000..22ce305a88 --- /dev/null +++ b/templates/admin/user/view_emails.tmpl @@ -0,0 +1,19 @@ +
+ {{range .Emails}} +
+
+
+ {{.Email}} + {{if .IsPrimary}} +
{{ctx.Locale.Tr "settings.primary"}}
+ {{end}} + {{if .IsActivated}} +
{{ctx.Locale.Tr "settings.activated"}}
+ {{else}} +
{{ctx.Locale.Tr "settings.requires_activation"}}
+ {{end}} +
+
+
+ {{end}} +
diff --git a/templates/explore/user_list.tmpl b/templates/explore/user_list.tmpl new file mode 100644 index 0000000000..cf6a2933b0 --- /dev/null +++ b/templates/explore/user_list.tmpl @@ -0,0 +1,31 @@ +
+ {{range .Users}} +
+
+ {{ctx.AvatarUtils.Avatar . 48}} +
+
+
+ {{template "shared/user/name" .}} + {{if .Visibility.IsPrivate}} + {{ctx.Locale.Tr "repo.desc.private"}} + {{end}} +
+
+ {{if .Location}} + {{svg "octicon-location"}}{{.Location}} + {{end}} + {{if and .Email (or (and $.ShowUserEmail $.IsSigned (not .KeepEmailPrivate)) $.PageIsAdminUsers)}} + + {{svg "octicon-mail"}} + {{.Email}} + + {{end}} + {{svg "octicon-calendar"}}{{ctx.Locale.Tr "user.joined_on" (DateTime "short" .CreatedUnix) | Safe}} +
+
+
+ {{else}} +
{{ctx.Locale.Tr "explore.user_no_results"}}
+ {{end}} +
diff --git a/templates/explore/users.tmpl b/templates/explore/users.tmpl index 1280f4add6..7e15ae3d47 100644 --- a/templates/explore/users.tmpl +++ b/templates/explore/users.tmpl @@ -4,37 +4,7 @@
{{template "explore/search" .}} -
- {{range .Users}} -
-
- {{ctx.AvatarUtils.Avatar . 48}} -
-
-
- {{template "shared/user/name" .}} - {{if .Visibility.IsPrivate}} - {{$.locale.Tr "repo.desc.private"}} - {{end}} -
-
- {{if .Location}} - {{svg "octicon-location"}}{{.Location}} - {{end}} - {{if and $.ShowUserEmail .Email $.IsSigned (not .KeepEmailPrivate)}} - - {{svg "octicon-mail"}} - {{.Email}} - - {{end}} - {{svg "octicon-calendar"}}{{$.locale.Tr "user.joined_on" (DateTime "short" .CreatedUnix) | Safe}} -
-
-
- {{else}} -
{{$.locale.Tr "explore.user_no_results"}}
- {{end}} -
+ {{template "explore/user_list" .}} {{template "base/paginate" .}}
diff --git a/tests/integration/admin_user_test.go b/tests/integration/admin_user_test.go index dd6b9ccbbe..669060c787 100644 --- a/tests/integration/admin_user_test.go +++ b/tests/integration/admin_user_test.go @@ -51,8 +51,8 @@ func testSuccessfullEdit(t *testing.T, formData user_model.User) { func makeRequest(t *testing.T, formData user_model.User, headerCode int) { session := loginUser(t, "user1") - csrf := GetCSRF(t, session, "/admin/users/"+strconv.Itoa(int(formData.ID))) - req := NewRequestWithValues(t, "POST", "/admin/users/"+strconv.Itoa(int(formData.ID)), map[string]string{ + csrf := GetCSRF(t, session, "/admin/users/"+strconv.Itoa(int(formData.ID))+"/edit") + req := NewRequestWithValues(t, "POST", "/admin/users/"+strconv.Itoa(int(formData.ID))+"/edit", map[string]string{ "_csrf": csrf, "user_name": formData.Name, "login_name": formData.LoginName, @@ -72,7 +72,7 @@ func TestAdminDeleteUser(t *testing.T) { session := loginUser(t, "user1") - csrf := GetCSRF(t, session, "/admin/users/8") + csrf := GetCSRF(t, session, "/admin/users/8/edit") req := NewRequestWithValues(t, "POST", "/admin/users/8/delete", map[string]string{ "_csrf": csrf, }) diff --git a/web_src/css/admin.css b/web_src/css/admin.css index fecae5f2bf..e6866b27a6 100644 --- a/web_src/css/admin.css +++ b/web_src/css/admin.css @@ -42,3 +42,10 @@ .admin .table th { white-space: nowrap; } + +.admin-responsive-columns { + display: flex; + flex-wrap: wrap; + gap: 1rem; + margin-bottom: 1rem; +}