Book Image

Redmine Plugin Extension and Development

By : Alex Bevilacqua
Book Image

Redmine Plugin Extension and Development

By: Alex Bevilacqua

Overview of this book

Table of Contents (16 chapters)
Redmine Plugin Extension and Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Customizing activity entries


The acts_as_event plugin mentioned previously is being used to provide a consistent representation of our data across multiple models by defining common elements.

The ability to provide Proc as a parameter in most fields (see Chapter 5, Making Models Searchable) means that we can include executable code within our declaration.

In the sample provided earlier in this chapter, we listed article titles as a combination of their ID value as well as their title:

acts_as_event :title => Proc.new { |o| "#{l(:label_title_articles)} ##{o.id} - #{o.title}" }

We're already using a procedure in order to build the link title, so we can take this even further and append additional information.

In the following example, we'll attach the article tag list to the article title:

  acts_as_event :title => Proc.new { |o| tags = (o.tag_list.blank?) ? nil : "[#{o.tag_list.join(', ')}]"; "#{l(:label_title_articles)} ##{o.id} - #{o.title} #{tags}" }

The link to the article in the activity...