forked from dalyons/redmine-todos-scrum-plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.rb
77 lines (53 loc) · 2.17 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
require 'redmine'
# Hooks
require 'todo_issues_hook'
# Patches to the Redmine core
require 'dispatcher'
Dispatcher.to_prepare do
require_dependency 'project'
require_dependency 'user'
#application.rb changed names between rails verisons - hack for backwards compatibility
begin
require_dependency 'application_controller'
rescue MissingSourceFile
require_dependency 'application'
end
#This file loads some associations into the core redmine classes, like associations to todos.
require 'patch_redmine_classes'
require 'todo_issues_controller_patch'
# Add module to Project.
Project.send(:include, TodosProjectPatch)
# Add module to User, once.
User.send(:include, TodosUserPatch)
IssuesController.send(:include, TodoIssuesControllerPatch)
end
Redmine::Plugin.register :redmine_todos_plugin do
name 'Redmine Todo Lists plugin'
author 'David Lyons'
description 'A plugin to create and manage agile-esque todo lists on a per project basis.'
version '0.0.3.9'
settings :default => {
'todos_auto_complete_parent' => false
}, :partial => 'settings/settings'
project_module :todo_lists do
permission :view_todos, {:todos => [:index, :show] }
permission :edit_todos,
{:todos => [:create, :destroy, :new, :toggle_complete, :sort, :edit, :update],
:issues => [:create, :destroy, :new, :toggle_complete, :sort, :edit, :update]}
permission :use_personal_todos,
{:mytodos => [:index,:destroy, :new, :create, :toggle_complete, :index, :sort, :edit, :update]}
end
menu :top_menu, :mytodos, { :controller => 'mytodos', :action => 'index' },
:caption => :my_todos_title,
:if => Proc.new {
User.current.allowed_to?(:use_personal_todos, nil, :global => true)
}
menu :project_menu, :todos, {:controller => 'todos', :action => 'index'},
:caption => :label_todo_plural, :after => :new_issue, :param => :project_id
activity_provider :todos, :default => false
end
#fix required to make the plugin work in devel mode with rails 2.2
# as per http://www.ruby-forum.com/topic/171629
load_paths.each do |path|
ActiveSupport::Dependencies.load_once_paths.delete(path)
end