@@ -545,9 +545,9 module ApplicationHelper | |||||
545 |
|
545 | |||
546 | def parse_inline_attachments(text, project, obj, attr, only_path, options) |
|
546 | def parse_inline_attachments(text, project, obj, attr, only_path, options) | |
547 | # when using an image link, try to use an attachment, if possible |
|
547 | # when using an image link, try to use an attachment, if possible | |
548 |
if options[:attachments].present? || |
|
548 | if options[:attachments].present? || obj.respond_to?(:attachments) | |
549 | attachments = options[:attachments] || [] |
|
549 | attachments = options[:attachments] || [] | |
550 | attachments += obj.attachments if obj |
|
550 | attachments += obj.attachments if obj.respond_to?(:attachments) | |
551 | text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpe|jpeg|png))"(\s+alt="([^"]*)")?/i) do |m| |
|
551 | text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpe|jpeg|png))"(\s+alt="([^"]*)")?/i) do |m| | |
552 | filename, ext, alt, alttext = $1.downcase, $2, $3, $4 |
|
552 | filename, ext, alt, alttext = $1.downcase, $2, $3, $4 | |
553 | # search for the picture in attachments |
|
553 | # search for the picture in attachments |
@@ -99,4 +99,18 wiki_content_versions_006: | |||||
99 | version: 3 |
|
99 | version: 3 | |
100 | author_id: 1 |
|
100 | author_id: 1 | |
101 | comments: |
|
101 | comments: | |
|
102 | wiki_content_versions_007: | |||
|
103 | data: |- | |||
|
104 | h1. Page with an inline image | |||
|
105 | ||||
|
106 | This is an inline image: | |||
|
107 | ||||
|
108 | !logo.gif! | |||
|
109 | updated_on: 2007-03-08 00:18:07 +01:00 | |||
|
110 | page_id: 4 | |||
|
111 | wiki_content_id: 4 | |||
|
112 | id: 7 | |||
|
113 | version: 1 | |||
|
114 | author_id: 1 | |||
|
115 | comments: | |||
102 |
|
116 |
@@ -68,6 +68,19 class WikiControllerTest < ActionController::TestCase | |||||
68 | assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation', :text => /Current version/ |
|
68 | assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation', :text => /Current version/ | |
69 | end |
|
69 | end | |
70 |
|
70 | |||
|
71 | def test_show_old_version_with_attachments | |||
|
72 | page = WikiPage.find(4) | |||
|
73 | assert page.attachments.any? | |||
|
74 | content = page.content | |||
|
75 | content.text = "update" | |||
|
76 | content.save! | |||
|
77 | ||||
|
78 | get :show, :project_id => 'ecookbook', :id => page.title, :version => '1' | |||
|
79 | assert_kind_of WikiContent::Version, assigns(:content) | |||
|
80 | assert_response :success | |||
|
81 | assert_template 'show' | |||
|
82 | end | |||
|
83 | ||||
71 | def test_show_old_version_without_permission_should_be_denied |
|
84 | def test_show_old_version_without_permission_should_be_denied | |
72 | Role.anonymous.remove_permission! :view_wiki_edits |
|
85 | Role.anonymous.remove_permission! :view_wiki_edits | |
73 |
|
86 |
General Comments 0
You need to be logged in to leave comments.
Login now