-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathafter_init.rb
73 lines (62 loc) · 2.29 KB
/
after_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
lib_dir = File.join(File.dirname(__FILE__), 'lib', 'easy_gantt_pro')
# Redmine patches
patch_path = File.join(lib_dir, '*_patch.rb')
Dir.glob(patch_path).each do |file|
require file
end
require lib_dir
require File.join(lib_dir, 'hooks')
Redmine::MenuManager.map :easy_gantt_tools do |menu|
menu.delete(:add_task)
menu.delete(:critical)
menu.delete(:baseline)
menu.push(:baseline, 'javascript:void(0)',
param: :project_id,
caption: :'easy_gantt.button.create_baseline',
html: { icon: 'icon-projects' },
if: proc { |project|
project.present? &&
Redmine::Plugin.installed?(:easy_baseline) &&
project.module_enabled?('easy_baselines') &&
User.current.allowed_to?(:view_baselines, project)
},
after: :tool_panel)
menu.push(:critical, 'javascript:void(0)',
param: :project_id,
caption: :'easy_gantt.button.critical_path',
html: { icon: 'icon-summary' },
if: proc { |p| p.present? && Setting.plugin_easy_gantt['critical_path'] != 'disabled' },
after: :tool_panel)
menu.push(:add_task, 'javascript:void(0)',
param: :project_id,
caption: :label_new,
html: { icon: 'icon-add' },
if: proc { |project|
project.present? &&
User.current.allowed_to?(:edit_easy_gantt, project) &&
(User.current.allowed_to?(:add_issues, project) ||
User.current.allowed_to?(:manage_versions, project))
},
after: :tool_panel)
menu.push(:ggrm, 'javascript:void(0)',
caption: :'easy_gantt_pro.resources.label_resources',
html: { icon: 'icon-stats' },
if: proc { |project|
project.nil? && Redmine::Plugin.installed?(:easy_gantt_resources)
})
menu.push(:delayed_project_filter, 'javascript:void(0)',
caption: :'easy_gantt.button.delayed_project_filter',
html: { icon: 'icon-filter' },
if: proc {
Setting.plugin_easy_gantt['show_project_progress'] == '1'
})
menu.push(:delayed_issue_filter, 'javascript:void(0)',
caption: :'easy_gantt.button.delayed_issue_filter',
html: { icon: 'icon-filter' })
menu.push(:show_lowest_progress_tasks, 'javascript:void(0)',
caption: :'easy_gantt.button.show_lowest_progress_tasks',
html: { icon: 'icon-warning' },
if: proc { |project|
project.nil? && Setting.plugin_easy_gantt['show_lowest_progress_tasks'] == '1'
})
end