@@ -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) | |
@@ -186,7 +188,7 module Redmine | |||||
186 | end |
|
188 | end | |
187 | end |
|
189 | end | |
188 | end |
|
190 | end | |
189 | url |
|
191 | URI.encode(url) | |
190 | end |
|
192 | end | |
191 | protected :url_from_pattern |
|
193 | protected :url_from_pattern | |
192 |
|
194 |
@@ -59,4 +59,12 class Redmine::FieldFormatTest < ActionView::TestCase | |||||
59 | assert_equal "bar", field.format.formatted_custom_value(self, custom_value, false) |
|
59 | assert_equal "bar", field.format.formatted_custom_value(self, custom_value, false) | |
60 | assert_equal '<a href="http://foo/bar">bar</a>', field.format.formatted_custom_value(self, custom_value, true) |
|
60 | assert_equal '<a href="http://foo/bar">bar</a>', field.format.formatted_custom_value(self, custom_value, true) | |
61 | end |
|
61 | end | |
|
62 | ||||
|
63 | def test_text_field_with_url_pattern_and_value_containing_a_space_should_format_as_link | |||
|
64 | field = IssueCustomField.new(:field_format => 'string', :url_pattern => 'http://foo/%value%') | |||
|
65 | custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "foo bar") | |||
|
66 | ||||
|
67 | assert_equal "foo bar", field.format.formatted_custom_value(self, custom_value, false) | |||
|
68 | assert_equal '<a href="http://foo/foo%20bar">foo bar</a>', field.format.formatted_custom_value(self, custom_value, true) | |||
|
69 | end | |||
62 | end |
|
70 | end |
General Comments 0
You need to be logged in to leave comments.
Login now