From 33176e8d27eeb47c6d63fbd24bf11ac9e5c60acd Mon Sep 17 00:00:00 2001 From: Matthias Schoettle Date: Tue, 21 Apr 2020 00:15:41 -0400 Subject: [PATCH] Improve representation of attachments in issues (#11141) * Improves representation of attachments in issues to a list showing the file name and file size (see #6500 and #6089). Signed-off-by: Matthias Schoettle * Fixes indentation. Co-authored-by: zeripath --- templates/repo/issue/view_content.tmpl | 13 ++++++------ .../repo/issue/view_content/attachments.tmpl | 20 ++++++++++++------- .../repo/issue/view_content/comments.tmpl | 13 ++++++------ 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 5f0559c06..c44da2272 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -55,6 +55,12 @@
{{.Issue.Content}}
+ {{if .Issue.Attachments}} +
+
+ {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Issue.Attachments}} +
+ {{end}} {{$reactions := .Issue.Reactions.GroupByType}} {{if $reactions}} @@ -62,13 +68,6 @@ {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}} {{end}} - {{if .Issue.Attachments}} -
-
- {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Issue.Attachments}} -
-
- {{end}} diff --git a/templates/repo/issue/view_content/attachments.tmpl b/templates/repo/issue/view_content/attachments.tmpl index 17bf9bb9e..2d3c63817 100644 --- a/templates/repo/issue/view_content/attachments.tmpl +++ b/templates/repo/issue/view_content/attachments.tmpl @@ -1,9 +1,15 @@ {{range .Attachments}} - - {{if FilenameIsImage .Name}} - - {{else}} - {{svg "octicon-desktop-download" 16}} - {{end}} - + +
+ {{.Size | FileSize}} +
{{end}} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 3987dc668..635ad50e4 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -52,6 +52,12 @@
{{.Content}}
+ {{if .Issue.Attachments}} +
+
+ {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Issue.Attachments}} +
+ {{end}} {{$reactions := .Reactions.GroupByType}} {{if $reactions}} @@ -59,13 +65,6 @@ {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} {{end}} - {{if .Attachments}} -
-
- {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments}} -
-
- {{end}} {{else if eq .Type 1}}