Fixed: inline image not displayed when including a wiki page (closes #1001).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1327 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2008-04-05 17:39:19 +00:00
parent 4e961f44ef
commit c6271d8361
5 changed files with 39 additions and 3 deletions

View File

@ -85,7 +85,7 @@ module Redmine
@included_wiki_pages ||= [] @included_wiki_pages ||= []
raise 'Circular inclusion detected' if @included_wiki_pages.include?(page.title) raise 'Circular inclusion detected' if @included_wiki_pages.include?(page.title)
@included_wiki_pages << page.title @included_wiki_pages << page.title
out = textilizable(page.content, :text) out = textilizable(page.content, :text, :attachments => page.attachments)
@included_wiki_pages.pop @included_wiki_pages.pop
out out
else else

View File

@ -23,4 +23,16 @@ attachments_002:
filesize: 28 filesize: 28
filename: document.txt filename: document.txt
author_id: 2 author_id: 2
attachments_003:
created_on: 2006-07-19 21:07:27 +02:00
downloads: 0
content_type: image/gif
disk_filename: 060719210727_logo.gif
container_id: 4
digest: b91e08d0cf966d5c6ff411bd8c4cc3a2
id: 3
container_type: WikiPage
filesize: 280
filename: logo.gif
author_id: 2

View File

@ -15,6 +15,8 @@ wiki_contents_002:
h1. Another page h1. Another page
This is a link to a ticket: #2 This is a link to a ticket: #2
And this is an included page:
{{include(Page with an inline image)}}
updated_on: 2007-03-08 00:18:07 +01:00 updated_on: 2007-03-08 00:18:07 +01:00
page_id: 2 page_id: 2
id: 2 id: 2
@ -32,3 +34,17 @@ wiki_contents_003:
version: 1 version: 1
author_id: 1 author_id: 1
comments: comments:
wiki_contents_004:
text: |-
h1. Page with an inline image
This is an inline image:
!logo.gif!
updated_on: 2007-03-08 00:18:07 +01:00
page_id: 4
id: 4
version: 1
author_id: 1
comments:

View File

@ -14,4 +14,9 @@ wiki_pages_003:
title: Start_page title: Start_page
id: 3 id: 3
wiki_id: 2 wiki_id: 2
wiki_pages_004:
created_on: 2007-03-08 00:18:07 +01:00
title: Page_with_an_inline_image
id: 4
wiki_id: 1

View File

@ -22,7 +22,7 @@ require 'wiki_controller'
class WikiController; def rescue_action(e) raise e end; end class WikiController; def rescue_action(e) raise e end; end
class WikiControllerTest < Test::Unit::TestCase class WikiControllerTest < Test::Unit::TestCase
fixtures :projects, :users, :roles, :members, :enabled_modules, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions fixtures :projects, :users, :roles, :members, :enabled_modules, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions, :attachments
def setup def setup
@controller = WikiController.new @controller = WikiController.new
@ -43,6 +43,9 @@ class WikiControllerTest < Test::Unit::TestCase
assert_response :success assert_response :success
assert_template 'show' assert_template 'show'
assert_tag :tag => 'h1', :content => /Another page/ assert_tag :tag => 'h1', :content => /Another page/
# Included page with an inline image
assert_tag :tag => 'p', :content => /This is an inline image/
assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3' }
end end
def test_show_unexistent_page_without_edit_right def test_show_unexistent_page_without_edit_right
@ -147,7 +150,7 @@ class WikiControllerTest < Test::Unit::TestCase
assert_template 'special_page_index' assert_template 'special_page_index'
pages = assigns(:pages) pages = assigns(:pages)
assert_not_nil pages assert_not_nil pages
assert_equal 2, pages.size assert_equal Project.find(1).wiki.pages.size, pages.size
assert_tag :tag => 'a', :attributes => { :href => '/wiki/ecookbook/CookBook_documentation' }, assert_tag :tag => 'a', :attributes => { :href => '/wiki/ecookbook/CookBook_documentation' },
:content => /CookBook documentation/ :content => /CookBook documentation/
end end