summaryrefslogtreecommitdiffstats
path: root/routers/repo/view.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-28 01:41:44 -0700
committerUnknwon <u@gogs.io>2016-08-28 01:41:44 -0700
commit0114fdcba40270731d59fe24e8fa6c6147d69e01 (patch)
tree3cd62e41ad1ed6172e2ba1c16a5e06df39be147d /routers/repo/view.go
parentdad5c155202a79514e60e73ac019191218167d35 (diff)
downloadgitea-0114fdcba40270731d59fe24e8fa6c6147d69e01.tar.gz
gitea-0114fdcba40270731d59fe24e8fa6c6147d69e01.zip
Web editor: improve delete file process
Diffstat (limited to 'routers/repo/view.go')
-rw-r--r--routers/repo/view.go26
1 files changed, 12 insertions, 14 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go
index a40461361a..50b158467a 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -48,7 +48,6 @@ func Home(ctx *context.Context) {
branchLink := ctx.Repo.RepoLink + "/src/" + branchName
treeLink := branchLink
rawLink := ctx.Repo.RepoLink + "/raw/" + branchName
- // newFileLink := ctx.Repo.RepoLink + "/_new/" + branchName
// uploadFileLink := ctx.Repo.RepoLink + "/upload/" + branchName
treePath := ctx.Repo.TreePath
@@ -155,13 +154,11 @@ func Home(ctx *context.Context) {
if ctx.Repo.IsWriter() && ctx.Repo.IsViewBranch {
ctx.Data["CanDeleteFile"] = true
- ctx.Data["FileDeleteLinkTooltip"] = ctx.Tr("repo.delete_this_file")
- } else {
- if !ctx.Repo.IsViewBranch {
- ctx.Data["FileDeleteLinkTooltip"] = ctx.Tr("repo.must_be_on_branch")
- } else if !ctx.Repo.IsWriter() {
- ctx.Data["FileDeleteLinkTooltip"] = ctx.Tr("repo.must_be_writer")
- }
+ ctx.Data["DeleteFileTooltip"] = ctx.Tr("repo.editor.delete_this_file")
+ } else if !ctx.Repo.IsViewBranch {
+ ctx.Data["DeleteFileTooltip"] = ctx.Tr("repo.editor.must_be_on_a_branch")
+ } else if !ctx.Repo.IsWriter() {
+ ctx.Data["DeleteFileTooltip"] = ctx.Tr("repo.editor.must_have_write_access")
}
} else {
@@ -240,12 +237,13 @@ func Home(ctx *context.Context) {
}
ctx.Data["LastCommit"] = lastCommit
ctx.Data["LastCommitUser"] = models.ValidateCommitWithEmail(lastCommit)
- // if ctx.Repo.IsWriter() && ctx.Repo.IsViewBranch {
- // ctx.Data["NewFileLink"] = newFileLink + "/" + treePath
- // if setting.Repository.Upload.Enabled {
- // ctx.Data["UploadFileLink"] = uploadFileLink + "/" + treePath
- // }
- // }
+
+ if ctx.Repo.IsWriter() && ctx.Repo.IsViewBranch {
+ ctx.Data["CanAddFile"] = true
+ // if setting.Repository.Upload.Enabled {
+ // ctx.Data["UploadFileLink"] = uploadFileLink + "/" + treePath
+ // }
+ }
}
ctx.Data["Username"] = userName