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 /templates/repo/issue/view_content/attachments.tmpl | |
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 'templates/repo/issue/view_content/attachments.tmpl')
-rw-r--r-- | templates/repo/issue/view_content/attachments.tmpl | 55 |
1 files changed, 41 insertions, 14 deletions
diff --git a/templates/repo/issue/view_content/attachments.tmpl b/templates/repo/issue/view_content/attachments.tmpl index d76c0bbfa2..16d77847d0 100644 --- a/templates/repo/issue/view_content/attachments.tmpl +++ b/templates/repo/issue/view_content/attachments.tmpl @@ -1,15 +1,42 @@ -{{- range .Attachments -}} -<div class="twelve wide column" style="padding: 6px;"> - <a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}" title='{{$.ctx.i18n.Tr "repo.issues.attachment.open_tab" .Name}}'> - {{if FilenameIsImage .Name}} - <span class="ui image">{{svg "octicon-file"}}</span> - {{else}} - <span class="ui image">{{svg "octicon-desktop-download"}}</span> - {{end}} - <span><strong>{{.Name}}</strong></span> - </a> +<div class="dropzone-attachments"> + {{if .Attachments}} + <div class="ui clearing divider"></div> + {{end}} + <div class="ui middle aligned padded grid"> + {{$hasThumbnails := false}} + {{- range .Attachments -}} + <div class="twelve wide column" style="padding: 6px;"> + <a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}" title='{{$.ctx.i18n.Tr "repo.issues.attachment.open_tab" .Name}}'> + {{if FilenameIsImage .Name}} + {{if not (containGeneric $.Content .UUID)}} + {{$hasThumbnails = true}} + {{end}} + <span class="ui image">{{svg "octicon-file"}}</span> + {{else}} + <span class="ui image">{{svg "octicon-desktop-download"}}</span> + {{end}} + <span><strong>{{.Name}}</strong></span> + </a> + </div> + <div class="four wide column" style="padding: 0px;"> + <span class="ui text grey right">{{.Size | FileSize}}</span> + </div> + {{end -}} + </div> + + {{if $hasThumbnails}} + <div class="ui clearing divider"></div> + <div class="ui small images thumbnails"> + {{- range .Attachments -}} + {{if FilenameIsImage .Name}} + {{if not (containGeneric $.Content .UUID)}} + <a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}"> + <img class="ui image" src="{{.DownloadURL}}" title='{{$.ctx.i18n.Tr "repo.issues.attachment.open_tab" .Name}}'> + </a> + {{end}} + {{end}} + {{end -}} + </div> + {{end}} + </div> -<div class="four wide column" style="padding: 0px;"> - <span class="ui text grey right">{{.Size | FileSize}}</span> -</div> -{{end -}} |