@@ -27,6 +27,8 class AttachmentsController < ApplicationController | |||
|
27 | 27 | format.html { |
|
28 | 28 | if @attachment.is_diff? |
|
29 | 29 | @diff = File.new(@attachment.diskfile, "rb").read |
|
30 | @diff_type = params[:type] || User.current.pref[:diff_type] || 'inline' | |
|
31 | @diff_type = 'inline' unless %w(inline sbs).include?(@diff_type) | |
|
30 | 32 | render :action => 'diff' |
|
31 | 33 | elsif @attachment.is_text? && @attachment.filesize <= Setting.file_max_size_displayed.to_i.kilobyte |
|
32 | 34 | @content = File.new(@attachment.diskfile, "rb").read |
@@ -5,9 +5,16 | |||
|
5 | 5 | <span class="author"><%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %></span></p> |
|
6 | 6 | <p><%= link_to_attachment @attachment, :text => l(:button_download), :download => true -%> |
|
7 | 7 | <span class="size">(<%= number_to_human_size @attachment.filesize %>)</span></p> |
|
8 | ||
|
9 | 8 | </div> |
|
10 | | |
|
9 | <p> | |
|
10 | <% form_tag({}, :method => 'get') do %> | |
|
11 | <label><%= l(:label_view_diff) %></label> | |
|
12 | <%= select_tag 'type', | |
|
13 | options_for_select( | |
|
14 | [[l(:label_diff_inline), "inline"], [l(:label_diff_side_by_side), "sbs"]], @diff_type), | |
|
15 | :onchange => "if (this.value != '') {this.form.submit()}" %> | |
|
16 | <% end %> | |
|
17 | </p> | |
|
11 | 18 | <%= render :partial => 'common/diff', :locals => {:diff => @diff, :diff_type => @diff_type} %> |
|
12 | 19 | |
|
13 | 20 | <% html_title @attachment.filename %> |
General Comments 0
You need to be logged in to leave comments.
Login now