Project

General

Profile

RE: ToDo lists plugin ยป fix-bug.diff

Rodrigo Rosenfeld Rosas, 2010-03-30 22:35

View differences:

init.rb
require 'redmine'
# Hooks
require 'todo_issues_hook'
require_dependency 'todo_issues_hook'
# Patches to the Redmine core
require 'dispatcher'
lib/todo_issues_controller_patch.rb
module TodoIssuesControllerPatch
module ClassMethods
def show_with_todo
def set_todos
@allowed_to_edit_todos = User.current.allowed_to?(:edit_todos, @project)
#find all todos that relate to this issue... but only collect the 'highest' ones, as we dont want to double render.
......
end
@todos = @todos.to_a
#@todos = @project.todos.roots.find(:all, :conditions => ["issue_id = ?", @issue.id])
show_without_todo
end
def show_todos
render :partial => 'todos', :locals => { :todos => @todos }
#@todos = @project.todos.roots.find(:all, :conditions => ["issue_id = ?", @issue.id])
end
private :set_todos
end
def self.included(base) # :nodoc:
......
base.class_eval do
unloadable # Send unloadable so it will not be unloaded in development
helper :todos
alias_method_chain(:show, :todo) unless method_defined?(:show_without_todo)
before_filter :set_todos
end
end
end
lib/todo_issues_hook.rb
# Context:
# * :issue => Current issue
#
def view_issues_show_description_bottom(context ={ })
controller = context[:controller]
controller.show_todos
end
render_on :view_issues_show_description_bottom, :partial => 'todos', :locals => { :todos => @todos }
def view_layouts_base_html_head(context = {})
project = context[:project]
    (1-1/1)