How would I go about adding the "Spent Time" as a column to be displayed in the issues list?
A:
Since no one answered, I just poked the source until it yielded results. Then I started a blog to explain how I did it.
Joel Meador
2008-11-30 20:38:27
+5
A:
You can also do this by adding the column at runtime. This will add the spent hours column without modifying the Redmine core. Just drop the following code into a file in lib/
Adapted from:
require_dependency 'query' module QueryPatch def self.included(base) # :nodoc: base.extend(ClassMethods) # Same as typing in the class base.class_eval do unloadable # Send unloadable so it will not be unloaded in development base.add_available_column(QueryColumn.new(:spent_hours)) end end module ClassMethods unless Query.respond_to?(:available_columns=) # Setter for +available_columns+ that isn't provided by the core. def available_columns=(v) self.available_columns = (v) end end unless Query.respond_to?(:add_available_column) # Method to add a column to the +available_columns+ that isn't provided by the core. def add_available_column(column) self.available_columns
Eric Davis
2009-01-08 06:04:32
I successfully used this method last night to make sure the project shows up as a sortable column on its own.The full source code is not in this answer, just go to: http://github.com/edavis10/redmine-question-plugin/tree/master/lib/question_query_patch.rbThanks Eric and Joel.
banderson623
2009-01-09 14:45:16
Since this answer is growing old I thought I should ask before trying: Do you know if this works with Redmine 0.9.3?
Oskar
2010-06-07 15:19:15