summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-04-05 17:39:19 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-04-05 17:39:19 +0000
commitc6271d836168af455fcc9510907fb4fb330f1d62 (patch)
tree8f9e54376e10aace7ab758427a10d28630149caf
parent4e961f44eff23b53351d550fb46c2a346688a271 (diff)
downloadredmine-c6271d836168af455fcc9510907fb4fb330f1d62.tar.gz
redmine-c6271d836168af455fcc9510907fb4fb330f1d62.zip
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
-rw-r--r--lib/redmine/wiki_formatting/macros.rb2
-rw-r--r--test/fixtures/attachments.yml12
-rw-r--r--test/fixtures/wiki_contents.yml16
-rw-r--r--test/fixtures/wiki_pages.yml5
-rw-r--r--test/functional/wiki_controller_test.rb7
5 files changed, 39 insertions, 3 deletions
diff --git a/lib/redmine/wiki_formatting/macros.rb b/lib/redmine/wiki_formatting/macros.rb
index c0f2b222a..f27ea98b9 100644
--- a/lib/redmine/wiki_formatting/macros.rb
+++ b/lib/redmine/wiki_formatting/macros.rb
@@ -85,7 +85,7 @@ module Redmine
@included_wiki_pages ||= []
raise 'Circular inclusion detected' if @included_wiki_pages.include?(page.title)
@included_wiki_pages << page.title
- out = textilizable(page.content, :text)
+ out = textilizable(page.content, :text, :attachments => page.attachments)
@included_wiki_pages.pop
out
else
diff --git a/test/fixtures/attachments.yml b/test/fixtures/attachments.yml
index 764948755..509475c97 100644
--- a/test/fixtures/attachments.yml
+++ b/test/fixtures/attachments.yml
@@ -23,4 +23,16 @@ attachments_002:
filesize: 28
filename: document.txt
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
\ No newline at end of file
diff --git a/test/fixtures/wiki_contents.yml b/test/fixtures/wiki_contents.yml
index 6937dbd14..5d6d3f1de 100644
--- a/test/fixtures/wiki_contents.yml
+++ b/test/fixtures/wiki_contents.yml
@@ -15,6 +15,8 @@ wiki_contents_002:
h1. Another page
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
page_id: 2
id: 2
@@ -32,3 +34,17 @@ wiki_contents_003:
version: 1
author_id: 1
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:
+ \ No newline at end of file
diff --git a/test/fixtures/wiki_pages.yml b/test/fixtures/wiki_pages.yml
index ee260291d..f89832e44 100644
--- a/test/fixtures/wiki_pages.yml
+++ b/test/fixtures/wiki_pages.yml
@@ -14,4 +14,9 @@ wiki_pages_003:
title: Start_page
id: 3
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
\ No newline at end of file
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb
index 0418a02b6..68e52600f 100644
--- a/test/functional/wiki_controller_test.rb
+++ b/test/functional/wiki_controller_test.rb
@@ -22,7 +22,7 @@ require 'wiki_controller'
class WikiController; def rescue_action(e) raise e end; end
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
@controller = WikiController.new
@@ -43,6 +43,9 @@ class WikiControllerTest < Test::Unit::TestCase
assert_response :success
assert_template 'show'
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
def test_show_unexistent_page_without_edit_right
@@ -147,7 +150,7 @@ class WikiControllerTest < Test::Unit::TestCase
assert_template 'special_page_index'
pages = assigns(: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' },
:content => /CookBook documentation/
end