diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index b3eb7b1f4a..64bc3b1871 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -109,6 +109,7 @@ copy_path = Copy path copy_success = Copied! copy_error = Copy failed copy_type_unsupported = This file type cannot be copied +copy_filename = Copy filename write = Write preview = Preview diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go index 1cc5ce66f8..2de87f9979 100644 --- a/services/gitdiff/gitdiff.go +++ b/services/gitdiff/gitdiff.go @@ -13,6 +13,7 @@ import ( "html/template" "io" "net/url" + "path" "sort" "strings" "time" @@ -403,6 +404,14 @@ func (diffFile *DiffFile) GetDiffFileName() string { return diffFile.Name } +// GetDiffFileBaseName returns the short name of the diff file, or its short old name in case it was deleted +func (diffFile *DiffFile) GetDiffFileBaseName() string { + if diffFile.Name == "" { + return path.Base(diffFile.OldName) + } + return path.Base(diffFile.Name) +} + func (diffFile *DiffFile) ShouldBeHidden() bool { return diffFile.IsGenerated || diffFile.IsViewed } diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index e4d1efac57..7eb96e1ddc 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -143,6 +143,7 @@ {{end}} + {{if not $.PageIsWiki}} {{if $file.IsDeleted}} {{ctx.Locale.Tr "repo.diff.view_file"}}