mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-21 23:02:41 +01:00
Implementation of all repositories of a user from user->settings (#1740)
* Implementation of all repositories of a user from user->settings * Update message when no repository found * Update according to comments * Change UI to have a better look * improved user repositories UI
This commit is contained in:
parent
1739e84ac0
commit
e5d80b7090
7 changed files with 101 additions and 0 deletions
|
@ -308,6 +308,7 @@ ssh_gpg_keys = SSH / GPG Keys
|
|||
social = Social Accounts
|
||||
applications = Applications
|
||||
orgs = Organizations
|
||||
repos = Repositories
|
||||
delete = Delete Account
|
||||
twofa = Two-Factor Authentication
|
||||
account_link = External Accounts
|
||||
|
@ -446,6 +447,7 @@ remove_account_link_desc = Removing this linked account will revoke all related
|
|||
remove_account_link_success = Account link has been removed successfully!
|
||||
|
||||
orgs_none = You are not a member of any organizations.
|
||||
repos_none = You do not own any repositories
|
||||
|
||||
delete_account = Delete Your Account
|
||||
delete_prompt = The operation will delete your account permanently, and <strong>CANNOT</strong> be undone!
|
||||
|
|
|
@ -2877,6 +2877,9 @@ footer .ui.language .menu {
|
|||
padding-top: 15px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.user.settings .iconFloat {
|
||||
float: left;
|
||||
}
|
||||
.dashboard {
|
||||
padding-top: 15px;
|
||||
padding-bottom: 80px;
|
||||
|
|
|
@ -101,4 +101,9 @@
|
|||
padding-top: 15px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
&.settings {
|
||||
.iconFloat {
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -237,6 +237,7 @@ func RegisterRoutes(m *macaron.Macaron) {
|
|||
m.Route("/delete", "GET,POST", user.SettingsDelete)
|
||||
m.Combo("/account_link").Get(user.SettingsAccountLinks).Post(user.SettingsDeleteAccountLink)
|
||||
m.Get("/organization", user.SettingsOrganization)
|
||||
m.Get("/repos", user.SettingsRepos)
|
||||
m.Group("/two_factor", func() {
|
||||
m.Get("", user.SettingsTwoFactor)
|
||||
m.Post("/regenerate_scratch", user.SettingsTwoFactorRegenerateScratch)
|
||||
|
|
|
@ -39,6 +39,7 @@ const (
|
|||
tplSettingsTwofaEnroll base.TplName = "user/settings/twofa_enroll"
|
||||
tplSettingsAccountLink base.TplName = "user/settings/account_link"
|
||||
tplSettingsOrganization base.TplName = "user/settings/organization"
|
||||
tplSettingsRepositories base.TplName = "user/settings/repos"
|
||||
tplSettingsDelete base.TplName = "user/settings/delete"
|
||||
tplSecurity base.TplName = "user/security"
|
||||
)
|
||||
|
@ -785,3 +786,37 @@ func SettingsOrganization(ctx *context.Context) {
|
|||
ctx.Data["Orgs"] = orgs
|
||||
ctx.HTML(200, tplSettingsOrganization)
|
||||
}
|
||||
|
||||
// SettingsRepos display a list of all repositories of the user
|
||||
func SettingsRepos(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("settings")
|
||||
ctx.Data["PageIsSettingsRepos"] = true
|
||||
ctxUser := ctx.User
|
||||
|
||||
var err error
|
||||
if err = ctxUser.GetRepositories(1, setting.UI.User.RepoPagingNum); err != nil {
|
||||
ctx.Handle(500, "GetRepositories", err)
|
||||
return
|
||||
}
|
||||
repos := ctxUser.Repos
|
||||
|
||||
for i := range repos {
|
||||
if repos[i].IsFork {
|
||||
err := repos[i].GetBaseRepo()
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetBaseRepo", err)
|
||||
return
|
||||
}
|
||||
err = repos[i].BaseRepo.GetOwner()
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetOwner", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ctx.Data["Owner"] = ctxUser
|
||||
ctx.Data["Repos"] = repos
|
||||
|
||||
ctx.HTML(200, tplSettingsRepositories)
|
||||
}
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
</a>
|
||||
<a class="{{if .PageIsSettingsOrganization}}active{{end}} item" href="{{AppSubUrl}}/user/settings/organization">
|
||||
{{.i18n.Tr "settings.organization"}}
|
||||
<a class="{{if .PageIsSettingsRepos}}active{{end}} item" href="{{AppSubUrl}}/user/settings/repos">
|
||||
{{.i18n.Tr "settings.repos"}}
|
||||
</a>
|
||||
<a class="{{if .PageIsSettingsDelete}}active{{end}} item" href="{{AppSubUrl}}/user/settings/delete">
|
||||
{{.i18n.Tr "settings.delete"}}
|
||||
|
|
53
templates/user/settings/repos.tmpl
Normal file
53
templates/user/settings/repos.tmpl
Normal file
|
@ -0,0 +1,53 @@
|
|||
{{template "base/head" .}}
|
||||
<div class="user settings">
|
||||
{{template "user/settings/navbar" .}}
|
||||
<div class="ui container">
|
||||
{{template "base/alert" .}}
|
||||
<h4 class="ui top attached header">
|
||||
{{.i18n.Tr "settings.repos"}}
|
||||
</h4>
|
||||
<div class="ui attached segment">
|
||||
{{if .Repos}}
|
||||
<div class="ui middle aligned divided list">
|
||||
{{range .Repos}}
|
||||
<div class="item">
|
||||
<div class="content">
|
||||
{{if .IsPrivate}}
|
||||
<span class="text gold iconFloat"><i class="octicon octicon-lock"></i></span>
|
||||
{{else if .IsFork}}
|
||||
<span class="iconFloat"><i class="octicon octicon-repo-forked"></i></span>
|
||||
{{else if .IsMirror}}
|
||||
<span class="iconFloat"><i class="octicon octicon-repo-clone"></i></span>
|
||||
{{else}}
|
||||
<span class="iconFloat"><i class="octicon octicon-repo"></i></span>
|
||||
{{end}}
|
||||
<a class="name" href="{{AppSubUrl}}/{{$.Owner.Name}}/{{.Name}}">{{$.Owner.Name}}/{{.Name}}</a>
|
||||
<span>{{SizeFmt .Size}}</span>
|
||||
{{if .IsFork}}
|
||||
{{$.i18n.Tr "repo.forked_from"}}
|
||||
<span><a href="{{AppSubUrl}}/{{.BaseRepo.Owner.Name}}/{{.BaseRepo.Name}}">{{.BaseRepo.Owner.Name}}/{{.BaseRepo.Name}}</a></span>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="item">
|
||||
{{.i18n.Tr "settings.repos_none"}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui small basic delete modal">
|
||||
<div class="ui icon header">
|
||||
<i class="trash icon"></i>
|
||||
{{.i18n.Tr "settings.remove_account_link"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<p>{{.i18n.Tr "settings.remove_account_link_desc"}}</p>
|
||||
</div>
|
||||
{{template "base/delete_modal_actions" .}}
|
||||
</div>
|
||||
{{template "base/footer" .}}
|
Loading…
Reference in a new issue