mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
Custom field List Link values to URL breaks on entries with spaces (#23067).
git-svn-id: http://svn.redmine.org/redmine/trunk@15539 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
adb9980728
commit
bbd24fe350
@ -7,6 +7,9 @@
|
|||||||
<%= call_hook(:view_welcome_index_left) %>
|
<%= call_hook(:view_welcome_index_left) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<%= link_to "Test", "http://foo/test bar" %>
|
||||||
|
<%= link_to "Test", "http://foo/test%20bar" %>
|
||||||
|
|
||||||
<div class="splitcontentright">
|
<div class="splitcontentright">
|
||||||
<% if @news.any? %>
|
<% if @news.any? %>
|
||||||
<div class="news box">
|
<div class="news box">
|
||||||
|
|||||||
@ -15,6 +15,8 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
require 'uri'
|
||||||
|
|
||||||
module Redmine
|
module Redmine
|
||||||
module FieldFormat
|
module FieldFormat
|
||||||
def self.add(name, klass)
|
def self.add(name, klass)
|
||||||
@ -212,7 +214,7 @@ module Redmine
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
url
|
URI.encode(url)
|
||||||
end
|
end
|
||||||
protected :url_from_pattern
|
protected :url_from_pattern
|
||||||
|
|
||||||
|
|||||||
@ -74,4 +74,12 @@ class Redmine::FieldFormatTest < ActionView::TestCase
|
|||||||
assert_equal "bar", field.format.formatted_custom_value(self, custom_value, false)
|
assert_equal "bar", field.format.formatted_custom_value(self, custom_value, false)
|
||||||
assert_equal '<a href="http://foo/bar">bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
assert_equal '<a href="http://foo/bar">bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_text_field_with_url_pattern_and_value_containing_a_space_should_format_as_link
|
||||||
|
field = IssueCustomField.new(:field_format => 'string', :url_pattern => 'http://foo/%value%')
|
||||||
|
custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "foo bar")
|
||||||
|
|
||||||
|
assert_equal "foo bar", field.format.formatted_custom_value(self, custom_value, false)
|
||||||
|
assert_equal '<a href="http://foo/foo%20bar">foo bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user