@@ -500,6 +500,8 @@ issues.label_deletion = Label Deletion | |||||
issues.label_deletion_desc = Deleting this label will remove its information in all related issues. Do you want to continue? | issues.label_deletion_desc = Deleting this label will remove its information in all related issues. Do you want to continue? | ||||
issues.label_deletion_success = Label has been deleted successfully! | issues.label_deletion_success = Label has been deleted successfully! | ||||
issues.num_participants = %d Participants | issues.num_participants = %d Participants | ||||
issues.attachment.open_tab = `Click to see "%s" in a new tab` | |||||
issues.attachment.download = `Click to download "%s"` | |||||
pulls.new = New Pull Request | pulls.new = New Pull Request | ||||
pulls.compare_changes = Compare Changes | pulls.compare_changes = Compare Changes | ||||
@@ -9,6 +9,8 @@ import ( | |||||
"encoding/json" | "encoding/json" | ||||
"fmt" | "fmt" | ||||
"html/template" | "html/template" | ||||
"mime" | |||||
"path/filepath" | |||||
"runtime" | "runtime" | ||||
"strings" | "strings" | ||||
"time" | "time" | ||||
@@ -103,6 +105,10 @@ func NewFuncMap() []template.FuncMap { | |||||
"ThemeColorMetaTag": func() string { | "ThemeColorMetaTag": func() string { | ||||
return setting.UI.ThemeColorMetaTag | return setting.UI.ThemeColorMetaTag | ||||
}, | }, | ||||
"FilenameIsImage": func(filename string) bool { | |||||
mimeType := mime.TypeByExtension(filepath.Ext(filename)) | |||||
return strings.HasPrefix(mimeType, "image/") | |||||
}, | |||||
}} | }} | ||||
} | } | ||||
@@ -463,6 +463,13 @@ | |||||
margin: 0; | margin: 0; | ||||
vertical-align: middle; | vertical-align: middle; | ||||
} | } | ||||
span.ui.image { | |||||
font-size: 8vw; | |||||
color: #000000; | |||||
} | |||||
span.ui.image:hover { | |||||
color: #000000; | |||||
} | |||||
} | } | ||||
} | } | ||||
@@ -41,7 +41,13 @@ | |||||
<div class="ui bottom attached segment"> | <div class="ui bottom attached segment"> | ||||
<div class="ui small images"> | <div class="ui small images"> | ||||
{{range .Issue.Attachments}} | {{range .Issue.Attachments}} | ||||
<a target="_blank" href="{{AppSubUrl}}/attachments/{{.UUID}}"><img class="ui image" src="{{AppSubUrl}}/attachments/{{.UUID}}"></a> | |||||
<a target="_blank" href="{{AppSubUrl}}/attachments/{{.UUID}}"> | |||||
{{if FilenameIsImage .Name}} | |||||
<img class="ui image" src="{{AppSubUrl}}/attachments/{{.UUID}}" title='{{$.i18n.Tr "repo.issues.attachment.open_tab" .Name}}'> | |||||
{{else}} | |||||
<span class="ui image octicon octicon-desktop-download" title='{{$.i18n.Tr "repo.issues.attachment.download" .Name}}'></span> | |||||
{{end}} | |||||
</a> | |||||
{{end}} | {{end}} | ||||
</div> | </div> | ||||
</div> | </div> | ||||
@@ -96,7 +102,13 @@ | |||||
<div class="ui bottom attached segment"> | <div class="ui bottom attached segment"> | ||||
<div class="ui small images"> | <div class="ui small images"> | ||||
{{range .Attachments}} | {{range .Attachments}} | ||||
<a target="_blank" href="{{AppSubUrl}}/attachments/{{.UUID}}"><img class="ui image" src="{{AppSubUrl}}/attachments/{{.UUID}}"></a> | |||||
<a target="_blank" href="{{AppSubUrl}}/attachments/{{.UUID}}"> | |||||
{{if FilenameIsImage .Name}} | |||||
<img class="ui image" src="{{AppSubUrl}}/attachments/{{.UUID}}" title='{{$.i18n.Tr "repo.issues.attachment.open_tab" .Name}}'> | |||||
{{else}} | |||||
<span class="ui image octicon octicon-desktop-download" title='{{$.i18n.Tr "repo.issues.attachment.download" .Name}}'></span> | |||||
{{end}} | |||||
</a> | |||||
{{end}} | {{end}} | ||||
</div> | </div> | ||||
</div> | </div> | ||||