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)
<%= 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 %>
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 %>
:issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
PRJ_ID = 3
- NUM_REV = 11
+ NUM_REV = 12
def setup
super
assert_select 'table.changesets tbody' do
assert_select 'tr', 10
- assert_select 'tr td.id a', :text => '11'
+ assert_select 'tr td.id a', :text => '12'
end
assert_select 'input[name=rev]'
}
)
assert_response :success
-
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 => '9'
assert_select 'tr td.id a', :text => '7'
assert_select 'img[src=?]', "/projects/subproject1/repository/#{@repository.id}/raw/subversion_test/folder/subfolder/rubylogo.gif"
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
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets
include Redmine::I18n
- NUM_REV = 11
+ NUM_REV = 12
def setup
User.current = nil
@project.reload
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
end
# with path
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
changesets = @repository.latest_changesets('subversion_test/folder', 8)
@repository.fetch_changesets
@project.reload
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
end
else