From c6a23d00467a6880691d4fb22f084e7bec99c20f Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Thu, 10 Jul 2008 17:29:05 -0700 Subject: [PATCH] Sorting deliverables by subject in select fields. #1430 --- lib/budget_issue_hook.rb | 4 ++-- lib/query_patch.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/budget_issue_hook.rb b/lib/budget_issue_hook.rb index 7aecccf..1d50d03 100644 --- a/lib/budget_issue_hook.rb +++ b/lib/budget_issue_hook.rb @@ -24,7 +24,7 @@ class BudgetIssueHook < Redmine::Plugin::Hook::Base # def self.issue_edit(context = { }) if context[:project].module_enabled?('budget_module') - select = context[:form].select :deliverable_id, Deliverable.find_all_by_project_id(context[:project]).collect { |d| [d.subject, d.id] }, :include_blank => true + select = context[:form].select :deliverable_id, Deliverable.find_all_by_project_id(context[:project], :order => 'subject ASC').collect { |d| [d.subject, d.id] }, :include_blank => true return "

#{select}

" else return '' @@ -41,7 +41,7 @@ class BudgetIssueHook < Redmine::Plugin::Hook::Base select = help.select_tag('deliverable_id', help.content_tag('option', GLoc.l(:label_no_change_option), :value => '') + help.content_tag('option', GLoc.l(:label_none), :value => 'none') + - help.options_from_collection_for_select(Deliverable.find_all_by_project_id(context[:project].id, :id, :subject), :id, :subject)) + help.options_from_collection_for_select(Deliverable.find_all_by_project_id(context[:project].id, :order => 'subject ASC'), :id, :subject)) return help.content_tag(:p, "") else diff --git a/lib/query_patch.rb b/lib/query_patch.rb index cbdc8ed..a17271f 100644 --- a/lib/query_patch.rb +++ b/lib/query_patch.rb @@ -40,7 +40,7 @@ module QueryPatch if project budget_filters = { "deliverable_id" => { :type => :list_optional, :order => 14, - :values => Deliverable.find(:all, :conditions => ["project_id IN (?)", project]).collect { |d| [d.subject, d.id.to_s]} + :values => Deliverable.find(:all, :conditions => ["project_id IN (?)", project], :order => 'subject ASC').collect { |d| [d.subject, d.id.to_s]} }} else budget_filters = { }