[phase-13]add glossary_term to activity

This commit is contained in:
Toru Takahashi 2018-06-11 21:31:38 +09:00 committed by TAKAHASHI,Toru
parent 4acdaedb81
commit 1292a94881
2 changed files with 22 additions and 0 deletions

View File

@ -5,6 +5,21 @@ class GlossaryTerm < ActiveRecord::Base
# class method from Redmine::Acts::Attachable::ClassMethods # class method from Redmine::Acts::Attachable::ClassMethods
acts_as_attachable view_permission: :view_glossary, edit_permission: :manage_glossary, delete_permission: :manage_glossary 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) { scope :search_by_name, -> (keyword) {
where 'name like ?', "#{sanitize_sql_like(keyword)}%" where 'name like ?', "#{sanitize_sql_like(keyword)}%"
} }

View File

@ -1,3 +1,7 @@
#Rails.configuration.to_prepare do
# Redmine::Activity.register :glossary_terms
#end
Redmine::Plugin.register :redmine_glossary do Redmine::Plugin.register :redmine_glossary do
name 'Redmine Glossary plugin' name 'Redmine Glossary plugin'
author 'Toru Takahashi' author 'Toru Takahashi'
@ -26,3 +30,6 @@ Redmine::Plugin.register :redmine_glossary do
param: :project_id param: :project_id
end end
Redmine::Activity.register :glossary_terms