mirror of
https://github.com/redmine/redmine.git
synced 2025-11-10 23:36:01 +01:00
Render Textile and Markdown files in the repository browser (#16849).
Patch by Takenori TAKAKI. git-svn-id: http://svn.redmine.org/redmine/trunk@21013 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -10,6 +10,10 @@
|
||||
|
||||
<% if Redmine::MimeType.is_type?('image', @path) %>
|
||||
<%= render :partial => 'common/image', :locals => {:path => @raw_url, :alt => @path} %>
|
||||
<% elsif Redmine::MimeType.of(@path) == 'text/x-textile' %>
|
||||
<%= render :partial => 'common/markup', :locals => {:markup_text_formatting => 'textile', :markup_text => @content} %>
|
||||
<% elsif Redmine::MimeType.of(@path) == 'text/markdown' %>
|
||||
<%= render :partial => 'common/markup', :locals => {:markup_text_formatting => 'markdown', :markup_text => @content} %>
|
||||
<% elsif @content %>
|
||||
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
|
||||
<% else %>
|
||||
|
||||
@@ -789,7 +789,7 @@ span.pagination {margin-left:3px; color:#888; display:block;}
|
||||
font-weight: bold;
|
||||
}
|
||||
span.pagination>span {white-space:nowrap;}
|
||||
.controller-attachments.action-show span.pagination{
|
||||
.controller-attachments.action-show span.pagination, .controller-repositories.action-entry span.pagination {
|
||||
display: block;
|
||||
margin-top: 1.2em;
|
||||
}
|
||||
@@ -1804,7 +1804,7 @@ img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.filecontent-container > .filecontent.wiki {
|
||||
.filecontent.wiki {
|
||||
position: relative;
|
||||
padding: 1em;
|
||||
border: 1px solid #e4e4e4;
|
||||
|
||||
Binary file not shown.
@@ -27,7 +27,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
|
||||
:issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
|
||||
|
||||
PRJ_ID = 3
|
||||
NUM_REV = 12
|
||||
NUM_REV = 13
|
||||
|
||||
def setup
|
||||
super
|
||||
@@ -204,7 +204,8 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
|
||||
)
|
||||
assert_response :success
|
||||
assert_select 'table.changesets tbody' do
|
||||
assert_select 'tr', 7
|
||||
assert_select 'tr', 8
|
||||
assert_select 'tr td.id a', :text => '13'
|
||||
assert_select 'tr td.id a', :text => '12'
|
||||
assert_select 'tr td.id a', :text => '10'
|
||||
assert_select 'tr td.id a', :text => '9'
|
||||
@@ -280,6 +281,32 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
|
||||
assert_select 'audio[src=?]', "/projects/subproject1/repository/#{@repository.id}/raw/subversion_test/folder/subfolder/chords.mp3"
|
||||
end
|
||||
|
||||
def text_entry_should_preview_markdown
|
||||
get(
|
||||
:entry,
|
||||
:params => {
|
||||
:id => PRJ_ID,
|
||||
:repository_id => @repository.id,
|
||||
:path => repository_path_hash(['subversion_test', 'folder', 'subfolder', 'testfile.md'])[:param]
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_select 'div.wiki', :html => "<h1>Header 1</h1>\n\n<h2>Header 2</h2>\n\n<h3>Header 3</h3>"
|
||||
end
|
||||
|
||||
def text_entry_should_preview_textile
|
||||
get(
|
||||
:entry,
|
||||
:params => {
|
||||
:id => PRJ_ID,
|
||||
:repository_id => @repository.id,
|
||||
:path => repository_path_hash(['subversion_test', 'folder', 'subfolder', 'testfile.textile'])[:param]
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_select 'div.wiki', :html => "<h1>Header 1</h1>\n\n\n\t<h2>Header 2</h2>\n\n\n\t<h3>Header 3</h3>"
|
||||
end
|
||||
|
||||
def test_entry_at_given_revision
|
||||
assert_equal 0, @repository.changesets.count
|
||||
@repository.fetch_changesets
|
||||
|
||||
@@ -24,7 +24,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
|
||||
|
||||
include Redmine::I18n
|
||||
|
||||
NUM_REV = 12
|
||||
NUM_REV = 13
|
||||
|
||||
def setup
|
||||
User.current = nil
|
||||
@@ -100,7 +100,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
|
||||
@project.reload
|
||||
|
||||
assert_equal NUM_REV, @repository.changesets.count
|
||||
assert_equal 21, @repository.filechanges.count
|
||||
assert_equal 23, @repository.filechanges.count
|
||||
assert_equal 'Initial import.', @repository.changesets.find_by_revision('1').comments
|
||||
end
|
||||
|
||||
@@ -144,7 +144,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
|
||||
|
||||
# with path
|
||||
changesets = @repository.latest_changesets('subversion_test/folder', nil)
|
||||
assert_equal ["12", "10", "9", "7", "6", "5", "2"], changesets.collect(&:revision)
|
||||
assert_equal ["13", "12", "10", "9", "7", "6", "5", "2"], changesets.collect(&:revision)
|
||||
|
||||
# with path and revision
|
||||
changesets = @repository.latest_changesets('subversion_test/folder', 8)
|
||||
|
||||
Reference in New Issue
Block a user