-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathinit.rb
127 lines (124 loc) · 4.65 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
## SNIP - Filters
$mc_filters = {}
$mc_filters['assignee'] = {
:type => 'lookup',
:label => 'field_assigned_to',
:db_field => 'issues.assigned_to_id',
:db_field_holiday => 'holidays.user_id',
:lookup_id => 'id',
:operators => [:contains, :not_contains],
:lookup_value => 'name',
:lookup_query_model => 'Holiday',
:lookup_query_method => 'get_activated_users',
:lookup_query_order => nil,
:condition => nil,
:condition_holiday => nil
}
$mc_filters['assignee_group'] = {
:type => 'lookup',
:label => 'label_group',
:db_field => 'issues.assigned_to_id',
:db_field_holiday => 'holidays.user_id',
:lookup_id => 'id',
:operators => [:contains, :not_contains],
:lookup_value => 'lastname',
:lookup_query_model => 'Holiday',
:lookup_query_method => 'get_activated_groups',
:lookup_query_order => nil,
:condition => '##FIELD_ID## IN (SELECT user_id FROM groups_users WHERE group_id ##OPERATOR## (?)) OR ##FIELD_ID## ##OPERATOR## (?)',
:condition_holiday => '##FIELD_ID## IN (SELECT user_id FROM groups_users WHERE group_id ##OPERATOR## (?))'
}
$mc_filters['status'] = {
:type => 'lookup',
:label => 'label_issue_status',
:db_field => 'issues.status_id',
:lookup_id => 'id',
:operators => [:contains, :not_contains],
:lookup_value => 'name',
:lookup_query_model => 'IssueStatus',
:lookup_query_method => 'all',
:lookup_query_order => "issue_statuses.name ASC",
:condition => nil,
:condition_holiday => nil
}
$mc_filters['project'] = {
:type => 'lookup',
:label => 'label_project',
:db_field => 'issues.project_id',
:lookup_id => 'id',
:operators => [:contains, :not_contains],
:lookup_value => 'name',
:lookup_query_model => 'Project',
:lookup_query_method => 'all',
:lookup_query_order => "projects.name ASC",
:condition => nil,
:condition_holiday => nil
}
$mc_filters['tracker'] = {
:type => 'lookup',
:label => 'label_tracker',
:db_field => 'issues.tracker_id',
:lookup_id => 'id',
:operators => [:contains, :not_contains],
:lookup_value => 'name',
:lookup_query_model => 'Tracker',
:lookup_query_method => 'all',
:lookup_query_order => "trackers.name ASC",
:condition => nil,
:condition_holiday => nil
}
$mc_filters['priority'] = {
:type => 'lookup',
:label => 'field_priority',
:db_field => 'issues.priority_id',
:lookup_id => 'id',
:operators => [:contains, :not_contains],
:lookup_value => 'name',
:lookup_query_model => 'IssuePriority',
:lookup_query_method => 'all',
:lookup_query_order => nil,
:condition => nil,
:condition_holiday => nil
}
$mc_filters['version'] = {
:type => 'lookup',
:label => 'field_version',
:db_field => 'issues.fixed_version_id',
:lookup_id => 'id',
:operators => [:contains, :not_contains],
:lookup_value => 'name',
:lookup_query_model => 'Version',
:lookup_query_method => 'all',
:lookup_query_order => "versions.name ASC",
:condition => nil,
:condition_holiday => nil
}
## SNAP - Filters
require 'vpim'
require_dependency Rails.root.join('plugins','mega_calendar','lib','mega_calendar','users_controller_patch')
require_dependency Rails.root.join('plugins','mega_calendar','lib','mega_calendar','issues_controller_patch')
Redmine::Plugin.register :mega_calendar do
name 'Mega Calendar plugin'
author 'Andreas Treubert'
description 'Better calendar for redmine'
version '2.0.0'
url 'https://github.com/berti92/mega_calendar'
author_url 'https://github.com/berti92'
requires_redmine :version_or_higher => '5.1.1'
menu(:top_menu, :calendar, { :controller => 'calendar', :action => 'index' }, :caption => :calendar, :if => Proc.new {(!Setting.plugin_mega_calendar['allowed_users'].blank? && Setting.plugin_mega_calendar['allowed_users'].include?(User.current.id.to_s) ? true : false)})
menu(:top_menu, :holidays, { :controller => 'holidays', :action => 'index' }, :caption => :holidays, :if => Proc.new {(!Setting.plugin_mega_calendar['allowed_users'].blank? && Setting.plugin_mega_calendar['allowed_users'].include?(User.current.id.to_s) ? true : false)})
settings :default => {
'display_empty_dates' => 0,
'displayed_type' => 'users',
'displayed_users' => User.where(["users.login IS NOT NULL AND users.login <> ''"]).collect {|x| x.id.to_s},
'default_holiday_color' => 'D59235',
'default_holiday_text_color' => '000000',
'default_event_color' => '4F90FF',
'default_event_text_color' => '000000',
'sub_path' => '/',
'week_start' => '1',
'allowed_users' => User.where(["users.login IS NOT NULL AND users.login <> ''"]).collect {|x| x.id.to_s}
}, :partial => 'settings/mega_calendar_settings'
end
UsersController.prepend(MegaCalendar::UsersControllerPatch)
IssuesController.prepend(MegaCalendar::IssuesControllerPatch)