Sorting deliverables by subject in select fields. #1430

This commit is contained in:
Eric Davis committed 2008-07-10 17:29:05 -07:00
1 parent ac2ba0ec41
commit c6a23d0046
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -24,7 +24,7 @@ class BudgetIssueHook < Redmine::Plugin::Hook::Base
# #
def self.issue_edit(context = { }) def self.issue_edit(context = { })
if context[:project].module_enabled?('budget_module') 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 "<p>#{select}</p>" return "<p>#{select}</p>"
else else
return '' return ''
@@ -41,7 +41,7 @@ class BudgetIssueHook < Redmine::Plugin::Hook::Base
select = help.select_tag('deliverable_id', select = help.select_tag('deliverable_id',
help.content_tag('option', GLoc.l(:label_no_change_option), :value => '') + help.content_tag('option', GLoc.l(:label_no_change_option), :value => '') +
help.content_tag('option', GLoc.l(:label_none), :value => 'none') + 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, "<label>#{GLoc.l(:field_deliverable)}: " + select + "</label>") return help.content_tag(:p, "<label>#{GLoc.l(:field_deliverable)}: " + select + "</label>")
else else
+1 -1
View File
@@ -40,7 +40,7 @@ module QueryPatch
if project if project
budget_filters = { "deliverable_id" => { :type => :list_optional, :order => 14, 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 else
budget_filters = { } budget_filters = { }