Repository browser does not render previews for audio/video files (#32153).

Patch by Mizuki ISHIKAWA.


git-svn-id: http://svn.redmine.org/redmine/trunk@19492 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2020-02-04 05:32:04 +00:00
parent 01f523f165
commit a0b909d523
5 changed files with 30 additions and 18 deletions

View File

@@ -131,6 +131,12 @@ class RepositoriesController < ApplicationController
def entry
entry_and_raw(false)
@raw_url = url_for(:action => 'raw',
:id => @project,
:repository_id => @repository.identifier_param,
:path => @path,
:rev => @rev,
:only_path => true)
end
def entry_and_raw(is_raw)

View File

@@ -9,11 +9,7 @@
<%= render :partial => 'link_to_functions' %>
<% if Redmine::MimeType.is_type?('image', @path) %>
<%= render :partial => 'common/image', :locals => {:path => url_for(:action => 'raw',
:id => @project,
:repository_id => @repository.identifier_param,
:path => @path,
:rev => @rev), :alt => @path} %>
<%= render :partial => 'common/image', :locals => {:path => @raw_url, :alt => @path} %>
<% elsif @content %>
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
<% else %>
@@ -24,14 +20,11 @@
end %>
<%= render :partial => 'common/other',
:locals => {
:path => (url_for(params.merge(:action => 'raw')) if @allow_download),
:path => (@raw_url if @repository.supports_cat?),
:kind => kind,
:download_link => @repository.supports_cat? ? link_to(
l(:label_no_preview_download),
{ :action => 'raw', :id => @project,
:repository_id => @repository.identifier_param,
:path => to_path_param(@path),
:rev => @rev },
@raw_url,
:class => 'icon icon-download') : nil } %>
<% end %>