Skip to content
This repository was archived by the owner on Apr 13, 2021. It is now read-only.

Commit ffcf9e3

Browse files
committed
add: markdown link format support
1 parent bf89de0 commit ffcf9e3

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ self.parent_id == 2
5959
'%{cf_4}'
6060
```
6161

62+
```ruby
63+
# If format of Custom Field is Link
64+
"/projects/#{self.project_id.to_s}/issues/new?issue[subject]=Review+request+[##{self.id.to_s} #{self.subject}]&issue[tracker_id]=3"
65+
```
66+
67+
```ruby
68+
# If format of Custom Field is Link, and you need to set up a specific link caption
69+
"'Click here for more details':/projects/#{project.try(:identifier)}/wiki"
70+
```
71+
6272
To write formulas this documentation can be helpful:
6373
- [Issue](http://www.rubydoc.info/github/edavis10/redmine/Issue)
6474
- [Project](http://www.rubydoc.info/github/edavis10/redmine/Project)

init.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
author 'Yakov Annikov'
44
url 'https://github.com/annikoff/redmine_plugin_computed_custom_field'
55
description ''
6-
version '0.0.6'
6+
version '0.0.7'
77
settings :default => {}
88
end
99

lib/patches/field_format.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,12 @@ def formatted_value(view, custom_field, value, customized=nil, html=false)
103103
ApplicationController.helpers.progress_bar(value.to_i, :width => '80px',
104104
:legend => "#{value.to_i}%", :class => 'progress')
105105
when custom_field.output_format == 'link'
106-
view.link_to value, value
106+
match = value.match(/['"](.+?)['"]:(.+)/)
107+
if match
108+
view.link_to match[1], match[2]
109+
else
110+
view.link_to value, value
111+
end
107112
else
108113
value.to_s
109114
end

0 commit comments

Comments
 (0)