Browse Source

Add suburl support

release/v0.9
Unknwon 8 years ago
parent
commit
7ba9257a7f
  1. 7
      cmd/web.go
  2. 2
      gogs.go
  3. 2
      models/action.go
  4. 6
      models/user.go
  5. 2
      modules/base/markdown.go
  6. 16
      modules/base/template.go
  7. 8
      modules/middleware/auth.go
  8. 2
      modules/middleware/context.go
  9. 6
      modules/middleware/org.go
  10. 12
      modules/middleware/repo.go
  11. 13
      modules/setting/setting.go
  12. 2
      routers/admin/admin.go
  13. 8
      routers/admin/auths.go
  14. 8
      routers/admin/users.go
  15. 2
      routers/home.go
  16. 2
      routers/install.go
  17. 2
      routers/org/members.go
  18. 2
      routers/org/org.go
  19. 8
      routers/org/setting.go
  20. 4
      routers/repo/commit.go
  21. 6
      routers/repo/issue.go
  22. 4
      routers/repo/repo.go
  23. 16
      routers/repo/setting.go
  24. 12
      routers/user/auth.go
  25. 6
      routers/user/home.go
  26. 18
      routers/user/setting.go
  27. 4
      routers/user/social.go
  28. 2
      templates/.VERSION
  29. 2
      templates/admin/auth/edit.tmpl
  30. 10
      templates/admin/auth/list.tmpl
  31. 2
      templates/admin/auth/new.tmpl
  32. 4
      templates/admin/dashboard.tmpl
  33. 14
      templates/admin/nav.tmpl
  34. 6
      templates/admin/org/list.tmpl
  35. 8
      templates/admin/repo/list.tmpl
  36. 2
      templates/admin/user/edit.tmpl
  37. 10
      templates/admin/user/list.tmpl
  38. 2
      templates/admin/user/new.tmpl
  39. 26
      templates/base/head.tmpl
  40. 18
      templates/base/navbar.tmpl
  41. 2
      templates/explore/nav.tmpl
  42. 2
      templates/explore/repos.tmpl
  43. 4
      templates/home.tmpl
  44. 2
      templates/install.tmpl
  45. 22
      templates/ng/base/head.tmpl
  46. 26
      templates/ng/base/header.tmpl
  47. 8
      templates/ng/base/social.tmpl
  48. 2
      templates/org/base/header.tmpl
  49. 4
      templates/org/create.tmpl
  50. 16
      templates/org/home.tmpl
  51. 2
      templates/org/member/members.tmpl
  52. 4
      templates/org/new.tmpl
  53. 2
      templates/org/settings/delete.tmpl
  54. 6
      templates/org/settings/nav.tmpl
  55. 2
      templates/org/settings/options.tmpl
  56. 2
      templates/org/team/members.tmpl
  57. 2
      templates/org/team/repositories.tmpl
  58. 2
      templates/org/team/teams.tmpl
  59. 2
      templates/repo/bare.tmpl
  60. 4
      templates/repo/commits_table.tmpl
  61. 4
      templates/repo/create.tmpl
  62. 2
      templates/repo/diff.tmpl
  63. 2
      templates/repo/header.tmpl
  64. 2
      templates/repo/issue/list.tmpl
  65. 26
      templates/repo/issue/view.tmpl
  66. 4
      templates/repo/migrate.tmpl
  67. 6
      templates/repo/nav.tmpl
  68. 4
      templates/repo/release/list.tmpl
  69. 6
      templates/repo/setting_nav.tmpl
  70. 2
      templates/repo/settings/collaboration.tmpl
  71. 2
      templates/repo/single.tmpl
  72. 6
      templates/repo/single_list.tmpl
  73. 4
      templates/repo/view_list.tmpl
  74. 2
      templates/status/404.tmpl
  75. 2
      templates/status/500.tmpl
  76. 2
      templates/user/auth/activate.tmpl
  77. 2
      templates/user/auth/forgot_passwd.tmpl
  78. 2
      templates/user/auth/reset_passwd.tmpl
  79. 6
      templates/user/auth/signin.tmpl
  80. 4
      templates/user/auth/signup.tmpl
  81. 24
      templates/user/dashboard/dashboard.tmpl
  82. 6
      templates/user/dashboard/nav.tmpl
  83. 24
      templates/user/issues.tmpl
  84. 2
      templates/user/profile.tmpl
  85. 2
      templates/user/settings/delete.tmpl
  86. 10
      templates/user/settings/nav.tmpl
  87. 2
      templates/user/settings/password.tmpl
  88. 2
      templates/user/settings/profile.tmpl
  89. 2
      templates/user/settings/social.tmpl
  90. 4
      templates/user/settings/sshkeys.tmpl

7
cmd/web.go

@ -79,6 +79,7 @@ func newMacaron() *macaron.Macaron {
IndentJSON: macaron.Env != macaron.PROD,
}))
m.Use(i18n.I18n(i18n.Options{
SubURL: setting.AppSubUrl,
Langs: setting.Langs,
Names: setting.Names,
Redirect: true,
@ -88,7 +89,9 @@ func newMacaron() *macaron.Macaron {
Interval: setting.CacheInternal,
Conn: setting.CacheConn,
}))
m.Use(captcha.Captchaer())
m.Use(captcha.Captchaer(captcha.Options{
SubURL: setting.AppSubUrl,
}))
m.Use(session.Sessioner(session.Options{
Provider: setting.SessionProvider,
Config: *setting.SessionConfig,
@ -365,7 +368,7 @@ func runWeb(*cli.Context) {
var err error
listenAddr := fmt.Sprintf("%s:%s", setting.HttpAddr, setting.HttpPort)
log.Info("Listen: %v://%s", setting.Protocol, listenAddr)
log.Info("Listen: %v://%s%s", setting.Protocol, listenAddr, setting.AppSubUrl)
switch setting.Protocol {
case setting.HTTP:
err = http.ListenAndServe(listenAddr, m)

2
gogs.go

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
const APP_VER = "0.5.2.0917 Beta"
const APP_VER = "0.5.3.0919 Beta"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())

2
models/action.go

@ -137,7 +137,7 @@ func updateIssuesCommit(userId, repoId int64, repoUserName, repoName string, com
return err
}
url := fmt.Sprintf("%s/%s/%s/commit/%s", setting.AppRootSubUrl, repoUserName, repoName, c.Sha1)
url := fmt.Sprintf("%s/%s/%s/commit/%s", setting.AppSubUrl, repoUserName, repoName, c.Sha1)
message := fmt.Sprintf(`<a href="%s">%s</a>`, url, c.Message)
if _, err = CreateComment(userId, issue.RepoId, issue.Id, 0, 0, COMMIT, message, nil); err != nil {

6
models/user.go

@ -82,14 +82,14 @@ type User struct {
// DashboardLink returns the user dashboard page link.
func (u *User) DashboardLink() string {
if u.IsOrganization() {
return setting.AppRootSubUrl + "/org/" + u.Name + "/dashboard/"
return setting.AppSubUrl + "/org/" + u.Name + "/dashboard/"
}
return setting.AppRootSubUrl + "/"
return setting.AppSubUrl + "/"
}
// HomeLink returns the user home page link.
func (u *User) HomeLink() string {
return setting.AppRootSubUrl + "/user/" + u.Name
return setting.AppSubUrl + "/user/" + u.Name
}
// AvatarLink returns user gravatar link.

2
modules/base/markdown.go

@ -113,7 +113,7 @@ func RenderSpecialLink(rawBytes []byte, urlPrefix string) []byte {
ms := MentionPattern.FindAll(line, -1)
for _, m := range ms {
line = bytes.Replace(line, m,
[]byte(fmt.Sprintf(`<a href="%s/user/%s">%s</a>`, setting.AppRootSubUrl, m[1:], m)), -1)
[]byte(fmt.Sprintf(`<a href="%s/user/%s">%s</a>`, setting.AppSubUrl, m[1:], m)), -1)
}
}

16
modules/base/template.go

@ -82,8 +82,8 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
"AppName": func() string {
return setting.AppName
},
"AppRootSubUrl": func() string {
return setting.AppRootSubUrl
"AppSubUrl": func() string {
return setting.AppSubUrl
},
"AppVer": func() string {
return setting.AppVer
@ -210,7 +210,7 @@ func ActionDesc(act Actioner) string {
content := act.GetContent()
switch act.GetOpType() {
case 1: // Create repository.
return fmt.Sprintf(TPL_CREATE_REPO, setting.AppRootSubUrl, actUserName, actUserName, repoLink, repoName)
return fmt.Sprintf(TPL_CREATE_REPO, setting.AppSubUrl, actUserName, actUserName, repoLink, repoName)
case 5: // Commit repository.
var push *PushCommits
if err := json.Unmarshal([]byte(content), &push); err != nil {
@ -223,20 +223,20 @@ func ActionDesc(act Actioner) string {
if push.Len > 3 {
buf.WriteString(fmt.Sprintf(`<div><a href="{{AppRootSubUrl}}/%s/%s/commits/%s" rel="nofollow">%d other commits >></a></div>`, actUserName, repoName, branch, push.Len))
}
return fmt.Sprintf(TPL_COMMIT_REPO, setting.AppRootSubUrl, actUserName, actUserName, repoLink, branch, branch, repoLink, repoLink,
return fmt.Sprintf(TPL_COMMIT_REPO, setting.AppSubUrl, actUserName, actUserName, repoLink, branch, branch, repoLink, repoLink,
buf.String())
case 6: // Create issue.
infos := strings.SplitN(content, "|", 2)
return fmt.Sprintf(TPL_CREATE_ISSUE, setting.AppRootSubUrl, actUserName, actUserName, repoLink, infos[0], repoLink, infos[0],
return fmt.Sprintf(TPL_CREATE_ISSUE, setting.AppSubUrl, actUserName, actUserName, repoLink, infos[0], repoLink, infos[0],
AvatarLink(email), infos[1])
case 8: // Transfer repository.
newRepoLink := content + "/" + repoName
return fmt.Sprintf(TPL_TRANSFER_REPO, setting.AppRootSubUrl, actUserName, actUserName, repoLink, newRepoLink, newRepoLink)
return fmt.Sprintf(TPL_TRANSFER_REPO, setting.AppSubUrl, actUserName, actUserName, repoLink, newRepoLink, newRepoLink)
case 9: // Push tag.
return fmt.Sprintf(TPL_PUSH_TAG, setting.AppRootSubUrl, actUserName, actUserName, repoLink, branch, branch, repoLink, repoLink)
return fmt.Sprintf(TPL_PUSH_TAG, setting.AppSubUrl, actUserName, actUserName, repoLink, branch, branch, repoLink, repoLink)
case 10: // Comment issue.
infos := strings.SplitN(content, "|", 2)
return fmt.Sprintf(TPL_COMMENT_ISSUE, setting.AppRootSubUrl, actUserName, actUserName, repoLink, infos[0], repoLink, infos[0],
return fmt.Sprintf(TPL_COMMENT_ISSUE, setting.AppSubUrl, actUserName, actUserName, repoLink, infos[0], repoLink, infos[0],
AvatarLink(email), infos[1])
default:
return "invalid type"

8
modules/middleware/auth.go

@ -25,13 +25,13 @@ func Toggle(options *ToggleOptions) macaron.Handler {
return func(ctx *Context) {
// Cannot view any page before installation.
if !setting.InstallLock {
ctx.Redirect(setting.AppRootSubUrl + "/install")
ctx.Redirect(setting.AppSubUrl + "/install")
return
}
// Redirect to dashboard if user tries to visit any non-login page.
if options.SignOutRequire && ctx.IsSigned && ctx.Req.RequestURI != "/" {
ctx.Redirect(setting.AppRootSubUrl + "/")
ctx.Redirect(setting.AppSubUrl + "/")
return
}
@ -48,8 +48,8 @@ func Toggle(options *ToggleOptions) macaron.Handler {
if strings.HasSuffix(ctx.Req.RequestURI, "watch") {
return
}
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppRootSubUrl + ctx.Req.RequestURI))
ctx.Redirect(setting.AppRootSubUrl + "/user/login")
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI))
ctx.Redirect(setting.AppSubUrl + "/user/login")
return
} else if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm {
ctx.Data["Title"] = ctx.Tr("auth.active_your_account")

2
modules/middleware/context.go

@ -187,7 +187,7 @@ func Contexter() macaron.Handler {
Session: sess,
}
// Compute current URL for real-time change language.
link := setting.AppRootSubUrl + ctx.Req.RequestURI
link := setting.AppSubUrl + ctx.Req.RequestURI
i := strings.Index(link, "?")
if i > -1 {
link = link[:i]

6
modules/middleware/org.go

@ -38,7 +38,7 @@ func OrgAssignment(redirect bool, args ...bool) macaron.Handler {
ctx.Handle(404, "GetUserByName", err)
} else if redirect {
log.Error(4, "GetUserByName", err)
ctx.Redirect(setting.AppRootSubUrl + "/")
ctx.Redirect(setting.AppSubUrl + "/")
} else {
ctx.Handle(500, "GetUserByName", err)
}
@ -68,7 +68,7 @@ func OrgAssignment(redirect bool, args ...bool) macaron.Handler {
}
ctx.Data["IsOrganizationOwner"] = ctx.Org.IsOwner
ctx.Org.OrgLink = setting.AppRootSubUrl + "/org/" + org.Name
ctx.Org.OrgLink = setting.AppSubUrl + "/org/" + org.Name
ctx.Data["OrgLink"] = ctx.Org.OrgLink
// Team.
@ -80,7 +80,7 @@ func OrgAssignment(redirect bool, args ...bool) macaron.Handler {
ctx.Handle(404, "GetTeam", err)
} else if redirect {
log.Error(4, "GetTeam", err)
ctx.Redirect(setting.AppRootSubUrl + "/")
ctx.Redirect(setting.AppSubUrl + "/")
} else {
ctx.Handle(500, "GetTeam", err)
}

12
modules/middleware/repo.go

@ -60,7 +60,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
ctx.Handle(404, "GetUserByName", err)
} else if redirect {
log.Error(4, "GetUserByName", err)
ctx.Redirect(setting.AppRootSubUrl + "/")
ctx.Redirect(setting.AppSubUrl + "/")
} else {
ctx.Handle(500, "GetUserByName", err)
}
@ -72,7 +72,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
if u == nil {
if redirect {
ctx.Redirect(setting.AppRootSubUrl + "/")
ctx.Redirect(setting.AppSubUrl + "/")
return
}
ctx.Handle(404, "RepoAssignment", errors.New("invliad user account for single repository"))
@ -92,7 +92,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
ctx.Handle(404, "GetRepositoryByName", err)
return
} else if redirect {
ctx.Redirect(setting.AppRootSubUrl + "/")
ctx.Redirect(setting.AppSubUrl + "/")
return
}
ctx.Handle(500, "GetRepositoryByName", err)
@ -160,7 +160,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
return
}
ctx.Repo.GitRepo = gitRepo
ctx.Repo.RepoLink = setting.AppRootSubUrl + "/" + u.Name + "/" + repo.Name
ctx.Repo.RepoLink = setting.AppSubUrl + "/" + u.Name + "/" + repo.Name
ctx.Data["RepoLink"] = ctx.Repo.RepoLink
tags, err := ctx.Repo.GitRepo.GetTags()
@ -298,8 +298,8 @@ func RequireTrueOwner() macaron.Handler {
return func(ctx *Context) {
if !ctx.Repo.IsTrueOwner && !ctx.Repo.IsAdmin {
if !ctx.IsSigned {
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppRootSubUrl + ctx.Req.RequestURI))
ctx.Redirect(setting.AppRootSubUrl + "/user/login")
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI))
ctx.Redirect(setting.AppSubUrl + "/user/login")
return
}
ctx.Handle(404, ctx.Req.RequestURI, nil)

13
modules/setting/setting.go

@ -32,10 +32,10 @@ const (
var (
// App settings.
AppVer string
AppName string
AppUrl string
AppRootSubUrl string
AppVer string
AppName string
AppUrl string
AppSubUrl string
// Server settings.
Protocol Scheme
@ -167,11 +167,12 @@ func NewConfigContext() {
AppUrl += "/"
}
// Check if has app suburl.
url, err := url.Parse(AppUrl)
if err != nil {
log.Fatal(4, "Invalid ROOT_URL %s: %s", AppUrl, err)
log.Fatal(4, "Invalid ROOT_URL(%s): %s", AppUrl, err)
}
AppRootSubUrl = strings.TrimSuffix(url.Path, "/")
AppSubUrl = strings.TrimSuffix(url.Path, "/")
Protocol = HTTP
if Cfg.MustValue("server", "PROTOCOL") == "https" {

2
routers/admin/admin.go

@ -143,7 +143,7 @@ func Dashboard(ctx *middleware.Context) {
} else {
ctx.Flash.Success(success)
}
ctx.Redirect(setting.AppRootSubUrl + "/admin")
ctx.Redirect(setting.AppSubUrl + "/admin")
return
}

8
routers/admin/auths.go

@ -100,7 +100,7 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
}
log.Trace("Authentication created by admin(%s): %s", ctx.User.Name, form.AuthName)
ctx.Redirect(setting.AppRootSubUrl + "/admin/auths")
ctx.Redirect(setting.AppSubUrl + "/admin/auths")
}
func EditAuthSource(ctx *middleware.Context) {
@ -181,7 +181,7 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
log.Trace("Authentication changed by admin(%s): %s", ctx.User.Name, form.AuthName)
ctx.Flash.Success(ctx.Tr("admin.auths.update_success"))
ctx.Redirect(setting.AppRootSubUrl + "/admin/auths/" + ctx.Params(":authid"))
ctx.Redirect(setting.AppSubUrl + "/admin/auths/" + ctx.Params(":authid"))
}
func DeleteAuthSource(ctx *middleware.Context) {
@ -201,12 +201,12 @@ func DeleteAuthSource(ctx *middleware.Context) {
switch err {
case models.ErrAuthenticationUserUsed:
ctx.Flash.Error("form.still_own_user")
ctx.Redirect(setting.AppRootSubUrl + "/admin/auths/" + ctx.Params(":authid"))
ctx.Redirect(setting.AppSubUrl + "/admin/auths/" + ctx.Params(":authid"))
default:
ctx.Handle(500, "DelLoginSource", err)
}
return
}
log.Trace("Authentication deleted by admin(%s): %s", ctx.User.Name, a.Name)
ctx.Redirect(setting.AppRootSubUrl + "/admin/auths")
ctx.Redirect(setting.AppSubUrl + "/admin/auths")
}

8
routers/admin/users.go

@ -121,7 +121,7 @@ func NewUserPost(ctx *middleware.Context, form auth.RegisterForm) {
return
}
log.Trace("Account created by admin(%s): %s", ctx.User.Name, u.Name)
ctx.Redirect(setting.AppRootSubUrl + "/admin/users")
ctx.Redirect(setting.AppSubUrl + "/admin/users")
}
func EditUser(ctx *middleware.Context) {
@ -198,7 +198,7 @@ func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) {
ctx.Data["User"] = u
ctx.Flash.Success(ctx.Tr("admin.users.update_profile_success"))
ctx.Redirect(setting.AppRootSubUrl + "/admin/users/" + ctx.Params(":userid"))
ctx.Redirect(setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid"))
}
func DeleteUser(ctx *middleware.Context) {
@ -218,12 +218,12 @@ func DeleteUser(ctx *middleware.Context) {
switch err {
case models.ErrUserOwnRepos:
ctx.Flash.Error(ctx.Tr("admin.users.still_own_repo"))
ctx.Redirect(setting.AppRootSubUrl + "/admin/users/" + ctx.Params(":userid"))
ctx.Redirect(setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid"))
default:
ctx.Handle(500, "DeleteUser", err)
}
return
}
log.Trace("Account deleted by admin(%s): %s", ctx.User.Name, u.Name)
ctx.Redirect(setting.AppRootSubUrl + "/admin/users")
ctx.Redirect(setting.AppSubUrl + "/admin/users")
}

2
routers/home.go

@ -33,7 +33,7 @@ func Home(ctx *middleware.Context) {
// Check auto-login.
uname := ctx.GetCookie(setting.CookieUserName)
if len(uname) != 0 {
ctx.Redirect(setting.AppRootSubUrl + "/user/login")
ctx.Redirect(setting.AppSubUrl + "/user/login")
return
}

2
routers/install.go

@ -253,5 +253,5 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) {
log.Info("First-time run install finished!")
ctx.Flash.Success(ctx.Tr("install.install_success"))
ctx.Redirect(setting.AppRootSubUrl + "/user/login")
ctx.Redirect(setting.AppSubUrl + "/user/login")
}

2
routers/org/members.go

@ -87,7 +87,7 @@ func MembersAction(ctx *middleware.Context) {
if ctx.Params(":action") != "leave" {
ctx.Redirect(ctx.Org.OrgLink + "/members")
} else {
ctx.Redirect(setting.AppRootSubUrl + "/")
ctx.Redirect(setting.AppSubUrl + "/")
}
}

2
routers/org/org.go

@ -83,5 +83,5 @@ func CreatePost(ctx *middleware.Context, form auth.CreateOrgForm) {
}
log.Trace("Organization created: %s", org.Name)
ctx.Redirect(setting.AppRootSubUrl + "/org/" + form.OrgName + "/dashboard")
ctx.Redirect(setting.AppSubUrl + "/org/" + form.OrgName + "/dashboard")
}

8
routers/org/setting.go

@ -49,7 +49,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateOrgSettingForm) {
} else if err = models.ChangeUserName(org, form.OrgUserName); err != nil {
if err == models.ErrUserNameIllegal {
ctx.Flash.Error(ctx.Tr("form.illegal_username"))
ctx.Redirect(setting.AppRootSubUrl + "/org/" + org.LowerName + "/settings")
ctx.Redirect(setting.AppSubUrl + "/org/" + org.LowerName + "/settings")
return
} else {
ctx.Handle(500, "ChangeUserName", err)
@ -73,7 +73,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateOrgSettingForm) {
}
log.Trace("Organization setting updated: %s", org.Name)
ctx.Flash.Success(ctx.Tr("org.settings.update_setting_success"))
ctx.Redirect(setting.AppRootSubUrl + "/org/" + org.Name + "/settings")
ctx.Redirect(setting.AppSubUrl + "/org/" + org.Name + "/settings")
}
func SettingsDelete(ctx *middleware.Context) {
@ -87,13 +87,13 @@ func SettingsDelete(ctx *middleware.Context) {
switch err {
case models.ErrUserOwnRepos:
ctx.Flash.Error(ctx.Tr("form.org_still_own_repo"))
ctx.Redirect(setting.AppRootSubUrl + "/org/" + org.LowerName + "/settings/delete")
ctx.Redirect(setting.AppSubUrl + "/org/" + org.LowerName + "/settings/delete")
default:
ctx.Handle(500, "DeleteOrganization", err)
}
} else {
log.Trace("Organization deleted: %s", ctx.User.Name)
ctx.Redirect(setting.AppRootSubUrl + "/")
ctx.Redirect(setting.AppSubUrl + "/")
}
return
}

4
routers/repo/commit.go

@ -159,8 +159,8 @@ func Diff(ctx *middleware.Context) {
ctx.Data["Diff"] = diff
ctx.Data["Parents"] = parents
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
ctx.Data["SourcePath"] = setting.AppRootSubUrl + "/" + path.Join(userName, repoName, "src", commitId)
ctx.Data["RawPath"] = setting.AppRootSubUrl + "/" + path.Join(userName, repoName, "raw", commitId)
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", commitId)
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", commitId)
ctx.HTML(200, DIFF)
}

6
routers/repo/issue.go

@ -54,8 +54,8 @@ func Issues(ctx *middleware.Context) {
isShowClosed := ctx.Query("state") == "closed"
if viewType != "all" && !ctx.IsSigned {
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppRootSubUrl + ctx.Req.RequestURI))
ctx.Redirect(setting.AppRootSubUrl + "/user/login")
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI))
ctx.Redirect(setting.AppSubUrl + "/user/login")
return
}
@ -312,7 +312,7 @@ func CreateIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) {
}
log.Trace("%d Issue created: %d", ctx.Repo.Repository.Id, issue.Id)
send(200, fmt.Sprintf("%s/%s/%s/issues/%d", setting.AppRootSubUrl, ctx.Params(":username"), ctx.Params(":reponame"), issue.Index), nil)
send(200, fmt.Sprintf("%s/%s/%s/issues/%d", setting.AppSubUrl, ctx.Params(":username"), ctx.Params(":reponame"), issue.Index), nil)
}
func checkLabels(labels, allLabels []*models.Label) {

4
routers/repo/repo.go

@ -96,7 +96,7 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) {
form.Gitignore, form.License, form.Private, false, form.InitReadme)
if err == nil {
log.Trace("Repository created: %s/%s", ctxUser.Name, form.RepoName)
ctx.Redirect(setting.AppRootSubUrl + "/" + ctxUser.Name + "/" + form.RepoName)
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + form.RepoName)
return
} else if err == models.ErrRepoAlreadyExist {
ctx.Data["Err_RepoName"] = true
@ -180,7 +180,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
form.Mirror, url)
if err == nil {
log.Trace("Repository migrated: %s/%s", ctxUser.Name, form.RepoName)
ctx.Redirect(setting.AppRootSubUrl + "/" + ctxUser.Name + "/" + form.RepoName)
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + form.RepoName)
return
} else if err == models.ErrRepoAlreadyExist {
ctx.Data["Err_RepoName"] = true

16
routers/repo/setting.go

@ -97,7 +97,7 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
}
ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success"))
ctx.Redirect(fmt.Sprintf("%s/%s/%s/settings", setting.AppRootSubUrl, ctx.Repo.Owner.Name, ctx.Repo.Repository.Name))
ctx.Redirect(fmt.Sprintf("%s/%s/%s/settings", setting.AppSubUrl, ctx.Repo.Owner.Name, ctx.Repo.Repository.Name))
case "transfer":
if ctx.Repo.Repository.Name != form.RepoName {
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil)
@ -122,7 +122,7 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
}
log.Trace("Repository transfered: %s/%s -> %s", ctx.Repo.Owner.Name, ctx.Repo.Repository.Name, newOwner)
ctx.Flash.Success(ctx.Tr("repo.settings.transfer_succeed"))
ctx.Redirect(setting.AppRootSubUrl + "/")
ctx.Redirect(setting.AppSubUrl + "/")
case "delete":
if ctx.Repo.Repository.Name != form.RepoName {
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil)
@ -151,9 +151,9 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
}
log.Trace("Repository deleted: %s/%s", ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)
if ctx.Repo.Owner.IsOrganization() {
ctx.Redirect(setting.AppRootSubUrl + "/org/" + ctx.Repo.Owner.Name + "/dashboard")
ctx.Redirect(setting.AppSubUrl + "/org/" + ctx.Repo.Owner.Name + "/dashboard")
} else {
ctx.Redirect(setting.AppRootSubUrl + "/")
ctx.Redirect(setting.AppSubUrl + "/")
}
}
}
@ -167,7 +167,7 @@ func SettingsCollaboration(ctx *middleware.Context) {
if ctx.Req.Method == "POST" {
name := strings.ToLower(ctx.Query("collaborator"))
if len(name) == 0 || ctx.Repo.Owner.LowerName == name {
ctx.Redirect(setting.AppRootSubUrl + ctx.Req.URL.Path)
ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path)
return
}
has, err := models.HasAccess(name, repoLink, models.WRITABLE)
@ -175,7 +175,7 @@ func SettingsCollaboration(ctx *middleware.Context) {
ctx.Handle(500, "HasAccess", err)
return
} else if has {
ctx.Redirect(setting.AppRootSubUrl + ctx.Req.URL.Path)
ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path)
return
}
@ -183,7 +183,7 @@ func SettingsCollaboration(ctx *middleware.Context) {
if err != nil {
if err == models.ErrUserNotExist {
ctx.Flash.Error(ctx.Tr("form.user_not_exist"))
ctx.Redirect(setting.AppRootSubUrl + ctx.Req.URL.Path)
ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path)
} else {
ctx.Handle(500, "GetUserByName", err)
}
@ -204,7 +204,7 @@ func SettingsCollaboration(ctx *middleware.Context) {
}
ctx.Flash.Success(ctx.Tr("repo.settings.add_collaborator_success"))
ctx.Redirect(setting.AppRootSubUrl + ctx.Req.URL.Path)
ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path)
return
}

12
routers/user/auth.go

@ -82,7 +82,7 @@ func SignIn(ctx *middleware.Context) {
return
}
ctx.Redirect(setting.AppRootSubUrl + "/")
ctx.Redirect(setting.AppSubUrl + "/")
}
func SignInPost(ctx *middleware.Context, form auth.SignInForm) {
@ -140,7 +140,7 @@ func SignInPost(ctx *middleware.Context, form auth.SignInForm) {
return
}
ctx.Redirect(setting.AppRootSubUrl + "/")
ctx.Redirect(setting.AppSubUrl + "/")
}
func SignOut(ctx *middleware.Context) {
@ -151,7 +151,7 @@ func SignOut(ctx *middleware.Context) {
ctx.Session.Delete("socialEmail")
ctx.SetCookie(setting.CookieUserName, "", -1)
ctx.SetCookie(setting.CookieRememberName, "", -1)
ctx.Redirect(setting.AppRootSubUrl + "/")
ctx.Redirect(setting.AppSubUrl + "/")
}
func oauthSignUp(ctx *middleware.Context, sid int64) {
@ -288,7 +288,7 @@ func SignUpPost(ctx *middleware.Context, cpt *captcha.Captcha, form auth.Registe
return
}
ctx.Redirect(setting.AppRootSubUrl + "/user/login")
ctx.Redirect(setting.AppSubUrl + "/user/login")
}
func Activate(ctx *middleware.Context) {
@ -335,7 +335,7 @@ func Activate(ctx *middleware.Context) {
ctx.Session.Set("uid", user.Id)
ctx.Session.Set("uname", user.Name)
ctx.Redirect(setting.AppRootSubUrl + "/")
ctx.Redirect(setting.AppSubUrl + "/")
return
}
@ -437,7 +437,7 @@ func ResetPasswdPost(ctx *middleware.Context) {
}
log.Trace("User password reset: %s", u.Name)
ctx.Redirect(setting.AppRootSubUrl + "/user/login")
ctx.Redirect(setting.AppSubUrl + "/user/login")
return
}

6
routers/user/home.go

@ -127,7 +127,7 @@ func Profile(ctx *middleware.Context) {
uname := ctx.Params(":username")
// Special handle for FireFox requests favicon.ico.
if uname == "favicon.ico" {
ctx.Redirect(setting.AppRootSubUrl + "/img/favicon.png")
ctx.Redirect(setting.AppSubUrl + "/img/favicon.png")
return
}
@ -142,7 +142,7 @@ func Profile(ctx *middleware.Context) {
}
if u.IsOrganization() {
ctx.Redirect(setting.AppRootSubUrl + "/org/" + u.Name)
ctx.Redirect(setting.AppSubUrl + "/org/" + u.Name)
return
}
@ -182,7 +182,7 @@ func Email2User(ctx *middleware.Context) {
}
return
}
ctx.Redirect(setting.AppRootSubUrl + "/user/" + u.Name)
ctx.Redirect(setting.AppSubUrl + "/user/" + u.Name)
}
const (

18
routers/user/setting.go

@ -56,7 +56,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateProfileForm) {
} else if err = models.ChangeUserName(ctx.User, form.UserName); err != nil {
if err == models.ErrUserNameIllegal {
ctx.Flash.Error(ctx.Tr("form.illegal_username"))
ctx.Redirect(setting.AppRootSubUrl + "/user/settings")
ctx.Redirect(setting.AppSubUrl + "/user/settings")
return
} else {
ctx.Handle(500, "ChangeUserName", err)
@ -79,7 +79,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateProfileForm) {
}
log.Trace("User setting updated: %s", ctx.User.Name)
ctx.Flash.Success(ctx.Tr("settings.update_profile_success"))
ctx.Redirect(setting.AppRootSubUrl + "/user/settings")
ctx.Redirect(setting.AppSubUrl + "/user/settings")
}
func SettingsPassword(ctx *middleware.Context) {
@ -120,7 +120,7 @@ func SettingsPasswordPost(ctx *middleware.Context, form auth.ChangePasswordForm)
ctx.Flash.Success(ctx.Tr("settings.change_password_success"))
}
ctx.Redirect(setting.AppRootSubUrl + "/user/settings/password")
ctx.Redirect(setting.AppSubUrl + "/user/settings/password")
}
func SettingsSSHKeys(ctx *middleware.Context) {
@ -161,7 +161,7 @@ func SettingsSSHKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
ctx.Handle(500, "DeletePublicKey", err)
} else {
log.Trace("SSH key deleted: %s", ctx.User.Name)
ctx.Redirect(setting.AppRootSubUrl + "/user/settings/ssh")
ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh")
}
return
}
@ -178,7 +178,7 @@ func SettingsSSHKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
if ok, err := models.CheckPublicKeyString(cleanContent); !ok {
ctx.Flash.Error(ctx.Tr("form.invalid_ssh_key", err.Error()))
ctx.Redirect(setting.AppRootSubUrl + "/user/settings/ssh")
ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh")
return
}
@ -197,7 +197,7 @@ func SettingsSSHKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
} else {
log.Trace("SSH key added: %s", ctx.User.Name)
ctx.Flash.Success(ctx.Tr("settings.add_key_success"))
ctx.Redirect(setting.AppRootSubUrl + "/user/settings/ssh")
ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh")
return
}
}
@ -218,7 +218,7 @@ func SettingsSocial(ctx *middleware.Context) {
return
}
ctx.Flash.Success(ctx.Tr("settings.unbind_success"))
ctx.Redirect(setting.AppRootSubUrl + "/user/settings/social")
ctx.Redirect(setting.AppSubUrl + "/user/settings/social")
return
}
@ -249,13 +249,13 @@ func SettingsDelete(ctx *middleware.Context) {
switch err {
case models.ErrUserOwnRepos:
ctx.Flash.Error(ctx.Tr("form.still_own_repo"))
ctx.Redirect(setting.AppRootSubUrl + "/user/settings/delete")
ctx.Redirect(setting.AppSubUrl + "/user/settings/delete")
default:
ctx.Handle(500, "DeleteUser", err)
}
} else {
log.Trace("Account deleted: %s", ctx.User.Name)
ctx.Redirect(setting.AppRootSubUrl + "/")
ctx.Redirect(setting.AppSubUrl + "/")
}
return
}

4
routers/user/social.go

@ -22,7 +22,7 @@ import (
func extractPath(next string) string {
n, err := url.Parse(next)
if err != nil {
return setting.AppRootSubUrl + "/"
return setting.AppSubUrl + "/"
}
return n.Path
}
@ -88,7 +88,7 @@ func SocialSignIn(ctx *middleware.Context) {
return
}
case models.ErrOauth2NotAssociated:
next = setting.AppRootSubUrl + "/user/sign_up"
next = setting.AppSubUrl + "/user/sign_up"
default:
ctx.Handle(500, "social.SocialSignIn(GetOauth2)", err)
return

2
templates/.VERSION

@ -1 +1 @@
0.5.2.0917 Beta
0.5.3.0919 Beta

2
templates/admin/auth/edit.tmpl

@ -12,7 +12,7 @@
<div class="panel-header">
<strong>{{.i18n.Tr "admin.auths.edit"}}</strong>
</div>
<form class="form form-align panel-body" id="auth-setting-form" action="{{AppRootSubUrl}}/admin/auths/{{.Source.Id}}" data-delete-url="/admin/auths/{{.Source.Id}}/delete" method="post">
<form class="form form-align panel-body" id="auth-setting-form" action="{{AppSubUrl}}/admin/auths/{{.Source.Id}}" data-delete-url="/admin/auths/{{.Source.Id}}/delete" method="post">
{{.CsrfTokenHtml}}
<input type="hidden" value="{{.Source.Id}}" name="id"/>
{{$type := .Source.Type}}

10
templates/admin/auth/list.tmpl

@ -13,7 +13,7 @@
<strong>{{.i18n.Tr "admin.auths.auth_manage_panel"}}</strong>
</div>
<div class="panel-body admin-panel">
<a class="btn-blue btn-medium btn-link btn-radius" href="{{AppRootSubUrl}}/admin/auths/new">{{.i18n.Tr "admin.auths.new"}}</a>
<a class="btn-blue btn-medium btn-link btn-radius" href="{{AppSubUrl}}/admin/auths/new">{{.i18n.Tr "admin.auths.new"}}</a>
<div class="admin-table">
<table class="table table-striped">
<thead>
@ -31,20 +31,20 @@
{{range .Sources}}
<tr>
<td>{{.Id}}</td>
<td><a href="{{AppRootSubUrl}}/admin/auths/{{.Id}}">{{.Name}}</a></td>
<td><a href="{{AppSubUrl}}/admin/auths/{{.Id}}">{{.Name}}</a></td>
<td>{{.TypeString}}</td>
<td><i class="fa fa{{if .IsActived}}-check{{end}}-square-o"></i></td>
<td>{{DateFormat .Updated "M d, Y"}}</td>
<td>{{DateFormat .Created "M d, Y"}}</td>
<td><a href="{{AppRootSubUrl}}/admin/auths/{{.Id}}"><i class="fa fa-pencil-square-o"></i></a></td>
<td><a href="{{AppSubUrl}}/admin/auths/{{.Id}}"><i class="fa fa-pencil-square-o"></i></a></td>
</tr>
{{end}}
</tbody>
</table>
{{if or .LastPageNum .NextPageNum}}
<ul class="pagination">
{{if .LastPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppRootSubUrl}}/admin/auths?p={{.LastPageNum}}">&laquo; Prev.</a></li>{{end}}
{{if .NextPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppRootSubUrl}}/admin/auths?p={{.NextPageNum}}">&raquo; Next</a></li>{{end}}
{{if .LastPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppSubUrl}}/admin/auths?p={{.LastPageNum}}">&laquo; Prev.</a></li>{{end}}
{{if .NextPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppSubUrl}}/admin/auths?p={{.NextPageNum}}">&raquo; Next</a></li>{{end}}
</ul>
{{end}}
</div>

2
templates/admin/auth/new.tmpl

@ -12,7 +12,7 @@
<div class="panel-header">
<strong>{{.i18n.Tr "admin.auths.new"}}</strong>
</div>
<form class="form form-align panel-body" id="repo-setting-form" action="{{AppRootSubUrl}}/admin/auths/new" method="post">
<form class="form form-align panel-body" id="repo-setting-form" action="{{AppSubUrl}}/admin/auths/new" method="post">
{{.CsrfTokenHtml}}
<div class="field">
<label class="req">{{.i18n.Tr "admin.auths.auth_type"}}</label>

4
templates/admin/dashboard.tmpl

@ -34,11 +34,11 @@
<tbody>
<tr>
<td>{{.i18n.Tr "admin.dashboard.clean_unbind_oauth"}}</td>
<td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppRootSubUrl}}/admin?op=1">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td>
<td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=1">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td>
</tr>
<tr>
<td>{{.i18n.Tr "admin.dashboard.delete_inactivate_accounts"}}</td>
<td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppRootSubUrl}}/admin?op=2">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td>
<td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=2">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td>
</tr>
</tbody>
</table>

14
templates/admin/nav.tmpl

@ -2,13 +2,13 @@
<p class="panel-header"><strong>{{.i18n.Tr "admin_panel"}}</strong></p>
<div class="panel-body">
<ul class="menu menu-vertical switching-list grid-1-5 left">
<li {{if .PageIsAdminDashboard}}class="current"{{end}}><a href="{{AppRootSubUrl}}/admin">{{.i18n.Tr "admin.dashboard"}}</a></li>
<li {{if .PageIsAdminUsers}}class="current"{{end}}><a href="{{AppRootSubUrl}}/admin/users">{{.i18n.Tr "admin.users"}}</a></li>
<li {{if .PageIsAdminOrganizations}}class="current"{{end}}><a href="{{AppRootSubUrl}}/admin/orgs">{{.i18n.Tr "admin.organizations"}}</a></li>
<li {{if .PageIsAdminRepositories}}class="current"{{end}}><a href="{{AppRootSubUrl}}/admin/repos">{{.i18n.Tr "admin.repositories"}}</a></li>
<li {{if .PageIsAdminAuthentications}}class="current"{{end}}><a href="{{AppRootSubUrl}}/admin/auths">{{.i18n.Tr "admin.authentication"}}</a></li>
<li {{if .PageIsAdminConfig}}class="current"{{end}}><a href="{{AppRootSubUrl}}/admin/config">{{.i18n.Tr "admin.config"}}</a></li>
<li {{if .PageIsAdminMonitor}}class="current"{{end}}><a href="{{AppRootSubUrl}}/admin/monitor">{{.i18n.Tr "admin.monitor"}}</a></li>
<li {{if .PageIsAdminDashboard}}class="current"{{end}}><a href="{{AppSubUrl}}/admin">{{.i18n.Tr "admin.dashboard"}}</a></li>
<li {{if .PageIsAdminUsers}}class="current"{{end}}><a href="{{AppSubUrl}}/admin/users">{{.i18n.Tr "admin.users"}}</a></li>
<li {{if .PageIsAdminOrganizations}}class="current"{{end}}><a href="{{AppSubUrl}}/admin/orgs">{{.i18n.Tr "admin.organizations"}}</a></li>
<li {{if .PageIsAdminRepositories}}class="current"{{end}}><a href="{{AppSubUrl}}/admin/repos">{{.i18n.Tr "admin.repositories"}}</a></li>
<li {{if .PageIsAdminAuthentications}}class="current"{{end}}><a href="{{AppSubUrl}}/admin/auths">{{.i18n.Tr "admin.authentication"}}</a></li>
<li {{if .PageIsAdminConfig}}class="current"{{end}}><a href="{{AppSubUrl}}/admin/config">{{.i18n.Tr "admin.config"}}</a></li>
<li {{if .PageIsAdminMonitor}}class="current"{{end}}><a href="{{AppSubUrl}}/admin/monitor">{{.i18n.Tr "admin.monitor"}}</a></li>
</ul>
</div>
</div>

6
templates/admin/org/list.tmpl

@ -30,7 +30,7 @@
{{range .Orgs}}
<tr>
<td>{{.Id}}</td>
<td><a href="{{AppRootSubUrl}}/org/{{.Name}}">{{.Name}}</a></td>
<td><a href="{{AppSubUrl}}/org/{{.Name}}">{{.Name}}</a></td>
<td>{{.Email}}</td>
<td>{{.NumTeams}}</td>
<td>{{.NumMembers}}</td>
@ -42,8 +42,8 @@
</table>
{{if or .LastPageNum .NextPageNum}}
<ul class="pagination">
{{if .LastPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppRootSubUrl}}/admin/orgs?p={{.LastPageNum}}">&laquo; {{.i18n.Tr "admin.prev"}}</a></li>{{end}}
{{if .NextPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppRootSubUrl}}/admin/orgs?p={{.NextPageNum}}">&raquo; {{.i18n.Tr "admin.next"}}</a></li>{{end}}
{{if .LastPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppSubUrl}}/admin/orgs?p={{.LastPageNum}}">&laquo; {{.i18n.Tr "admin.prev"}}</a></li>{{end}}
{{if .NextPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppSubUrl}}/admin/orgs?p={{.NextPageNum}}">&raquo; {{.i18n.Tr "admin.next"}}</a></li>{{end}}
</ul>
{{end}}
</div>

8
templates/admin/repo/list.tmpl

@ -31,8 +31,8 @@
{{range .Repos}}
<tr>
<td>{{.Id}}</td>
<td><a href="{{AppRootSubUrl}}/user/{{.Owner.Name}}">{{.Owner.Name}}</a></td>
<td><a href="{{AppRootSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Name}}</a></td>
<td><a href="{{AppSubUrl}}/user/{{.Owner.Name}}">{{.Owner.Name}}</a></td>
<td><a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Name}}</a></td>
<td><i class="fa fa{{if .IsPrivate}}-check{{end}}-square-o"></i></td>
<td>{{.NumWatches}}</td>
<td>{{.NumIssues}}</td>
@ -44,8 +44,8 @@
</table>
{{if or .LastPageNum .NextPageNum}}
<ul class="pagination">
{{if .LastPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppRootSubUrl}}/admin/repos?p={{.LastPageNum}}">&laquo; Prev.</a></li>{{end}}
{{if .NextPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppRootSubUrl}}/admin/repos?p={{.NextPageNum}}">&raquo; Next</a></li>{{end}}
{{if .LastPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppSubUrl}}/admin/repos?p={{.LastPageNum}}">&laquo; Prev.</a></li>{{end}}
{{if .NextPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppSubUrl}}/admin/repos?p={{.NextPageNum}}">&raquo; Next</a></li>{{end}}
</ul>
{{end}}
</div>

2
templates/admin/user/edit.tmpl

@ -12,7 +12,7 @@
<div class="panel-header">
<strong>{{.i18n.Tr "admin.users.edit_account"}}</strong>
</div>
<form class="form form-align panel-body" id="user-profile-form" action="{{AppRootSubUrl}}/admin/users/{{.User.Id}}" method="post" data-delete-url="/admin/users/{{.User.Id}}/delete">
<form class="form form-align panel-body" id="user-profile-form" action="{{AppSubUrl}}/admin/users/{{.User.Id}}" method="post" data-delete-url="/admin/users/{{.User.Id}}/delete">
{{.CsrfTokenHtml}}
<div class="field">
<label class="req">{{.i18n.Tr "admin.users.auth_source"}}</label>

10
templates/admin/user/list.tmpl

@ -13,7 +13,7 @@
<strong>{{.i18n.Tr "admin.users.user_manage_panel"}}</strong>
</div>
<div class="panel-body admin-panel">
<a class="btn-blue btn-medium btn-link btn-radius" href="{{AppRootSubUrl}}/admin/users/new">{{.i18n.Tr "admin.users.new_account"}}</a>
<a class="btn-blue btn-medium btn-link btn-radius" href="{{AppSubUrl}}/admin/users/new">{{.i18n.Tr "admin.users.new_account"}}</a>
<div class="admin-table">
<table class="table table-striped">
<thead>
@ -32,21 +32,21 @@
{{range .Users}}
<tr>
<td>{{.Id}}</td>
<td><a href="{{AppRootSubUrl}}/user/{{.Name}}">{{.Name}}</a></td>
<td><a href="{{AppSubUrl}}/user/{{.Name}}">{{.Name}}</a></td>
<td>{{.Email}}</td>
<td><i class="fa fa{{if .IsActive}}-check{{end}}-square-o"></i></td>
<td><i class="fa fa{{if .IsAdmin}}-check{{end}}-square-o"></i></td>
<td>{{.NumRepos}}</td>
<td>{{DateFormat .Created "M d, Y"}}</td>
<td><a href="{{AppRootSubUrl}}/admin/users/{{.Id}}"><i class="fa fa-pencil-square-o"></i></a></td>
<td><a href="{{AppSubUrl}}/admin/users/{{.Id}}"><i class="fa fa-pencil-square-o"></i></a></td>
</tr>
{{end}}
</tbody>
</table>
{{if or .LastPageNum .NextPageNum}}
<ul class="pagination">
{{if .LastPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppRootSubUrl}}/admin/users?p={{.LastPageNum}}">&laquo; Prev.</a></li>{{end}}
{{if .NextPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppRootSubUrl}}/admin/users?p={{.NextPageNum}}">&raquo; Next</a></li>{{end}}
{{if .LastPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppSubUrl}}/admin/users?p={{.LastPageNum}}">&laquo; Prev.</a></li>{{end}}
{{if .NextPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppSubUrl}}/admin/users?p={{.NextPageNum}}">&raquo; Next</a></li>{{end}}
</ul>
{{end}}
</div>

2
templates/admin/user/new.tmpl

@ -12,7 +12,7 @@
<div class="panel-header">
<strong>{{.i18n.Tr "admin.users.new_account"}}</strong>
</div>
<form class="form form-align panel-body" id="repo-setting-form" action="{{AppRootSubUrl}}/admin/users/new" method="post">
<form class="form form-align panel-body" id="repo-setting-form" action="{{AppSubUrl}}/admin/users/new" method="post">
{{.CsrfTokenHtml}}
<div class="field">
<label class="req">{{.i18n.Tr "admin.users.auth_source"}}</label>

26
templates/base/head.tmpl

@ -1,8 +1,8 @@
<!DOCTYPE html>
<html>
<head{{if AppRootSubUrl}} data-suburl="{{AppRootSubUrl}}"{{end}}>
<head{{if AppSubUrl}} data-suburl="{{AppSubUrl}}"{{end}}>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="shortcut icon" href="{{AppRootSubUrl}}/img/favicon.png" />
<link rel="shortcut icon" href="{{AppSubUrl}}/img/favicon.png" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="author" content="Gogs - Go Git Service" />
@ -19,21 +19,21 @@
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
{{else}}
<link href="{{AppRootSubUrl}}/css/bootstrap.min.css" rel="stylesheet" />
<link href="{{AppRootSubUrl}}/css/font-awesome.min.css" rel="stylesheet" />
<link href="{{AppSubUrl}}/css/bootstrap.min.css" rel="stylesheet" />
<link href="{{AppSubUrl}}/css/font-awesome.min.css" rel="stylesheet" />
<script src="{{AppRootSubUrl}}/js/jquery-1.10.1.min.js"></script>
<script src="{{AppRootSubUrl}}/js/bootstrap.min.js"></script>
<script src="{{AppSubUrl}}/js/jquery-1.10.1.min.js"></script>
<script src="{{AppSubUrl}}/js/bootstrap.min.js"></script>
{{end}}
<link href="{{AppRootSubUrl}}/css/todc-bootstrap.min.css" rel="stylesheet" />
<link href="{{AppRootSubUrl}}/css/datepicker3.css" rel="stylesheet" />
<link href="{{AppRootSubUrl}}/css/bootstrap-colorpicker.min.css" rel="stylesheet" />
<link href="{{AppRootSubUrl}}/css/markdown.css" rel="stylesheet" />
<link href="{{AppRootSubUrl}}/css/gogs.css" rel="stylesheet" />
<link href="{{AppSubUrl}}/css/todc-bootstrap.min.css" rel="stylesheet" />
<link href="{{AppSubUrl}}/css/datepicker3.css" rel="stylesheet" />
<link href="{{AppSubUrl}}/css/bootstrap-colorpicker.min.css" rel="stylesheet" />
<link href="{{AppSubUrl}}/css/markdown.css" rel="stylesheet" />
<link href="{{AppSubUrl}}/css/gogs.css" rel="stylesheet" />
<script src="{{AppRootSubUrl}}/js/lib.js"></script>
<script src="{{AppRootSubUrl}}/js/app.js"></script>
<script src="{{AppSubUrl}}/js/lib.js"></script>
<script src="{{AppSubUrl}}/js/app.js"></script>
<title>{{if .Title}}{{.Title}} - {{end}}{{AppName}}</title>
</head>
<body>

18
templates/base/navbar.tmpl

@ -1,8 +1,8 @@
<div class="masthead navbar" id="masthead">
<div class="container">
<nav class="nav">
<a id="nav-logo" class="nav-item pull-left{{if .PageIsHome}} active{{end}}" href="{{AppRootSubUrl}}/"><img src="{{AppRootSubUrl}}/img/favicon.png" alt="Gogs Logo" id="logo"></a>
<a class="nav-item pull-left{{if .PageIsUserDashboard}} active{{end}}" href="{{AppRootSubUrl}}/">Dashboard</a>
<a id="nav-logo" class="nav-item pull-left{{if .PageIsHome}} active{{end}}" href="{{AppSubUrl}}/"><img src="{{AppSubUrl}}/img/favicon.png" alt="Gogs Logo" id="logo"></a>
<a class="nav-item pull-left{{if .PageIsUserDashboard}} active{{end}}" href="{{AppSubUrl}}/">Dashboard</a>
<a class="nav-item pull-left{{if .PageIsHelp}} active{{end}}" target="_blank" href="http://gogs.io/docs">Help</a>
{{if .IsSigned}}
{{if .HasAccess}}
@ -22,27 +22,27 @@
</div>
</form> -->
{{end}}
<a id="nav-out" class="nav-item navbar-right navbar-btn btn btn-danger" href="{{AppRootSubUrl}}/user/logout/"><i class="fa fa-power-off fa-lg"></i></a>
<a id="nav-out" class="nav-item navbar-right navbar-btn btn btn-danger" href="{{AppSubUrl}}/user/logout/"><i class="fa fa-power-off fa-lg"></i></a>
<a id="nav-avatar" class="nav-item navbar-right{{if .PageIsUserProfile}} active{{end}}" href="{{.SignedUser.HomeLink}}" data-toggle="tooltip" data-placement="bottom" title="{{.SignedUserName}}">
<img src="{{.SignedUser.AvatarLink}}?s=28" alt="user-avatar" title="username"/>
</a>
<a class="navbar-right nav-item{{if .PageIsUserSetting}} active{{end}}" href="{{AppRootSubUrl}}/user/settings" data-toggle="tooltip" data-placement="bottom" title="Settings"><i class="fa fa-cogs fa-lg"></i></a>
<a class="navbar-right nav-item{{if .PageIsUserSetting}} active{{end}}" href="{{AppSubUrl}}/user/settings" data-toggle="tooltip" data-placement="bottom" title="Settings"><i class="fa fa-cogs fa-lg"></i></a>
{{if .IsAdmin}}
<a class="navbar-right nav-item{{if .PageIsAdmin}} active{{end}}" href="{{AppRootSubUrl}}/admin" data-toggle="tooltip" data-placement="bottom" title="Admin"><i class="fa fa-gear fa-lg"></i></a>
<a class="navbar-right nav-item{{if .PageIsAdmin}} active{{end}}" href="{{AppSubUrl}}/admin" data-toggle="tooltip" data-placement="bottom" title="Admin"><i class="fa fa-gear fa-lg"></i></a>
{{end}}
<div class="navbar-right nav-item pull-right{{if .PageIsNewRepo}} active{{end}}" id="nav-repo-new" data-toggle="tooltip" data-placement="bottom" title="New Repo">
<button type="button" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus-square fa-lg"></i></button>
<div class="dropdown-menu">
<ul class="list-unstyled">
<li><a href="{{AppRootSubUrl}}/repo/create"><i class="fa fa-book"></i>Repository</a></li>
<li><a href="{{AppRootSubUrl}}/repo/migrate"><i class="fa fa-clipboard"></i>Migration</a></li>
<li><a href="{{AppSubUrl}}/repo/create"><i class="fa fa-book"></i>Repository</a></li>
<li><a href="{{AppSubUrl}}/repo/migrate"><i class="fa fa-clipboard"></i>Migration</a></li>
<!-- <li><a href="#"><i class="fa fa-users"></i>Organization</a></li> -->
</ul>
</div>
</div>
{{else}}
<a id="nav-signin" class="nav-item navbar-right navbar-btn btn btn-danger" href="{{AppRootSubUrl}}/user/login/" rel="nofollow">Sign In</a>
<a id="nav-signup" class="nav-item navbar-right" href="{{AppRootSubUrl}}/user/sign_up/" rel="nofollow">Sign Up</a>
<a id="nav-signin" class="nav-item navbar-right navbar-btn btn btn-danger" href="{{AppSubUrl}}/user/login/" rel="nofollow">Sign In</a>
<a id="nav-signup" class="nav-item navbar-right" href="{{AppSubUrl}}/user/sign_up/" rel="nofollow">Sign Up</a>
{{end}}
</nav>
</div>

2
templates/explore/nav.tmpl

@ -2,7 +2,7 @@
<p class="panel-header"><strong>{{.i18n.Tr "explore"}}</strong></p>
<div class="panel-body">
<ul class="menu menu-vertical switching-list grid-1-5 left">
<li {{if .PageIsExploreRepositories}}class="current"{{end}}><a href="{{AppRootSubUrl}}/explore">{{.i18n.Tr "explore.repos"}}</a></li>
<li {{if .PageIsExploreRepositories}}class="current"{{end}}><a href="{{AppSubUrl}}/explore">{{.i18n.Tr "explore.repos"}}</a></li>
</ul>
</div>
</div>

2
templates/explore/repos.tmpl

@ -12,7 +12,7 @@
<li><i class="octicon octicon-star"></i> {{.NumStars}}</li>
<li><i class="octicon octicon-git-branch"></i> {{.NumForks}}</li>
</ul>
<h2><a href="{{AppRootSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Name}}</a></h2>
<h2><a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Name}}</a></h2>
<p class="org-repo-description">{{.Description}}</p>
<p class="org-repo-updated">{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Updated $.i18n.Lang}}</p>
</div>

4
templates/home.tmpl

@ -3,12 +3,12 @@
<div id="promo-wrapper">
<div class="container clear">
<div id="promo-logo" class="left">
<img src="{{AppRootSubUrl}}/img/gogs-lg.png" alt="logo" />
<img src="{{AppSubUrl}}/img/gogs-lg.png" alt="logo" />
</div>
<div id="promo-content">
<h1>Gogs</h1>
<h2>{{.i18n.Tr "app_desc"}}</h2>
<form id="promo-form" action="{{AppRootSubUrl}}/user/login" method="post">
<form id="promo-form" action="{{AppSubUrl}}/user/login" method="post">
{{.CsrfTokenHtml}}
<input class="ipt ipt-large" id="username" name="uname" type="text" placeholder="{{.i18n.Tr "home.uname_holder"}}"/>
<input class="ipt ipt-large" name="password" type="password" placeholder="{{.i18n.Tr "home.password_holder"}}"/>

2
templates/install.tmpl

@ -8,7 +8,7 @@
<div class="panel-header">
<strong>{{.i18n.Tr "install.title"}}</strong>
</div>
<form class="form form-align panel-body" id="install-form" action="{{AppRootSubUrl}}/install" method="post">
<form class="form form-align panel-body" id="install-form" action="{{AppSubUrl}}/install" method="post">
{{.CsrfTokenHtml}}
<div class="text-center panel-desc">{{.i18n.Tr "install.requite_db_desc"}}</div>
<div class="field">

22
templates/ng/base/head.tmpl

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html>
<head{{if AppRootSubUrl}} data-suburl="{{AppRootSubUrl}}"{{end}}>
<head{{if AppSubUrl}} data-suburl="{{AppSubUrl}}"{{end}}>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="author" content="Gogs - Go Git Service" />
@ -9,27 +9,27 @@
<meta name="_csrf" content="{{.CsrfToken}}" />
{{if .Repository.IsGoget}}<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">{{end}}
<link rel="shortcut icon" href="{{AppRootSubUrl}}/img/favicon.png" />
<link rel="shortcut icon" href="{{AppSubUrl}}/img/favicon.png" />
{{if CdnMode}}
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
{{else}}
<link rel="stylesheet" href="{{AppRootSubUrl}}/css/font-awesome.min.css">
<link rel="stylesheet" href="{{AppSubUrl}}/css/font-awesome.min.css">
<script src="{{AppRootSubUrl}}/ng/js/lib/jquery-1.11.1.min.js"></script>
<script src="{{AppSubUrl}}/ng/js/lib/jquery-1.11.1.min.js"></script>
{{end}}
<!-- Stylesheet -->
<link rel="stylesheet" href="{{AppRootSubUrl}}/ng/css/ui.css">
<link rel="stylesheet" href="{{AppRootSubUrl}}/ng/css/gogs.css">
<link rel="stylesheet" href="{{AppRootSubUrl}}/ng/fonts/octicons.css">
<link rel="stylesheet" href="{{AppRootSubUrl}}/css/github.min.css">
<link rel="stylesheet" href="{{AppSubUrl}}/ng/css/ui.css">
<link rel="stylesheet" href="{{AppSubUrl}}/ng/css/gogs.css">
<link rel="stylesheet" href="{{AppSubUrl}}/ng/fonts/octicons.css">
<link rel="stylesheet" href="{{AppSubUrl}}/css/github.min.css">
<!-- JavaScript -->
<script src="{{AppRootSubUrl}}/ng/js/lib/tabs.js"></script>
<script src="{{AppRootSubUrl}}/ng/js/lib/lib.js"></script>
<script src="{{AppRootSubUrl}}/ng/js/gogs.js"></script>
<script src="{{AppSubUrl}}/ng/js/lib/tabs.js"></script>
<script src="{{AppSubUrl}}/ng/js/lib/lib.js"></script>
<script src="{{AppSubUrl}}/ng/js/gogs.js"></script>
<title>{{if .Title}}{{.Title}} - {{end}}{{AppName}}</title>
</head>

26
templates/ng/base/header.tmpl

@ -2,37 +2,37 @@
<ul class="menu menu-line container" id="header-nav">
{{if not .PageIsHome}}
<li class="head" id="header-nav-logo">
<img src="{{AppRootSubUrl}}/img/favicon.png" alt="avatar" class="avatar-30"/>
<img src="{{AppSubUrl}}/img/favicon.png" alt="avatar" class="avatar-30"/>
</li>
<li {{if .PageIsDashboard}}class="current"{{end}}>
<a href="{{AppRootSubUrl}}/">{{if .IsSigned}}{{.i18n.Tr "dashboard"}}{{else}}{{.i18n.Tr "home"}}{{end}}</a>
<a href="{{AppSubUrl}}/">{{if .IsSigned}}{{.i18n.Tr "dashboard"}}{{else}}{{.i18n.Tr "home"}}{{end}}</a>
</li>
<li><a href="{{AppRootSubUrl}}/explore">{{.i18n.Tr "explore"}}</a></li>
<li><a href="{{AppSubUrl}}/explore">{{.i18n.Tr "explore"}}</a></li>
<li><a target="_blank" href="http://gogs.io/docs">{{.i18n.Tr "help"}}</a></li>
{{end}}
{{if .IsSigned}}
<li class="right" id="header-nav-sign-out">
<a href="{{AppRootSubUrl}}/user/logout" title="{{.i18n.Tr "sign_out"}}"><i class="octicon octicon-sign-out"></i></a>
<a href="{{AppSubUrl}}/user/logout" title="{{.i18n.Tr "sign_out"}}"><i class="octicon octicon-sign-out"></i></a>
</li>
<li class="right {{if .PageIsUserSettings}}current{{end}}">
<a href="{{AppRootSubUrl}}/user/settings" title="{{.i18n.Tr "account_settings"}}"><i class="octicon octicon-settings"></i></a>
<a href="{{AppSubUrl}}/user/settings" title="{{.i18n.Tr "account_settings"}}"><i class="octicon octicon-settings"></i></a>
</li>
{{if .IsAdmin}}
<li class="right {{if .PageIsAdmin}}current{{end}}">
<a href="{{AppRootSubUrl}}/admin" title="{{.i18n.Tr "admin_panel"}}"><i class="octicon octicon-circuit-board"></i></a>
<a href="{{AppSubUrl}}/admin" title="{{.i18n.Tr "admin_panel"}}"><i class="octicon octicon-circuit-board"></i></a>
</li>
{{end}}
<li class="right down">
<a href="#"><i class="octicon octicon-plus"></i></a>
<ul class="menu menu-down" id="header-new-repo-menu">
<li><a href="{{AppRootSubUrl}}/repo/create"><i class="octicon octicon-repo-create"></i>{{.i18n.Tr "new_repo"}}</a></li>
<li><a href="{{AppRootSubUrl}}/repo/migrate"><i class="octicon octicon-repo-clone"></i>{{.i18n.Tr "new_migrate"}}</a></li>
<li><a href="{{AppRootSubUrl}}/org/create"><i class="octicon octicon-organization"></i>{{.i18n.Tr "new_org"}}</a></li>
<li><a href="{{AppSubUrl}}/repo/create"><i class="octicon octicon-repo-create"></i>{{.i18n.Tr "new_repo"}}</a></li>
<li><a href="{{AppSubUrl}}/repo/migrate"><i class="octicon octicon-repo-clone"></i>{{.i18n.Tr "new_migrate"}}</a></li>
<li><a href="{{AppSubUrl}}/org/create"><i class="octicon octicon-organization"></i>{{.i18n.Tr "new_org"}}</a></li>
</ul>
</li>
<li class="right" id="header-nav-user">
<a href="{{AppRootSubUrl}}/{{.SignedUser.Name}}" class="text-bold">
<a href="{{AppSubUrl}}/{{.SignedUser.Name}}" class="text-bold">
<img src="{{.SignedUser.AvatarLink}}" alt="user-avatar" class="avatar-30"/>
{{.SignedUser.Name}}
</a>
@ -43,14 +43,14 @@
<a target="_blank" href="http://gogs.io/docs"><i class="octicon octicon-info"></i>&nbsp;&nbsp;{{.i18n.Tr "help"}}</a>
</li>
<li class="right" id="header-nav-explore">
<a href="{{AppRootSubUrl}}/explore"><i class="octicon octicon-globe"></i>&nbsp;&nbsp;{{.i18n.Tr "explore"}}</a>
<a href="{{AppSubUrl}}/explore"><i class="octicon octicon-globe"></i>&nbsp;&nbsp;{{.i18n.Tr "explore"}}</a>
</li>
{{else}}
<li class="right" id="header-nav-sign-in">
<a href="{{AppRootSubUrl}}/user/login" title="Sign In"><i class="octicon octicon-sign-in"></i> {{.i18n.Tr "sign_in"}}</a>
<a href="{{AppSubUrl}}/user/login" title="Sign In"><i class="octicon octicon-sign-in"></i> {{.i18n.Tr "sign_in"}}</a>
</li>
<li class="right">
<a href="{{AppRootSubUrl}}/user/sign_up" title="Account Settings"><i class="octicon octicon-person-add"></i> {{.i18n.Tr "register"}}</a>