-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinit.rb
50 lines (43 loc) · 1.7 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
# frozen_string_literal: true
loader = RedminePluginKit::Loader.new plugin_id: 'redmine_hedgedoc'
Redmine::Plugin.register :redmine_hedgedoc do
name 'HedgeDoc integration'
url 'https://github.com/alphanodes/redmine_hedgedoc'
description 'Redmine plugin for HedgeDoc integration'
version RedmineHedgedoc::VERSION
author 'AlphaNodes GmbH'
author_url 'https://alphanodes.com/'
begin
requires_redmine_plugin :additionals, version_or_higher: '4.0.0'
rescue Redmine::PluginNotFound
raise 'Please install additionals plugin (https://github.com/alphanodes/additionals)'
end
project_module :hedgedoc do
permission :show_hedgedoc_pads, hedgedocs: %i[show]
permission :import_hedgedoc_pads, hedgedocs: %i[import]
end
settings default: loader.default_settings,
partial: 'settings/hedgedoc'
menu :top_menu,
:hedgedoc,
{ controller: 'hedgedocs', action: 'show', project_id: nil },
caption: :label_hedgedoc_pads,
if: (proc do
User.current.allowed_to?({ controller: 'hedgedocs', action: 'show' }, nil, global: true) &&
RedmineHedgedoc.setting(:hedgedoc_in_menu) == 'top'
end)
menu :application_menu,
:hedgedoc,
{ controller: 'hedgedocs', action: 'show', project_id: nil },
caption: :label_hedgedoc_pads,
if: (proc do
User.current.allowed_to?({ controller: 'hedgedocs', action: 'show' }, nil, global: true) &&
RedmineHedgedoc.setting(:hedgedoc_in_menu) == 'app'
end)
menu :project_menu,
:hedgedocs,
{ controller: 'hedgedocs', action: 'show' },
caption: :label_hedgedoc_pads,
param: :project_id
end
RedminePluginKit::Loader.persisting { loader.load_model_hooks! }