diff options
author | bobemoe <inbox.github@jhodges.co.uk> | 2020-12-13 19:12:27 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-13 21:12:27 +0200 |
commit | b35c1b5784b99fa71d0ea3ddf8ac253dc44c0d82 (patch) | |
tree | 696671b9bc38427fa0fcc30cc3adcc990854b169 /routers/repo/issue.go | |
parent | 825efa2605421a54ad1c5960de9e121a34d68d1a (diff) | |
download | gitea-b35c1b5784b99fa71d0ea3ddf8ac253dc44c0d82.tar.gz gitea-b35c1b5784b99fa71d0ea3ddf8ac253dc44c0d82.zip |
add thumbnail preview section to issue attachments (#13826)
* add thumbnail preview section to attachments
* dont show thumbnail if the image is already shown inline
* update router to pass the `content` to the attachemnts template
* limit attachment preview height to 150px (same as width)
* remove unused css (referance removed in https://github.com/go-gitea/gitea/pull/11141/files#diff-9faae32445ed9673de2830c9fc35e93f44487f0a0068202988adaf00a5bac850L66 )
* dont show divider after edit if no attachemnts
Co-authored-by: James <inbox.dev@jhodges.co.uk>
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'routers/repo/issue.go')
-rw-r--r-- | routers/repo/issue.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 6ebc5d6ecb..e350f74de9 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -1649,7 +1649,7 @@ func UpdateIssueContent(ctx *context.Context) { ctx.JSON(200, map[string]interface{}{ "content": string(markdown.Render([]byte(issue.Content), ctx.Query("context"), ctx.Repo.Repository.ComposeMetas())), - "attachments": attachmentsHTML(ctx, issue.Attachments), + "attachments": attachmentsHTML(ctx, issue.Attachments, issue.Content), }) } @@ -2065,7 +2065,7 @@ func UpdateCommentContent(ctx *context.Context) { ctx.JSON(200, map[string]interface{}{ "content": string(markdown.Render([]byte(comment.Content), ctx.Query("context"), ctx.Repo.Repository.ComposeMetas())), - "attachments": attachmentsHTML(ctx, comment.Attachments), + "attachments": attachmentsHTML(ctx, comment.Attachments, comment.Content), }) } @@ -2399,10 +2399,11 @@ func updateAttachments(item interface{}, files []string) error { return err } -func attachmentsHTML(ctx *context.Context, attachments []*models.Attachment) string { +func attachmentsHTML(ctx *context.Context, attachments []*models.Attachment, content string) string { attachHTML, err := ctx.HTMLString(string(tplAttachment), map[string]interface{}{ "ctx": ctx.Data, "Attachments": attachments, + "Content": content, }) if err != nil { ctx.ServerError("attachmentsHTML.HTMLString", err) |