@@ -7,6 +7,9 | |||||
7 | <%= call_hook(:view_welcome_index_left) %> |
|
7 | <%= call_hook(:view_welcome_index_left) %> | |
8 | </div> |
|
8 | </div> | |
9 |
|
9 | |||
|
10 | <%= link_to "Test", "http://foo/test bar" %> | |||
|
11 | <%= link_to "Test", "http://foo/test%20bar" %> | |||
|
12 | ||||
10 | <div class="splitcontentright"> |
|
13 | <div class="splitcontentright"> | |
11 | <% if @news.any? %> |
|
14 | <% if @news.any? %> | |
12 | <div class="news box"> |
|
15 | <div class="news box"> |
@@ -15,6 +15,8 | |||||
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
|
18 | require 'uri' | |||
|
19 | ||||
18 | module Redmine |
|
20 | module Redmine | |
19 | module FieldFormat |
|
21 | module FieldFormat | |
20 | def self.add(name, klass) |
|
22 | def self.add(name, klass) | |
@@ -212,7 +214,7 module Redmine | |||||
212 | end |
|
214 | end | |
213 | end |
|
215 | end | |
214 | end |
|
216 | end | |
215 | url |
|
217 | URI.encode(url) | |
216 | end |
|
218 | end | |
217 | protected :url_from_pattern |
|
219 | protected :url_from_pattern | |
218 |
|
220 |
@@ -74,4 +74,12 class Redmine::FieldFormatTest < ActionView::TestCase | |||||
74 | assert_equal "bar", field.format.formatted_custom_value(self, custom_value, false) |
|
74 | assert_equal "bar", field.format.formatted_custom_value(self, custom_value, false) | |
75 | assert_equal '<a href="http://foo/bar">bar</a>', field.format.formatted_custom_value(self, custom_value, true) |
|
75 | assert_equal '<a href="http://foo/bar">bar</a>', field.format.formatted_custom_value(self, custom_value, true) | |
76 | end |
|
76 | end | |
|
77 | ||||
|
78 | def test_text_field_with_url_pattern_and_value_containing_a_space_should_format_as_link | |||
|
79 | field = IssueCustomField.new(:field_format => 'string', :url_pattern => 'http://foo/%value%') | |||
|
80 | custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "foo bar") | |||
|
81 | ||||
|
82 | assert_equal "foo bar", field.format.formatted_custom_value(self, custom_value, false) | |||
|
83 | assert_equal '<a href="http://foo/foo%20bar">foo bar</a>', field.format.formatted_custom_value(self, custom_value, true) | |||
|
84 | end | |||
77 | end |
|
85 | end |
General Comments 0
You need to be logged in to leave comments.
Login now