Fully hooked the Deliverable columns into the filters and Queries
* The Deliverable subject can now be filtered on the issues list * The Deliverable subject can now be displayed on the issues lists with as a default column or part of a saved query * The issues can be sorted by the deliverable #1148
This commit is contained in:
1
init.rb
1
init.rb
@@ -1,6 +1,7 @@
|
||||
require 'redmine'
|
||||
|
||||
# Patches to the Redmine core. Will not work in development mode
|
||||
require_dependency 'issue_patch'
|
||||
require_dependency 'query_patch'
|
||||
|
||||
RAILS_DEFAULT_LOGGER.info 'Starting Budget plugin for RedMine'
|
||||
|
||||
@@ -8,3 +8,4 @@ field_fixed_cost: Fixed Bid
|
||||
field_project_manager_signoff: Project Manager Signoff
|
||||
field_client_signoff: Client Signoff
|
||||
field_deliverable: Deliverable
|
||||
field_deliverable_subject: Deliverable
|
||||
|
||||
50
lib/issue_patch.rb
Normal file
50
lib/issue_patch.rb
Normal file
@@ -0,0 +1,50 @@
|
||||
require_dependency 'issue'
|
||||
|
||||
module IssuePatch
|
||||
def self.included(base)
|
||||
base.extend(ClassMethods)
|
||||
|
||||
base.send(:include, InstanceMethods)
|
||||
|
||||
# Same as typing in the class
|
||||
base.class_eval do
|
||||
unloadable # Send unloadable so it will not be unloaded in development
|
||||
belongs_to :deliverable
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
|
||||
# Muck with the find arguements to append an include for deliverables
|
||||
def find(*args)
|
||||
# Options defined
|
||||
if args[1].is_a?(Hash)
|
||||
# include used?
|
||||
if args[1].has_key?(:include)
|
||||
# Add our include
|
||||
args[1][:include] << :deliverable
|
||||
else
|
||||
# Add an include
|
||||
args[1][:include] = [:deliverable]
|
||||
end
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
module InstanceMethods
|
||||
def deliverable_subject
|
||||
unless self.deliverable.nil?
|
||||
return self.deliverable.subject
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Add module to Issue
|
||||
Issue.send(:include, IssuePatch)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ module QueryPatch
|
||||
# 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(:deliverable, :sortable => "#{Deliverable.table_name}.name"))
|
||||
base.add_available_column(QueryColumn.new(:deliverable_subject, :sortable => "#{Deliverable.table_name}.subject"))
|
||||
|
||||
alias_method :redmine_available_filters, :available_filters
|
||||
alias_method :available_filters, :budget_available_filters
|
||||
|
||||
Reference in New Issue
Block a user