From 6924b32048982dc280788967fbfa3b5c58146188 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Thu, 12 Aug 2010 10:38:48 -0700 Subject: [PATCH] [#4390] Add the Contract name as an issue column. --- app/models/deliverable.rb | 2 ++ config/locales/en.yml | 1 + init.rb | 4 ++++ lib/redmine_contracts/patches/issue_patch.rb | 1 + 4 files changed, 8 insertions(+) diff --git a/app/models/deliverable.rb b/app/models/deliverable.rb index b02f6db..7a488fc 100644 --- a/app/models/deliverable.rb +++ b/app/models/deliverable.rb @@ -20,6 +20,8 @@ class Deliverable < ActiveRecord::Base # Accessors + delegate :name, :to => :contract, :prefix => true, :allow_nil => true + def short_type '' end diff --git a/config/locales/en.yml b/config/locales/en.yml index 1078153..69cb56c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -58,3 +58,4 @@ en: text_save_contract: "Save Contract" enumeration_payment_term: "Payment Terms" field_deliverable_title: "Deliverable" + field_contract_name: "Contract" diff --git a/init.rb b/init.rb index 3f57ad5..a3ac86e 100644 --- a/init.rb +++ b/init.rb @@ -69,6 +69,10 @@ Dispatcher.to_prepare :redmine_contracts do unless Query.available_columns.collect(&:name).include?(:deliverable_title) Query.add_available_column(QueryColumn.new(:deliverable_title, :sortable => "#{Deliverable.table_name}.title")) end + + unless Query.available_columns.collect(&:name).include?(:contract_name) + Query.add_available_column(QueryColumn.new(:contract_name, :sortable => "#{Contract.table_name}.name")) + end end require 'redmine_contracts/hooks/view_layouts_base_html_head_hook' diff --git a/lib/redmine_contracts/patches/issue_patch.rb b/lib/redmine_contracts/patches/issue_patch.rb index 1b9b10c..c2d0597 100644 --- a/lib/redmine_contracts/patches/issue_patch.rb +++ b/lib/redmine_contracts/patches/issue_patch.rb @@ -10,6 +10,7 @@ module RedmineContracts belongs_to :deliverable delegate :title, :to => :deliverable, :prefix => true, :allow_nil => true + delegate :contract_name, :to => :deliverable, :allow_nil => true end end