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

Commit

Permalink
add: markdown link format support
Browse files Browse the repository at this point in the history
  • Loading branch information
annikoff committed Aug 29, 2016
1 parent bf89de0 commit ffcf9e3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ self.parent_id == 2
'%{cf_4}'
```

```ruby
# If format of Custom Field is Link
"/projects/#{self.project_id.to_s}/issues/new?issue[subject]=Review+request+[##{self.id.to_s} #{self.subject}]&issue[tracker_id]=3"
```

```ruby
# If format of Custom Field is Link, and you need to set up a specific link caption
"'Click here for more details':/projects/#{project.try(:identifier)}/wiki"
```

To write formulas this documentation can be helpful:
- [Issue](http://www.rubydoc.info/github/edavis10/redmine/Issue)
- [Project](http://www.rubydoc.info/github/edavis10/redmine/Project)
Expand Down
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
author 'Yakov Annikov'
url 'https://github.com/annikoff/redmine_plugin_computed_custom_field'
description ''
version '0.0.6'
version '0.0.7'
settings :default => {}
end

Expand Down
7 changes: 6 additions & 1 deletion lib/patches/field_format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ def formatted_value(view, custom_field, value, customized=nil, html=false)
ApplicationController.helpers.progress_bar(value.to_i, :width => '80px',
:legend => "#{value.to_i}%", :class => 'progress')
when custom_field.output_format == 'link'
view.link_to value, value
match = value.match(/['"](.+?)['"]:(.+)/)
if match
view.link_to match[1], match[2]
else
view.link_to value, value
end
else
value.to_s
end
Expand Down

0 comments on commit ffcf9e3

Please sign in to comment.