forked from drakontia/redmine_charts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.rb
50 lines (38 loc) · 1.64 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
48
49
50
require 'redmine'
require 'redmine_charts'
if Rails::VERSION::MAJOR < 3
RAILS_DEFAULT_LOGGER.info 'Starting Charts Plugin for RedMine'
require 'dispatcher'
object_to_prepare = Dispatcher
else
Rails.logger.info 'Starting Charts Plugin for RedMine'
object_to_prepare = Rails.configuration
# if redmine plugins were railties:
# object_to_prepare = config
end
object_to_prepare.to_prepare do
require_dependency 'issue'
require_dependency 'time_entry'
unless Issue.included_modules.include? RedmineCharts::IssuePatch
Issue.send(:include, RedmineCharts::IssuePatch)
end
unless TimeEntry.included_modules.include? RedmineCharts::TimeEntryPatch
TimeEntry.send(:include, RedmineCharts::TimeEntryPatch)
end
end
Redmine::Plugin.register :redmine_charts do
name 'Redmine Charts'
author 'Daisuke Miura'
description 'Plugin for Redmine which integrates some nice project charts.'
url 'http://github.com/drakontia/redmine_charts/'
version File.read(File.dirname(__FILE__) + '/VERSION').strip
# Minimum version of Redmine.
requires_redmine :version_or_higher => '1.4.0'
# Configuring permissions for plugin's controllers.
project_module :charts do
permission :view_charts, RedmineCharts::Utils.controllers_for_permissions, :require => :member
permission :save_charts, {:charts_saved_condition => [:create, :edit, :destroy]}, :require => :member
end
# Creating menu entry. It appears in project menu, after 'new_issue' entry.
menu :project_menu, :charts, { :controller => RedmineCharts::Utils.default_controller, :action => 'index' }, :caption => :charts_menu_label, :after => :new_issue, :param => :project_id
end