forked from alphanodes/additionals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.rb
66 lines (54 loc) · 2.27 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
# frozen_string_literal: true
require 'additionals/plugin_version'
loader = RedminePluginKit::Loader.new plugin_id: 'additionals'
Redmine::Plugin.register :additionals do
name 'Additionals'
author 'AlphaNodes GmbH'
description 'Customizing Redmine, providing dashboards, wiki macros and other functions for better usability.' \
' As well as acting as a library/function provider for other Redmine plugins'
version Additionals::PluginVersion::VERSION
author_url 'https://alphanodes.com/'
url 'https://github.com/alphanodes/additionals'
directory __dir__
settings default: loader.default_settings,
partial: 'additionals/settings/additionals'
permission :show_hidden_roles_in_memberbox, {}
permission :set_system_dashboards,
{},
require: :loggedin,
read: true
permission :share_dashboards,
{ dashboards: %i[index new create edit update destroy] },
require: :member,
read: true
permission :save_dashboards,
{ dashboards: %i[index new create edit update destroy] },
require: :loggedin,
read: true
project_module :issue_tracking do
permission :edit_closed_issues, {}
permission :edit_issue_author, {}
permission :change_new_issue_author, {}
permission :issue_timelog_never_required, {}
end
project_module :time_tracking do
permission :log_time_on_closed_issues, {}
end
# required redmine version
requires_redmine version_or_higher: '5.0'
menu :admin_menu, :additionals, { controller: 'settings', action: 'plugin', id: 'additionals' }, caption: :label_additionals
end
RedminePluginKit::Loader.persisting do
Redmine::AccessControl.include Additionals::Patches::AccessControlPatch
Redmine::AccessControl.singleton_class.prepend Additionals::Patches::AccessControlClassPatch
# Hooks
loader.load_model_hooks!
end
RedminePluginKit::Loader.after_initialize do
unless defined? FONTAWESOME_ICONS
# @TODO: this should be moved to AdditionalsFontAwesome and use an instance of it
FONTAWESOME_ICONS = { fab: AdditionalsFontAwesome.load_icons(:fab),
far: AdditionalsFontAwesome.load_icons(:far),
fas: AdditionalsFontAwesome.load_icons(:fas) }.freeze
end
end