# HG changeset patch # User Chris Cannam # Date 1353607457 0 # Node ID 997f6d7738f7c5d61140a95e4d592dbe2361af88 # Parent b56a4c5afa35536f62c459b4e9c5ef9e622c0b6d In repo controller entry action, show the page for the file even if it's binary (so user still has access to history etc links). This makes it possible to use the entry action as the default when a file is clicked on diff -r b56a4c5afa35 -r 997f6d7738f7 app/controllers/repositories_controller.rb --- a/app/controllers/repositories_controller.rb Thu Nov 22 17:26:15 2012 +0000 +++ b/app/controllers/repositories_controller.rb Thu Nov 22 18:04:17 2012 +0000 @@ -143,15 +143,14 @@ @content = @repository.cat(@path, @rev) (show_error_not_found; return) unless @content - if 'raw' == params[:format] || - (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || - ! is_entry_text_data?(@content, @path) + if 'raw' == params[:format] # Force the download send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) } send_type = Redmine::MimeType.of(@path) send_opt[:type] = send_type.to_s if send_type send_data @content, send_opt else + @display_raw = ((@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || !is_entry_text_data?(@content, @path)) # Prevent empty lines when displaying a file with Windows style eol # TODO: UTF-16 # Is this needs? AttachmentsController reads file simply. diff -r b56a4c5afa35 -r 997f6d7738f7 app/views/repositories/entry.html.erb --- a/app/views/repositories/entry.html.erb Thu Nov 22 17:26:15 2012 +0000 +++ b/app/views/repositories/entry.html.erb Thu Nov 22 18:04:17 2012 +0000 @@ -8,7 +8,11 @@

<%= render :partial => 'link_to_functions' %>

-<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %> +<% if @display_raw %> + <%= l(:text_binary_data) %> +<% else %> + <%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %> +<% end %> <% content_for :header_tags do %> <%= stylesheet_link_tag "scm" %> diff -r b56a4c5afa35 -r 997f6d7738f7 config/locales/en.yml --- a/config/locales/en.yml Thu Nov 22 17:26:15 2012 +0000 +++ b/config/locales/en.yml Thu Nov 22 18:04:17 2012 +0000 @@ -1032,7 +1032,7 @@ text_settings_repo_need_help: Please contact us if you need help deciding how best to set this up.
We can also import complete revision history from other systems into a new primary repository for you if you wish. text_has_welcome_page_info: Welcome page

You can replace the standard {{overview_link}} page for this project with your own welcome page.
This page will be editable using the project Wiki. text_has_welcome_page_wiki_disabled: Note: You must enable the Wiki module in the {{modules_link}} tab before you can create or edit this page. - + text_binary_data: Binary data default_role_manager: Manager default_role_developer: Developer