@@ -0,0 +1,3 | |||
|
1 | <%= render :layout => 'layouts/file' do %> | |
|
2 | <%= render :partial => 'common/image', :locals => {:path => download_named_attachment_url(@attachment, @attachment.filename), :alt => @attachment.filename} %> | |
|
3 | <% end %> |
@@ -0,0 +1,1 | |||
|
1 | <%= image_tag path, :alt => alt, :class => 'filecontent image' %> |
@@ -40,6 +40,8 class AttachmentsController < ApplicationController | |||
|
40 | 40 | elsif @attachment.is_text? && @attachment.filesize <= Setting.file_max_size_displayed.to_i.kilobyte |
|
41 | 41 | @content = File.read(@attachment.diskfile, :mode => "rb") |
|
42 | 42 | render :action => 'file' |
|
43 | elsif @attachment.is_image? | |
|
44 | render :action => 'image' | |
|
43 | 45 | else |
|
44 | 46 | download |
|
45 | 47 | end |
@@ -170,7 +170,9 class RepositoriesController < ApplicationController | |||
|
170 | 170 | |
|
171 | 171 | @content = @repository.cat(@path, @rev) |
|
172 | 172 | (show_error_not_found; return) unless @content |
|
173 | if is_raw || | |
|
173 | if !is_raw && Redmine::MimeType.is_type?('image', @path) | |
|
174 | # simply render | |
|
175 | elsif is_raw || | |
|
174 | 176 | (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || |
|
175 | 177 | ! is_entry_text_data?(@content, @path) |
|
176 | 178 | # Force the download |
@@ -237,6 +237,10 class Attachment < ActiveRecord::Base | |||
|
237 | 237 | Redmine::MimeType.is_type?('text', filename) |
|
238 | 238 | end |
|
239 | 239 | |
|
240 | def is_image? | |
|
241 | Redmine::MimeType.is_type?('image', filename) | |
|
242 | end | |
|
243 | ||
|
240 | 244 | def is_diff? |
|
241 | 245 | self.filename =~ /\.(patch|diff)$/i |
|
242 | 246 | end |
@@ -8,7 +8,7 | |||
|
8 | 8 | </div> |
|
9 | 9 | <% for attachment in attachments %> |
|
10 | 10 | <p><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%> |
|
11 | <% if attachment.is_text? %> | |
|
11 | <% if attachment.is_text? || attachment.is_image? %> | |
|
12 | 12 | <%= link_to l(:button_view), |
|
13 | 13 | { :controller => 'attachments', :action => 'show', |
|
14 | 14 | :id => attachment, :filename => attachment.filename }, |
@@ -8,7 +8,11 | |||
|
8 | 8 | |
|
9 | 9 | <%= render :partial => 'link_to_functions' %> |
|
10 | 10 | |
|
11 | <% if Redmine::MimeType.is_type?('image', @path) %> | |
|
12 | <%= render :partial => 'common/image', :locals => {:path => url_for(params.merge(:action => 'raw')), :alt => @path} %> | |
|
13 | <% else %> | |
|
11 | 14 | <%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %> |
|
15 | <% end %> | |
|
12 | 16 | |
|
13 | 17 | <% content_for :header_tags do %> |
|
14 | 18 | <%= stylesheet_link_tag "scm" %> |
@@ -67,6 +67,8 table.filecontent td.line-code pre { | |||
|
67 | 67 | table.filecontent tr:target th.line-num { background-color:#E0E0E0; color: #777; } |
|
68 | 68 | table.filecontent tr:target td.line-code { background-color:#DDEEFF; } |
|
69 | 69 | |
|
70 | img.filecontent.image { max-width: 100%; } | |
|
71 | ||
|
70 | 72 | /* 12 different colors for the annonate view */ |
|
71 | 73 | table.annotate tr.bloc-0 {background: #FFFFBF;} |
|
72 | 74 | table.annotate tr.bloc-1 {background: #EABFFF;} |
General Comments 0
You need to be logged in to leave comments.
Login now