diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 949f560a3..2e4520a7a 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -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 CANNOT be undone! diff --git a/public/css/index.css b/public/css/index.css index d09490adb..ebf8cd1a5 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -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; diff --git a/public/less/_user.less b/public/less/_user.less index a3e685299..7b6294448 100644 --- a/public/less/_user.less +++ b/public/less/_user.less @@ -101,4 +101,9 @@ padding-top: 15px; padding-bottom: 5px; } + &.settings { + .iconFloat { + float: left; + } + } } diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 067bf6a7f..a0684c847 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -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) diff --git a/routers/user/setting.go b/routers/user/setting.go index 2c951eaf5..b71b29ba2 100644 --- a/routers/user/setting.go +++ b/routers/user/setting.go @@ -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) +} diff --git a/templates/user/settings/navbar.tmpl b/templates/user/settings/navbar.tmpl index ab9b41666..b0a3c9fcc 100644 --- a/templates/user/settings/navbar.tmpl +++ b/templates/user/settings/navbar.tmpl @@ -30,6 +30,8 @@ {{.i18n.Tr "settings.organization"}} + + {{.i18n.Tr "settings.repos"}} {{.i18n.Tr "settings.delete"}} diff --git a/templates/user/settings/repos.tmpl b/templates/user/settings/repos.tmpl new file mode 100644 index 000000000..39d98c6d1 --- /dev/null +++ b/templates/user/settings/repos.tmpl @@ -0,0 +1,53 @@ +{{template "base/head" .}} +
+ {{template "user/settings/navbar" .}} +
+ {{template "base/alert" .}} +

+ {{.i18n.Tr "settings.repos"}} +

+
+ {{if .Repos}} + + {{else}} +
+ {{.i18n.Tr "settings.repos_none"}} +
+ {{end}} +
+
+
+ + +{{template "base/footer" .}}