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 5f0559c068..c44da22720 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 17bf9bb9ed..2d3c638179 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 3987dc668f..635ad50e44 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}}