diff --git a/app/assets/javascripts/app/index.coffee b/app/assets/javascripts/app/index.coffee index b6fdd1404..922403ef0 100644 --- a/app/assets/javascripts/app/index.coffee +++ b/app/assets/javascripts/app/index.coffee @@ -143,6 +143,7 @@ class App extends Spine.Controller 'image/jpg': 'file-image' 'image/png': 'file-image' 'image/svg': 'file-image' + 'image/gif': 'file-image' # documents 'application/pdf': 'file-pdf' 'application/msword': 'file-word' # .doc, .dot @@ -173,6 +174,11 @@ class App extends Spine.Controller canDownload: (contentType) -> contentType != 'text/html' + canPreview: (contentType) -> + return false if _.isEmpty(contentType) + return true if contentType.match(/image\/(png|jpg|jpeg|gif)/i) + false + @viewPrint: (object, attributeName, attributes, table) -> if !attributes attributes = {} diff --git a/app/assets/javascripts/app/views/ticket_zoom/article_view.jst.eco b/app/assets/javascripts/app/views/ticket_zoom/article_view.jst.eco index a425f3913..4c02508b8 100644 --- a/app/assets/javascripts/app/views/ticket_zoom/article_view.jst.eco +++ b/app/assets/javascripts/app/views/ticket_zoom/article_view.jst.eco @@ -64,10 +64,10 @@ download<% end %>>
<% if attachment.preferences && attachment.preferences['Content-Type'] && @ContentTypeIcon(attachment.preferences['Content-Type']): %> - <% if attachment.preferences['Content-Type'].match(/image\/(png|jpg|jpeg)/i): %> - + <% if @canPreview(attachment.preferences['Content-Type']): %> + <% else: %> - <%- @Icon( @ContentTypeIcon(attachment.preferences['Content-Type']) ) %> + <%- @Icon( @ContentTypeIcon(attachment.preferences['Content-Type']) ) %> <% end %> <% else: %> <%- @Icon('file-unknown') %> diff --git a/app/assets/javascripts/app/views/ticket_zoom/sidebar_article_attachment.jst.eco b/app/assets/javascripts/app/views/ticket_zoom/sidebar_article_attachment.jst.eco index a49b2b0f5..f08429406 100644 --- a/app/assets/javascripts/app/views/ticket_zoom/sidebar_article_attachment.jst.eco +++ b/app/assets/javascripts/app/views/ticket_zoom/sidebar_article_attachment.jst.eco @@ -4,10 +4,10 @@ download<% end %>>
<% if attachment.preferences && attachment.preferences['Content-Type'] && @ContentTypeIcon(attachment.preferences['Content-Type']): %> - <% if attachment.preferences['Content-Type'].match(/image\/(png|jpg|jpeg)/i): %> - + <% if @canPreview(attachment.preferences['Content-Type']): %> + <% else: %> - <%- @Icon( @ContentTypeIcon(attachment.preferences['Content-Type']) ) %> + <%- @Icon( @ContentTypeIcon(attachment.preferences['Content-Type']) ) %> <% end %> <% else: %> <%- @Icon('file-unknown') %>