[phase-22]Make it possible to search from redmine global search function.
This commit is contained in:
parent
c30fdae698
commit
517decb464
@ -2,9 +2,11 @@ class GlossaryTerm < ActiveRecord::Base
|
||||
belongs_to :category, class_name: 'GlossaryCategory', foreign_key: 'category_id'
|
||||
belongs_to :project
|
||||
belongs_to :author, class_name: 'User', foreign_key: 'author_id'
|
||||
belongs_to :updater, class_name: 'User', foreign_key: 'updater_id'
|
||||
|
||||
# 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_terms, edit_permission: :manage_glossary_terms,
|
||||
delete_permission: :manage_glossary_terms
|
||||
|
||||
acts_as_event datetime: :updated_at,
|
||||
description: :description,
|
||||
@ -16,9 +18,15 @@ class GlossaryTerm < ActiveRecord::Base
|
||||
project_id: o.project }
|
||||
}
|
||||
|
||||
acts_as_searchable columns: [ "#{table_name}.name", "#{table_name}.description", "#{table_name}.rubi"],
|
||||
preload: [:project ],
|
||||
date_column: "#{table_name}.created_at",
|
||||
scope: joins(:project),
|
||||
permission: :view_glossary_terms
|
||||
|
||||
acts_as_activity_provider scope: joins(:project),
|
||||
type: 'glossary_terms',
|
||||
permission: :view_glossary,
|
||||
permission: :view_glossary_terms,
|
||||
timestamp: :updated_at
|
||||
|
||||
scope :search_by_name, -> (keyword) {
|
||||
|
@ -59,5 +59,5 @@
|
||||
|
||||
<%= render partial: 'attachments/links',
|
||||
locals: {attachments: @term.attachments,
|
||||
options: {deletable: User.current.allowed_to?(:manage_glossary, @project)}
|
||||
options: {deletable: User.current.allowed_to?(:manage_glossary_terms, @project)}
|
||||
}%>
|
||||
|
@ -27,8 +27,8 @@ en:
|
||||
index_rubi: |
|
||||
|
||||
|
||||
permission_view_glossary: View glossary
|
||||
permission_manage_glossary: Manage glossary
|
||||
permission_view_glossary_terms: View glossary
|
||||
permission_manage_glossary_terms: Manage glossary
|
||||
|
||||
field_name_en: English
|
||||
field_abbr_whole: Whole word for Abbreviation
|
||||
|
@ -29,8 +29,8 @@ ja:
|
||||
わ を ん
|
||||
|
||||
|
||||
permission_view_glossary: 用語集の閲覧
|
||||
permission_manage_glossary: 用語集の管理
|
||||
permission_view_glossary_terms: 用語集の閲覧
|
||||
permission_manage_glossary_terms: 用語集の管理
|
||||
|
||||
field_name_en: 英語名
|
||||
field_abbr_whole: 略語の展開名称
|
||||
|
9
init.rb
9
init.rb
@ -1,5 +1,7 @@
|
||||
Rails.configuration.to_prepare do
|
||||
require_dependency "glossary_macros"
|
||||
Redmine::Activity.register :glossary_terms
|
||||
Redmine::Search.available_search_types << 'glossary_terms'
|
||||
end
|
||||
|
||||
Redmine::Plugin.register :redmine_glossary do
|
||||
@ -12,11 +14,11 @@ Redmine::Plugin.register :redmine_glossary do
|
||||
|
||||
|
||||
project_module :glossary do
|
||||
permission :view_glossary, {
|
||||
permission :view_glossary_terms, {
|
||||
glossary_terms: [:index, :show],
|
||||
glossary_categories: [:index, :show]
|
||||
}
|
||||
permission :manage_glossary, {
|
||||
permission :manage_glossary_terms, {
|
||||
glossary_terms: [:new, :create, :edit, :update, :destroy],
|
||||
glossary_categories: [:new, :create, :edit, :update, :destroy],
|
||||
},
|
||||
@ -30,6 +32,3 @@ Redmine::Plugin.register :redmine_glossary do
|
||||
param: :project_id
|
||||
|
||||
end
|
||||
|
||||
|
||||
Redmine::Activity.register :glossary_terms
|
||||
|
Loading…
Reference in New Issue
Block a user