forked from spike008t/redmine_advanced_issues
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.rb
88 lines (65 loc) · 3.46 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Redmine advanced issues - Plugin improve time entry
# Copyright (C) 2011 Tieu-Philippe Khim
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require 'redmine'
require 'dispatcher' unless Rails::VERSION::MAJOR >= 3
if Rails::VERSION::MAJOR >= 3
::Rails.logger.info 'Starting advenced Issues Plugin for RedMine'
ActionDispatch::Callbacks.to_prepare do
# add time unit conversion
Issue.send(:include, RedmineAdvancedIssues::Patches::IssuePatch) unless Issue.included_modules.include? RedmineAdvancedIssues::Patches::IssuePatch
TimeEntry.send(:include, RedmineAdvancedIssues::Patches::TimeEntryPatch) unless TimeEntry.included_modules.include? RedmineAdvancedIssues::Patches::TimeEntryPatch
# add spent time column
Query.send(:include, RedmineAdvancedIssues::Patches::QueryPatch) unless Query.include?(RedmineAdvancedIssues::Patches::QueryPatch)
QueriesHelper.send(:include, RedmineAdvancedIssues::Patches::QueriesHelperPatch) unless QueriesHelper.include?(RedmineAdvancedIssues::Patches::QueriesHelperPatch)
end #ActionDispatch
else #Rails::VERSION
RAILS_DEFAULT_LOGGER.info 'Starting advenced Issues Plugin for RedMine'
Dispatcher.to_prepare do
# add time unit conversion
Issue.send(:include, RedmineAdvancedIssues::Patches::IssuePatch) unless Issue.included_modules.include? RedmineAdvancedIssues::Patches::IssuePatch
TimeEntry.send(:include, RedmineAdvancedIssues::Patches::TimeEntryPatch) unless TimeEntry.included_modules.include? RedmineAdvancedIssues::Patches::TimeEntryPatch
# add spent time column
Query.send(:include, RedmineAdvancedIssues::Patches::QueryPatch) unless Query.include?(RedmineAdvancedIssues::Patches::QueryPatch)
QueriesHelper.send(:include, RedmineAdvancedIssues::Patches::QueriesHelperPatch) unless QueriesHelper.include?(RedmineAdvancedIssues::Patches::QueriesHelperPatch)
end #Dispatcher
end #Rails::VERSION
Redmine::Plugin.register :redmine_advanced_issues do
name 'Redmine Advanced Issues plugin'
author 'Tieu-Philippe KHIM'
description '
This is a plugin for Redmine, that add some advanced stuffs.
Spent time columns, unit time customize
'
version '0.0.5'
url 'http://blog.spikie.info/'
author_url 'http://blog.spikie.info'
# Minimum version of Redmine.
requires_redmine :version_or_higher => '0.9.0'
settings(:default => {
'hours_in_day' => '7.4',
'char_for_day' => 'd',
'days_in_week' => '5',
'char_for_week' => 'w',
'weeks_in_month' => '4',
'char_for_month' => 'm',
'months_in_year' => '12',
'char_for_year' => 'y',
'default_unit' => 'hours',
}, :partial => 'settings/advanced_issues_settings')
end
require 'hooks/controller_issues_edit_before_save_hook'
require 'hooks/controller_timelog_edit_before_save_hook'