social = Social Accounts
applications = Applications
orgs = Organizations
+repos = Repositories
delete = Delete Account
twofa = Two-Factor Authentication
account_link = External Accounts
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!
padding-top: 15px;
padding-bottom: 5px;
}
+.user.settings .iconFloat {
+ float: left;
+}
.dashboard {
padding-top: 15px;
padding-bottom: 80px;
padding-top: 15px;
padding-bottom: 5px;
}
+ &.settings {
+ .iconFloat {
+ float: left;
+ }
+ }
}
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)
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"
)
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)
+}
</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"}}
--- /dev/null
+{{template "base/head" .}}\r
+<div class="user settings">\r
+ {{template "user/settings/navbar" .}}\r
+ <div class="ui container">\r
+ {{template "base/alert" .}}\r
+ <h4 class="ui top attached header">\r
+ {{.i18n.Tr "settings.repos"}}\r
+ </h4>\r
+ <div class="ui attached segment">\r
+ {{if .Repos}}\r
+ <div class="ui middle aligned divided list">\r
+ {{range .Repos}}\r
+ <div class="item">\r
+ <div class="content">\r
+ {{if .IsPrivate}}\r
+ <span class="text gold iconFloat"><i class="octicon octicon-lock"></i></span>\r
+ {{else if .IsFork}}\r
+ <span class="iconFloat"><i class="octicon octicon-repo-forked"></i></span>\r
+ {{else if .IsMirror}}\r
+ <span class="iconFloat"><i class="octicon octicon-repo-clone"></i></span>\r
+ {{else}}\r
+ <span class="iconFloat"><i class="octicon octicon-repo"></i></span>\r
+ {{end}}\r
+ <a class="name" href="{{AppSubUrl}}/{{$.Owner.Name}}/{{.Name}}">{{$.Owner.Name}}/{{.Name}}</a>\r
+ <span>{{SizeFmt .Size}}</span>\r
+ {{if .IsFork}}\r
+ {{$.i18n.Tr "repo.forked_from"}}\r
+ <span><a href="{{AppSubUrl}}/{{.BaseRepo.Owner.Name}}/{{.BaseRepo.Name}}">{{.BaseRepo.Owner.Name}}/{{.BaseRepo.Name}}</a></span>\r
+ {{end}}\r
+ </div>\r
+ </div>\r
+ {{end}}\r
+ </div>\r
+ {{else}}\r
+ <div class="item">\r
+ {{.i18n.Tr "settings.repos_none"}}\r
+ </div>\r
+ {{end}}\r
+ </div>\r
+ </div>\r
+</div>\r
+\r
+<div class="ui small basic delete modal">\r
+ <div class="ui icon header">\r
+ <i class="trash icon"></i>\r
+ {{.i18n.Tr "settings.remove_account_link"}}\r
+ </div>\r
+ <div class="content">\r
+ <p>{{.i18n.Tr "settings.remove_account_link_desc"}}</p>\r
+ </div>\r
+ {{template "base/delete_modal_actions" .}}\r
+</div>\r
+{{template "base/footer" .}}\r