From 469d9b7d9ac3714a146d8e745618641dbe03fafa Mon Sep 17 00:00:00 2001 From: Andrzej Ressel Date: Sat, 20 Apr 2019 04:47:00 +0200 Subject: Add option to blame files (#5721) --- templates/repo/blame.tmpl | 51 +++++++++++++++++++++++++++++++++++++++++++ templates/repo/home.tmpl | 4 +++- templates/repo/view_file.tmpl | 3 +++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 templates/repo/blame.tmpl (limited to 'templates') diff --git a/templates/repo/blame.tmpl b/templates/repo/blame.tmpl new file mode 100644 index 0000000000..012f630203 --- /dev/null +++ b/templates/repo/blame.tmpl @@ -0,0 +1,51 @@ +
+ +

+
+
+ + {{.FileName}} {{FileSize .FileSize}}{{if .IsLFSFile}} ({{.i18n.Tr "repo.stored_lfs"}}){{end}} +
+
+
+ + {{if .Repository.CanEnableEditor}} + {{if .CanEditFile}} + + {{else}} + + {{end}} + {{if .CanDeleteFile}} + + {{else}} + + {{end}} + {{end}} +
+
+
+

+ +
+
+ + + + + + + + +
{{.BlameCommitInfo}}{{.BlameLineNums}}
    {{.BlameContent}}
+
+
+ + +
\ No newline at end of file diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index f94f0f2104..b23e851139 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -86,7 +86,7 @@ {{end}} {{end}} - {{if and (ne $n 0) (not .IsViewFile)}} + {{if and (ne $n 0) (not .IsViewFile) (not .IsBlame) }} {{.i18n.Tr "repo.file_history"}} @@ -132,6 +132,8 @@ {{if .IsViewFile}} {{template "repo/view_file" .}} + {{else if .IsBlame}} + {{template "repo/blame" .}} {{else}} {{template "repo/view_list" .}} {{end}} diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl index 07d1075b13..a6d47b15d6 100644 --- a/templates/repo/view_file.tmpl +++ b/templates/repo/view_file.tmpl @@ -21,6 +21,9 @@ {{if not .IsViewCommit}} {{.i18n.Tr "repo.file_permalink"}} {{end}} + {{if .IsTextFile}} + {{.i18n.Tr "repo.blame"}} + {{end}} {{.i18n.Tr "repo.file_history"}} {{.i18n.Tr "repo.file_raw"}} -- cgit v1.2.3