-
Notifications
You must be signed in to change notification settings - Fork 107
/
init.rb
60 lines (49 loc) · 1.73 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
require 'redmine'
# Taken from lib/redmine.rb
if RUBY_VERSION < '1.9'
require 'faster_csv'
else
require 'csv'
FCSV = CSV
end
require 'dispatcher'
Dispatcher.to_prepare :timesheet_plugin do
require_dependency 'principal'
require_dependency 'user'
User.send(:include, TimesheetPlugin::Patches::UserPatch)
require_dependency 'project'
Project.send(:include, TimesheetPlugin::Patches::ProjectPatch)
# Needed for the compatibility check
begin
require_dependency 'time_entry_activity'
rescue LoadError
# TimeEntryActivity is not available
end
end
unless Redmine::Plugin.registered_plugins.keys.include?(:timesheet_plugin)
Redmine::Plugin.register :timesheet_plugin do
name 'Timesheet Plugin'
author 'Eric Davis of Little Stream Software'
description 'This is a Timesheet plugin for Redmine to show timelogs for all projects'
url 'https://projects.littlestreamsoftware.com/projects/redmine-timesheet'
author_url 'http://www.littlestreamsoftware.com'
version '0.6.0'
requires_redmine :version_or_higher => '0.9.0'
settings(:default => {
'list_size' => '5',
'precision' => '2',
'project_status' => 'active',
'user_status' => 'active'
}, :partial => 'settings/timesheet_settings')
permission :see_project_timesheets, { }, :require => :member
menu(:top_menu,
:timesheet,
{:controller => 'timesheet', :action => 'index'},
:caption => :timesheet_title,
:if => Proc.new {
User.current.allowed_to?(:see_project_timesheets, nil, :global => true) ||
User.current.allowed_to?(:view_time_entries, nil, :global => true) ||
User.current.admin?
})
end
end