summaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-09-19 20:11:34 -0400
committerUnknwon <joe2010xtmf@163.com>2014-09-19 20:11:34 -0400
commit7ba9257a7ff659417501baf7358216555cebcd86 (patch)
treeffc842cec4165d1069220ae16e08a0b824952f4b /routers/repo
parent6a7bd097fe2b3e894830fc3fdb60dde5594b61d6 (diff)
downloadgitea-7ba9257a7ff659417501baf7358216555cebcd86.tar.gz
gitea-7ba9257a7ff659417501baf7358216555cebcd86.zip
Add suburl support
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/commit.go4
-rw-r--r--routers/repo/issue.go6
-rw-r--r--routers/repo/repo.go4
-rw-r--r--routers/repo/setting.go16
4 files changed, 15 insertions, 15 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index e58b9e78f6..218cae7bed 100644
--- a/routers/repo/commit.go
+++ b/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)
}
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 8aba82ffc5..3a028e58ff 100644
--- a/routers/repo/issue.go
+++ b/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) {
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index 3bd9aa7cd1..ae599f9fa2 100644
--- a/routers/repo/repo.go
+++ b/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
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index 926b543202..137d104f9d 100644
--- a/routers/repo/setting.go
+++ b/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
}