Patch #27024

Links on custom field values don't have "external" class

Added by Go MAEDA 9 months ago. Updated 6 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Custom fields
Target version:4.0.0

Description

Textile and Markdown formatter in Redmine adds "external" class to a element when rendering links to an external site. Here is an exmaple:

Textile:

"Redmine":http://www.redmine.org/

Rendered HTML:

<a class="external" href="http://www.redmine.org/">

Although those formatters adds "external" class like as above, links on custom field values, which can be configured in "Link values to URL" of custom fields, don't have "external" class. I am in trouble with this behavior because I use UI theme that provides JavaScript code which opens external link in a new browser window (please see https://github.com/farend/redmine_theme_farend_basic/blob/master/javascripts/theme.js#L3).

I think that links on custom field should have "external" class for consistency and convenience. Attaching a patch to fix this.

add-external-class-to-cf-link.diff Magnifier (10.7 KB) Go MAEDA, 2017-09-18 16:57

add-external-class-to-cf-link-v2.diff Magnifier (9.45 KB) Go MAEDA, 2017-11-28 17:09

Associated revisions

Revision 17138
Added by Go MAEDA 6 months ago

Links for custom field value don't have "external" class (#27024).

Patch by Go MAEDA.

History

#1 Updated by Go MAEDA 9 months ago

  • File deleted (add-external-class-to-cf-link.diff)

#2 Updated by Go MAEDA 9 months ago

Sorry, replaced the patch. The previous patch contained irrelevant codes.

#3 Updated by Toshi MARUYAMA 8 months ago

  • Target version set to 4.1.0

#4 Updated by Takenori TAKAKI 7 months ago

LGTM :)
I tested Go MAEDA's patch on the Latest trunk@17038.

#5 Updated by Go MAEDA 7 months ago

Attaching an updated patch. Fixed test failure.

Failure:
Redmine::ListFieldFormatTest#test_field_with_url_pattern_and_multiple_values_should_link_values [test/unit/lib/redmine/field_format/list_format_test.rb:141]:
--- expected
+++ actual
@@ -1 +1 @@
-"<a class=\"external\" href=\"http://localhost/bar\">bar</a>, <a href=\"http://localhost/foo\">foo</a>" 
+"<a class=\"external\" href=\"http://localhost/bar\">bar</a>, <a class=\"external\" href=\"http://localhost/foo\">foo</a>" 

bin/rails test test/unit/lib/redmine/field_format/list_format_test.rb:138

#6 Updated by Go MAEDA 6 months ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Target version changed from 4.1.0 to 4.0.0

Committed.

Also available in: Atom PDF