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

Including article content in the search


In the search we previously executed, there were two issue items returned as well as one knowledgebase article. When the search results were rendered, the issue items contained description text with highlighted matches, but our article didn't.

When we first set up acts_as_event, the :description field was mapped to the article's summary field. As this field is optional in our plugin and may not always be populated, we want to change this to something that will be present in all articles we'll be searching.

In order to do this, the implementation of acts_as_event needs to be updated with a new description mapping of :description to :content.

class KbArticle < ActiveRecord::Base
  # ... 
  acts_as_event 
    :datetime    => :updated_at,
    :description => :content,
    :title => Proc.new { |o| "#{l(:label_title_articles)} ##{o.id}- #{o.title}" },
    :url   => Proc.new { |o| { :controller => 'articles', 
                             ...