forked from syntacticvexation/redmine_favourite_projects
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.rb
executable file
·77 lines (61 loc) · 2.79 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
require 'redmine'
# Including dispatcher.rb in case of Rails 2.x
require 'dispatcher' unless Rails::VERSION::MAJOR >= 3
if Rails::VERSION::MAJOR >= 3
RedmineApp::Application.config.after_initialize do
require_dependency 'application_helper'
require_dependency 'favourite_projects_searchbox_hook_listener'
unless Project.included_modules.include?(FavouriteProjectsProjectPatch)
Project.send(:include, FavouriteProjectsProjectPatch)
end
unless User.included_modules.include?(FavouriteProjectsUserPatch)
User.send(:include, FavouriteProjectsUserPatch)
end
unless ApplicationHelper.included_modules.include?(FavouriteProjectsApplicationHelperPatch)
ApplicationHelper.send(:include, FavouriteProjectsApplicationHelperPatch)
end
unless MyHelper.included_modules.include?(FavouriteProjectsMyHelperPatch)
MyHelper.send(:include, FavouriteProjectsMyHelperPatch)
end
unless Redmine::MenuManager::MenuHelper.included_modules.include?(FavouriteProjectsMenuPatch)
Redmine::MenuManager::MenuHelper.send(:include, FavouriteProjectsMenuPatch)
end
end
else
Dispatcher.to_prepare :redmine_favourite_projects do
require_dependency 'application_helper'
unless Project.included_modules.include?(FavouriteProjectsProjectPatch)
Project.send(:include, FavouriteProjectsProjectPatch)
end
unless User.included_modules.include?(FavouriteProjectsUserPatch)
User.send(:include, FavouriteProjectsUserPatch)
end
unless ApplicationHelper.included_modules.include?(FavouriteProjectsApplicationHelperPatch)
ApplicationHelper.send(:include, FavouriteProjectsApplicationHelperPatch)
end
unless MyHelper.included_modules.include?(FavouriteProjectsMyHelperPatch)
MyHelper.send(:include, FavouriteProjectsMyHelperPatch)
end
unless Redmine::MenuManager::MenuHelper.included_modules.include?(FavouriteProjectsMenuPatch)
Redmine::MenuManager::MenuHelper.send(:include, FavouriteProjectsMenuPatch)
end
end
end
Redmine::Plugin.register :redmine_favourite_projects do
name 'Redmine Favourite Projects plugin'
author 'Syntactic Vexation'
description 'This is a plugin for Redmine to provide a list of favourite projects on My Page, Top Menu or Project Jumplist'
version '0.9.1'
url 'https://github.com/syntacticvexation/redmine_favourite_projects'
settings :default => {
'showDetailedProjectView' => true,
'modifyProjectJumpList' => false,
'modifyTopMenu' => false,
'allowUserOverride' => true
},
:partial => 'redmine_favourite_projects'
end
# initialize hook
class FavouritesEditHook < Redmine::Hook::ViewListener
render_on :view_my_account_contextual, :inline => "| <%= link_to(l('favourite_projects_box'), { :controller => 'favourite_projects', :action => 'index' }) %>"
end