Link to an issue with status & summary from wiki syntax?
Added by cpctc X over 15 years ago
I am familiar with the syntax #123 to link to an issue.
Is there any wiki syntax that would let me extract fields from the issue? For example:
- "#123" : "#123.Project" - "#123.Subject" / "#123.Status"
to get:
- #123 : Redmine - The subject field contents / Closed
Then what I really want is to have a shortcut like "#123.BRIEF" or "##123" expand to those four fields.
Is any of this in Redmine already?
Could wiki formatting like this be implemented via a plugin? ... if so, can anyone point me towards any plugin which demonstrates new custom wiki formatting?
Thanks.
Replies (4)
RE: Link to an issue with status & summary from wiki syntax? - Added by Andrew Chaika over 15 years ago
You can easily implement this as wiki macros, for example {{IssueDetails(<issue_id>)}} within a simple plugin.
init.rb:
require 'redmine'
Redmine::WikiFormatting::Macros.register do
desc "Issue Description Macro"
macro :IssueDetails do |obj, args|
args, options = extract_macro_options(args, :parent)
if args.size == 1
issue = Issue.find args.first
"#{issue.id} - #{issue.project} - #{issue.subject} / #{issue.status}"
else
raise 'No or bad arguments.'
end
end
end
RE: Link to an issue with status & summary from wiki syntax? - Added by Andrew Chaika over 15 years ago
Or even:
require 'redmine'
Redmine::WikiFormatting::Macros.register do
desc "Issues List Description Macro"
macro :IssuesList do |obj, args|
args, options = extract_macro_options(args, :parent)
if args.size >= 1
Issue.find(args).collect{|issue| link_to_issue(issue) + ": #{issue.project} - #{issue.subject} / #{issue.status}" } * "<br>"
else
raise 'No or bad arguments.'
end
end
end
RE: Link to an issue with status & summary from wiki syntax? - Added by cpctc X over 15 years ago
Thank you! That is the perfect example code. Now I just need to know where to put it...
From other posts, it looks like I need to make a subdirectory like: REDMINE/lib/plugins/issue_description_macro, then put init.rb in there?
.. do I need to restart my mongerels or anything to make it start showing up?
RE: Link to an issue with status & summary from wiki syntax? - Added by Andrew Chaika over 15 years ago
cpctc X wrote:
From other posts, it looks like I need to make a subdirectory like: REDMINE/lib/plugins/issue_description_macro, then put init.rb in there?
.. do I need to restart my mongerels or anything to make it start showing up?
Just create directory in redmine/vendor/plugins, put there init.rb and restart mongrel of course.
I have attached test code that works well on my Redmine instance
issue_macros.zip (535 Bytes) issue_macros.zip |