-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathinit.rb
47 lines (35 loc) · 1.48 KB
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require 'redmine'
Dir[File.join(directory,'vendor','plugins','*')].each do |dir|
path = File.join(dir, 'lib')
$LOAD_PATH << path
ActiveSupport::Dependencies.load_paths << path
ActiveSupport::Dependencies.load_once_paths.delete(path)
end
# Patches to the Redmine core.
require 'dispatcher'
Dispatcher.to_prepare :redmine_blogs do
require_dependency 'comment'
Comment.send(:include, RedmineBlogs::Patches::CommentPatch)
require_dependency 'application_controller'
ApplicationController.send(:include, RedmineBlogs::Patches::ApplicationControllerPatch)
require_dependency 'acts_as_taggable'
end
Redmine::Plugin.register :redmine_blogs do
name 'Redmine Blogs plugin'
author 'A. Chaika, Kyanh, Eric Davis'
description 'Redmine Blog plugin'
version '0.2.0-edavis10'
permission :manage_blogs, :blogs => [:new, :edit, :destroy_comment, :destroy]
permission :comment_blogs, :blogs => :add_comment
permission :view_blogs, :blogs => [:index, :show]
menu :top_menu, :blogs, { :controller => 'blogs', :action => 'index' }, :caption => 'Blogs', :if => Proc.new {
User.current.allowed_to?({:controller => 'blogs', :action => 'index'}, nil, {:global => true})
}
end
Redmine::Activity.map do |activity|
activity.register :blogs
end
class RedmineBlogsHookListener < Redmine::Hook::ViewListener
render_on :view_layouts_base_html_head, :inline => "<%= stylesheet_link_tag 'stylesheet', :plugin => 'redmine_blogs' %>"
end
require 'redmine_blogs/hooks/view_account_left_middle_hook'