@@ -597,8 +597,9 module ApplicationHelper | |||||
597 |
|
597 | |||
598 | def parse_inline_attachments(text, project, obj, attr, only_path, options) |
|
598 | def parse_inline_attachments(text, project, obj, attr, only_path, options) | |
599 | # when using an image link, try to use an attachment, if possible |
|
599 | # when using an image link, try to use an attachment, if possible | |
600 | if options[:attachments] || (obj && obj.respond_to?(:attachments)) |
|
600 | attachments = options[:attachments] || [] | |
601 | attachments = options[:attachments] || obj.attachments |
|
601 | attachments += obj.attachments if obj.respond_to?(:attachments) | |
|
602 | if attachments.present? | |||
602 | text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpe|jpeg|png))"(\s+alt="([^"]*)")?/i) do |m| |
|
603 | text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpe|jpeg|png))"(\s+alt="([^"]*)")?/i) do |m| | |
603 | filename, ext, alt, alttext = $1.downcase, $2, $3, $4 |
|
604 | filename, ext, alt, alttext = $1.downcase, $2, $3, $4 | |
604 | # search for the picture in attachments |
|
605 | # 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 |
@@ -75,6 +75,19 class WikiControllerTest < ActionController::TestCase | |||||
75 | assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation', :text => /Current version/ |
|
75 | assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation', :text => /Current version/ | |
76 | end |
|
76 | end | |
77 |
|
77 | |||
|
78 | def test_show_old_version_with_attachments | |||
|
79 | page = WikiPage.find(4) | |||
|
80 | assert page.attachments.any? | |||
|
81 | content = page.content | |||
|
82 | content.text = "update" | |||
|
83 | content.save! | |||
|
84 | ||||
|
85 | get :show, :project_id => 'ecookbook', :id => page.title, :version => '1' | |||
|
86 | assert_kind_of WikiContent::Version, assigns(:content) | |||
|
87 | assert_response :success | |||
|
88 | assert_template 'show' | |||
|
89 | end | |||
|
90 | ||||
78 | def test_show_old_version_without_permission_should_be_denied |
|
91 | def test_show_old_version_without_permission_should_be_denied | |
79 | Role.anonymous.remove_permission! :view_wiki_edits |
|
92 | Role.anonymous.remove_permission! :view_wiki_edits | |
80 |
|
93 |
General Comments 0
You need to be logged in to leave comments.
Login now