forked from JostBaron/redmine_workload
-
Notifications
You must be signed in to change notification settings - Fork 3
/
init.rb
executable file
·64 lines (56 loc) · 2.48 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
# frozen_string_literal: true
require 'redmine'
require File.expand_path('lib/redmine_workload', __dir__)
Redmine::Plugin.register :redmine_workload do
name 'Redmine workload plugin'
author 'Jost Baron, Liane Hampe, xmera Solutions GmbH'
description 'This is a plugin for Redmine, originally developed by Rafael Calleja. It ' \
'displays the estimated number of hours users and groups have to work to finish ' \
'all their assigned issus on time.'
version '3.0.2'
url 'https://github.com/xmera-circle/redmine_workload'
if RedmineWorkload.postgresql? && RUBY_VERSION <= '3.1'
msg = "#{name} requires at least Ruby 3.1.z when using postgresql database."
raise Redmine::PluginRequirementError, msg
end
menu :top_menu,
:WorkLoad,
{ controller: 'workloads', action: 'index' },
caption: :workload_title,
if: proc {
User.current.logged? && User.current.allowed_to?({ controller: :workloads, action: :index },
nil, global: true)
}
settings partial: 'settings/workload_settings',
default: {
'general_workday_monday' => 'checked',
'general_workday_tuesday' => 'checked',
'general_workday_wednesday' => 'checked',
'general_workday_thursday' => 'checked',
'general_workday_friday' => 'checked',
'general_workday_saturday' => '',
'general_workday_sunday' => '',
'threshold_lowload_min' => 0.1,
'threshold_normalload_min' => 7,
'threshold_highload_min' => 8.5,
'workload_of_parent_issues' => ''
}
permission :view_all_workloads, workloads: :index
permission :view_own_workloads, workloads: :index
permission :view_own_group_workloads, workloads: :index
permission :edit_national_holiday, wl_national_holiday: %i[create update destroy]
permission :edit_user_vacations, wl_user_vacations: %i[create update destroy]
permission :edit_user_data, wl_user_datas: :update
end
if Rails.version < '6'
plugin = Redmine::Plugin.find(:redmine_workload)
Rails.application.configure do
config.autoload_paths << "#{plugin.directory}/app/presenters"
end
end
class RedmineToolbarHookListener < Redmine::Hook::ViewListener
def view_layouts_base_html_head(_context)
javascript_include_tag('slides', plugin: :redmine_workload) +
stylesheet_link_tag('style', plugin: :redmine_workload)
end
end