Feature #22058 » 0003-Add-inline-image-preview-display-for-attachments-and.patch
| app/controllers/attachments_controller.rb | ||
|---|---|---|
|
elsif @attachment.is_text? && @attachment.filesize <= Setting.file_max_size_displayed.to_i.kilobyte
|
||
|
@content = File.new(@attachment.diskfile, "rb").read
|
||
|
render :action => 'file'
|
||
|
elsif @attachment.is_image?
|
||
|
render :action => 'image'
|
||
|
else
|
||
|
download
|
||
|
end
|
||
| app/controllers/repositories_controller.rb | ||
|---|---|---|
|
@content = @repository.cat(@path, @rev)
|
||
|
(show_error_not_found; return) unless @content
|
||
|
if is_raw ||
|
||
|
if !is_raw && Redmine::MimeType.is_type?('image', @path)
|
||
|
# simply render
|
||
|
elsif is_raw ||
|
||
|
(@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) ||
|
||
|
! is_entry_text_data?(@content, @path)
|
||
|
# Force the download
|
||
| app/models/attachment.rb | ||
|---|---|---|
|
Redmine::MimeType.is_type?('text', filename)
|
||
|
end
|
||
|
def is_image?
|
||
|
Redmine::MimeType.is_type?('image', filename)
|
||
|
end
|
||
|
def is_diff?
|
||
|
self.filename =~ /\.(patch|diff)$/i
|
||
|
end
|
||
| app/views/attachments/_links.html.erb | ||
|---|---|---|
|
</div>
|
||
|
<% for attachment in attachments %>
|
||
|
<p><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
|
||
|
<% if attachment.is_text? %>
|
||
|
<% if attachment.is_text? || attachment.is_image? %>
|
||
|
<%= link_to l(:button_view),
|
||
|
{ :controller => 'attachments', :action => 'show',
|
||
|
:id => attachment, :filename => attachment.filename },
|
||
| app/views/attachments/image.html.erb | ||
|---|---|---|
|
<%= render :layout => 'layouts/file' do %>
|
||
|
<%= render :partial => 'common/image', :locals => {:path => download_named_attachment_url(@attachment, @attachment.filename), :alt => @attachment.filename} %>
|
||
|
<% end %>
|
||
| app/views/common/_image.html.erb | ||
|---|---|---|
|
<%= image_tag path, :alt => alt, :class => 'filecontent image' %>
|
||
| app/views/repositories/entry.html.erb | ||
|---|---|---|
|
<%= render :partial => 'link_to_functions' %>
|
||
|
<% if Redmine::MimeType.is_type?('image', @path) %>
|
||
|
<%= render :partial => 'common/image', :locals => {:path => url_for(params.merge(:action => 'raw')), :alt => @path} %>
|
||
|
<% else %>
|
||
|
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
|
||
|
<% end %>
|
||
|
<% content_for :header_tags do %>
|
||
|
<%= stylesheet_link_tag "scm" %>
|
||
| public/stylesheets/scm.css | ||
|---|---|---|
|
table.filecontent tr:target th.line-num { background-color:#E0E0E0; color: #777; }
|
||
|
table.filecontent tr:target td.line-code { background-color:#DDEEFF; }
|
||
|
img.filecontent.image { max-width: 100%; }
|
||
|
/* 12 different colors for the annonate view */
|
||
|
table.annotate tr.bloc-0 {background: #FFFFBF;}
|
||
|
table.annotate tr.bloc-1 {background: #EABFFF;}
|
||
- « Previous
- 1
- …
- 4
- 5
- 6
- Next »