RE: ToDo lists plugin ยป fix-bug.diff
init.rb | ||
---|---|---|
1 | 1 |
require 'redmine' |
2 | 2 | |
3 | 3 |
# Hooks |
4 |
require 'todo_issues_hook' |
|
4 |
require_dependency 'todo_issues_hook'
|
|
5 | 5 | |
6 | 6 |
# Patches to the Redmine core |
7 | 7 |
require 'dispatcher' |
lib/todo_issues_controller_patch.rb | ||
---|---|---|
19 | 19 | |
20 | 20 |
module TodoIssuesControllerPatch |
21 | 21 |
module ClassMethods |
22 |
def show_with_todo
|
|
22 |
def set_todos
|
|
23 | 23 |
@allowed_to_edit_todos = User.current.allowed_to?(:edit_todos, @project) |
24 | 24 |
|
25 | 25 |
#find all todos that relate to this issue... but only collect the 'highest' ones, as we dont want to double render. |
... | ... | |
38 | 38 |
end |
39 | 39 |
|
40 | 40 |
@todos = @todos.to_a |
41 |
|
|
42 |
#@todos = @project.todos.roots.find(:all, :conditions => ["issue_id = ?", @issue.id]) |
|
43 |
show_without_todo |
|
44 |
end |
|
45 | 41 | |
46 |
def show_todos |
|
47 |
render :partial => 'todos', :locals => { :todos => @todos } |
|
42 |
#@todos = @project.todos.roots.find(:all, :conditions => ["issue_id = ?", @issue.id]) |
|
48 | 43 |
end |
44 |
private :set_todos |
|
49 | 45 |
end |
50 | 46 | |
51 | 47 |
def self.included(base) # :nodoc: |
... | ... | |
55 | 51 |
base.class_eval do |
56 | 52 |
unloadable # Send unloadable so it will not be unloaded in development |
57 | 53 |
helper :todos |
58 |
alias_method_chain(:show, :todo) unless method_defined?(:show_without_todo)
|
|
54 |
before_filter :set_todos
|
|
59 | 55 |
end |
60 | 56 |
end |
61 | 57 |
end |
lib/todo_issues_hook.rb | ||
---|---|---|
7 | 7 |
# Context: |
8 | 8 |
# * :issue => Current issue |
9 | 9 |
# |
10 |
def view_issues_show_description_bottom(context ={ }) |
|
11 |
controller = context[:controller] |
|
12 |
controller.show_todos |
|
13 |
end |
|
10 |
render_on :view_issues_show_description_bottom, :partial => 'todos', :locals => { :todos => @todos } |
|
14 | 11 | |
15 | 12 |
def view_layouts_base_html_head(context = {}) |
16 | 13 |
project = context[:project] |