diff --git a/app/models/glossary_term.rb b/app/models/glossary_term.rb index 88ea9b5..d5526e2 100644 --- a/app/models/glossary_term.rb +++ b/app/models/glossary_term.rb @@ -4,6 +4,21 @@ class GlossaryTerm < ActiveRecord::Base # class method from Redmine::Acts::Attachable::ClassMethods acts_as_attachable view_permission: :view_glossary, edit_permission: :manage_glossary, delete_permission: :manage_glossary + + acts_as_event datetime: :updated_at, + description: :description, + author: nil, + title: Proc.new {|o| "#{l(:glossary_title)} ##{o.id} - #{o.name}" }, + url: Proc.new {|o| { controller: 'glossary_terms', + action: 'show', + id: o.id, + project_id: o.project } + } + + acts_as_activity_provider scope: joins(:project), + type: 'glossary_terms', + permission: :view_glossary, + timestamp: :updated_at scope :search_by_name, -> (keyword) { where 'name like ?', "#{sanitize_sql_like(keyword)}%" diff --git a/init.rb b/init.rb index 3ecc3c6..5af0ee1 100644 --- a/init.rb +++ b/init.rb @@ -1,3 +1,7 @@ +#Rails.configuration.to_prepare do +# Redmine::Activity.register :glossary_terms +#end + Redmine::Plugin.register :redmine_glossary do name 'Redmine Glossary plugin' author 'Toru Takahashi' @@ -26,3 +30,6 @@ Redmine::Plugin.register :redmine_glossary do param: :project_id end + + +Redmine::Activity.register :glossary_terms