forked from edavis10/redmine-stuff-to-do-plugin
-
Notifications
You must be signed in to change notification settings - Fork 11
/
init.rb
64 lines (54 loc) · 2.39 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
# -*- encoding: utf-8 -*-
#
require 'redmine'
# Patches to the Redmine core.
# Rails 5.1/Rails 4
reloader = defined?(ActiveSupport::Reloader) ? ActiveSupport::Reloader : ActionDispatch::Reloader
reloader.to_prepare do
require 'stuff_to_do_issue_patch'
require 'stuff_to_do_user_patch'
require 'stuff_to_do_user_preference_patch'
require 'stuff_to_do_dispatch'
end
if Rails::VERSION::MAJOR >= 5
version = "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}".to_f
PLUGIN_MIGRATION_CLASS = ActiveRecord::Migration[version]
preparation_class = ActiveSupport::Reloader
else
PLUGIN_MIGRATION_CLASS = ActiveRecord::Migration
preparation_class = ActionDispatch::Callbacks
end
# This is the important line.
# It requires the file in lib/stuff_to_do_plugin/hooks.rb
preparation_class.to_prepare do
require_dependency 'stuff_to_do_plugin/hooks'
end
Redmine::Plugin.register :stuff_to_do_plugin do
name 'Stuff To Do Plugin'
author 'Eric Davis, Steffen Schüssler'
url 'https://github.com/neffets/redmine-stuff-to-do-plugin'
author_url 'https://github.com/neffets'
description "The Stuff To Do plugin allows a user to order and prioritize the issues they are doing into a specific order. It will also allow other privilged users to reorder the user's workload. compatible redmine 3.x - 5.x"
version '0.8.0'
requires_redmine version_or_higher: '4.0.0'
settings(partial: 'settings/stuff_to_do_settings',
default: {
'use_as_stuff_to_do': '0',
'threshold_cnt': '5',
'threshold': '-1',
'email_to': '[email protected],[email protected]',
'use_time_grid': '0',
'statuses_for_stuff_to_do': ['all']
})
project_module :stuff_to_do do
permission :view_stuff_to_do, {stuff_to_do: :index}
permission :view_others_stuff_to_do, {stuff_to_do: :index}
permission :view_all_users_stuff_to_do, {stuff_to_do: :index}
permission :manage_stuff_to_do_reportees, {stuff_to_do: :index}
permission :view_all_reportee_issues, {stuff_to_do: :index }
permission :view_all_reportee_stuff_to_do, {stuff_to_do: :index }
end
menu(:top_menu, :stuff_to_do, { controller: 'stuff_to_do', action: 'index'}, caption: :stuff_to_do_title, if: Proc.new{
User.current.allowed_to?({ controller: 'stuff_to_do', action: 'index'}, nil, global: true) && !User.current.nil? && User.current.pref[:stuff_to_do_enabled]
})
end