]> source.dussan.org Git - redmine.git/commitdiff
Fixed: inline image not displayed when including a wiki page (closes #1001).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 5 Apr 2008 17:39:19 +0000 (17:39 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 5 Apr 2008 17:39:19 +0000 (17:39 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1327 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/wiki_formatting/macros.rb
test/fixtures/attachments.yml
test/fixtures/wiki_contents.yml
test/fixtures/wiki_pages.yml
test/functional/wiki_controller_test.rb

index c0f2b222a5a42e31f0b6b8410dae1d3480021e77..f27ea98b9ff8f29466e1c446b13dee3d6d0e98a6 100644 (file)
@@ -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
index 7649487558df13327e77f220d4ec0753635e75d5..509475c9765f3c812ff5feed3211883f4424a22a 100644 (file)
@@ -23,4 +23,16 @@ attachments_002:
   filesize: 28\r
   filename: document.txt\r
   author_id: 2\r
+attachments_003: \r
+  created_on: 2006-07-19 21:07:27 +02:00\r
+  downloads: 0\r
+  content_type: image/gif\r
+  disk_filename: 060719210727_logo.gif\r
+  container_id: 4\r
+  digest: b91e08d0cf966d5c6ff411bd8c4cc3a2\r
+  id: 3\r
+  container_type: WikiPage\r
+  filesize: 280\r
+  filename: logo.gif\r
+  author_id: 2\r
   
\ No newline at end of file
index 6937dbd14814630166424de19ea2bc9e0636e381..5d6d3f1dee0e4dad6ff7a2c4563ea27d7cfe042a 100644 (file)
@@ -15,6 +15,8 @@ wiki_contents_002:
     h1. Another page\r
     \r
     This is a link to a ticket: #2\r
+    And this is an included page:\r
+    {{include(Page with an inline image)}}\r
   updated_on: 2007-03-08 00:18:07 +01:00\r
   page_id: 2\r
   id: 2\r
@@ -32,3 +34,17 @@ wiki_contents_003:
   version: 1\r
   author_id: 1\r
   comments: \r
+wiki_contents_004: \r
+  text: |-\r
+    h1. Page with an inline image\r
+    \r
+    This is an inline image:\r
+    \r
+    !logo.gif!\r
+  updated_on: 2007-03-08 00:18:07 +01:00\r
+  page_id: 4\r
+  id: 4\r
+  version: 1\r
+  author_id: 1\r
+  comments: \r
+  
\ No newline at end of file
index ee260291d8f42c5f7537ddc3f456894be3386e92..f89832e4427e0f44b09abd7c47564fa593086c5a 100644 (file)
@@ -14,4 +14,9 @@ wiki_pages_003:
   title: Start_page\r
   id: 3\r
   wiki_id: 2\r
+wiki_pages_004: \r
+  created_on: 2007-03-08 00:18:07 +01:00\r
+  title: Page_with_an_inline_image\r
+  id: 4\r
+  wiki_id: 1\r
   
\ No newline at end of file
index 0418a02b60bc3454af3edbf1d1bf15b679bf5263..68e52600f2ec5c26b6daa520f0080ab05f4682f6 100644 (file)
@@ -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