mirror of
https://github.com/redmine/redmine.git
synced 2025-11-10 23:36:01 +01:00
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:
@@ -131,6 +131,12 @@ class RepositoriesController < ApplicationController
|
|||||||
|
|
||||||
def entry
|
def entry
|
||||||
entry_and_raw(false)
|
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
|
end
|
||||||
|
|
||||||
def entry_and_raw(is_raw)
|
def entry_and_raw(is_raw)
|
||||||
|
|||||||
@@ -9,11 +9,7 @@
|
|||||||
<%= render :partial => 'link_to_functions' %>
|
<%= render :partial => 'link_to_functions' %>
|
||||||
|
|
||||||
<% if Redmine::MimeType.is_type?('image', @path) %>
|
<% if Redmine::MimeType.is_type?('image', @path) %>
|
||||||
<%= render :partial => 'common/image', :locals => {:path => url_for(:action => 'raw',
|
<%= render :partial => 'common/image', :locals => {:path => @raw_url, :alt => @path} %>
|
||||||
:id => @project,
|
|
||||||
:repository_id => @repository.identifier_param,
|
|
||||||
:path => @path,
|
|
||||||
:rev => @rev), :alt => @path} %>
|
|
||||||
<% elsif @content %>
|
<% elsif @content %>
|
||||||
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
|
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
|
||||||
<% else %>
|
<% else %>
|
||||||
@@ -24,14 +20,11 @@
|
|||||||
end %>
|
end %>
|
||||||
<%= render :partial => 'common/other',
|
<%= render :partial => 'common/other',
|
||||||
:locals => {
|
:locals => {
|
||||||
:path => (url_for(params.merge(:action => 'raw')) if @allow_download),
|
:path => (@raw_url if @repository.supports_cat?),
|
||||||
:kind => kind,
|
:kind => kind,
|
||||||
:download_link => @repository.supports_cat? ? link_to(
|
:download_link => @repository.supports_cat? ? link_to(
|
||||||
l(:label_no_preview_download),
|
l(:label_no_preview_download),
|
||||||
{ :action => 'raw', :id => @project,
|
@raw_url,
|
||||||
:repository_id => @repository.identifier_param,
|
|
||||||
:path => to_path_param(@path),
|
|
||||||
:rev => @rev },
|
|
||||||
:class => 'icon icon-download') : nil } %>
|
:class => 'icon icon-download') : nil } %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -27,7 +27,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
|
|||||||
:issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
|
:issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
|
||||||
|
|
||||||
PRJ_ID = 3
|
PRJ_ID = 3
|
||||||
NUM_REV = 11
|
NUM_REV = 12
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@@ -78,7 +78,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
|
|||||||
|
|
||||||
assert_select 'table.changesets tbody' do
|
assert_select 'table.changesets tbody' do
|
||||||
assert_select 'tr', 10
|
assert_select 'tr', 10
|
||||||
assert_select 'tr td.id a', :text => '11'
|
assert_select 'tr td.id a', :text => '12'
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_select 'input[name=rev]'
|
assert_select 'input[name=rev]'
|
||||||
@@ -203,9 +203,9 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
assert_select 'table.changesets tbody' do
|
assert_select 'table.changesets tbody' do
|
||||||
assert_select 'tr', 6
|
assert_select 'tr', 7
|
||||||
|
assert_select 'tr td.id a', :text => '12'
|
||||||
assert_select 'tr td.id a', :text => '10'
|
assert_select 'tr td.id a', :text => '10'
|
||||||
assert_select 'tr td.id a', :text => '9'
|
assert_select 'tr td.id a', :text => '9'
|
||||||
assert_select 'tr td.id a', :text => '7'
|
assert_select 'tr td.id a', :text => '7'
|
||||||
@@ -267,6 +267,19 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
|
|||||||
assert_select 'img[src=?]', "/projects/subproject1/repository/#{@repository.id}/raw/subversion_test/folder/subfolder/rubylogo.gif"
|
assert_select 'img[src=?]', "/projects/subproject1/repository/#{@repository.id}/raw/subversion_test/folder/subfolder/rubylogo.gif"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_entry_should_preview_audio
|
||||||
|
get(
|
||||||
|
:entry,
|
||||||
|
:params => {
|
||||||
|
:id => PRJ_ID,
|
||||||
|
:repository_id => @repository.id,
|
||||||
|
:path => repository_path_hash(['subversion_test', 'folder', 'subfolder', 'chords.mp3'])[:param]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
assert_response :success
|
||||||
|
assert_select 'audio[src=?]', "/projects/subproject1/repository/#{@repository.id}/raw/subversion_test/folder/subfolder/chords.mp3"
|
||||||
|
end
|
||||||
|
|
||||||
def test_entry_at_given_revision
|
def test_entry_at_given_revision
|
||||||
assert_equal 0, @repository.changesets.count
|
assert_equal 0, @repository.changesets.count
|
||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
NUM_REV = 11
|
NUM_REV = 12
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
User.current = nil
|
User.current = nil
|
||||||
@@ -98,7 +98,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
|
|||||||
@project.reload
|
@project.reload
|
||||||
|
|
||||||
assert_equal NUM_REV, @repository.changesets.count
|
assert_equal NUM_REV, @repository.changesets.count
|
||||||
assert_equal 20, @repository.filechanges.count
|
assert_equal 21, @repository.filechanges.count
|
||||||
assert_equal 'Initial import.', @repository.changesets.find_by_revision('1').comments
|
assert_equal 'Initial import.', @repository.changesets.find_by_revision('1').comments
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
# with path
|
# with path
|
||||||
changesets = @repository.latest_changesets('subversion_test/folder', nil)
|
changesets = @repository.latest_changesets('subversion_test/folder', nil)
|
||||||
assert_equal ["10", "9", "7", "6", "5", "2"], changesets.collect(&:revision)
|
assert_equal ["12", "10", "9", "7", "6", "5", "2"], changesets.collect(&:revision)
|
||||||
|
|
||||||
# with path and revision
|
# with path and revision
|
||||||
changesets = @repository.latest_changesets('subversion_test/folder', 8)
|
changesets = @repository.latest_changesets('subversion_test/folder', 8)
|
||||||
@@ -278,7 +278,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
|
|||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
@project.reload
|
@project.reload
|
||||||
assert_equal NUM_REV, @repository.changesets.count
|
assert_equal NUM_REV, @repository.changesets.count
|
||||||
changeset = @repository.find_changeset_by_name('11')
|
changeset = @repository.find_changeset_by_name('12')
|
||||||
assert_nil changeset.next
|
assert_nil changeset.next
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user