From 54ff294da164d9c8a0659610019f801ae4788068 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 5 Feb 2008 17:28:02 +0000 Subject: More appropriate default sort order on sortable columns. Sortable column added on issue subject (#580). git-svn-id: http://redmine.rubyforge.org/svn/trunk@1121 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/query.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'app/models') diff --git a/app/models/query.rb b/app/models/query.rb index 7127a464f..a4103c08a 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -16,12 +16,13 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class QueryColumn - attr_accessor :name, :sortable + attr_accessor :name, :sortable, :default_order include GLoc def initialize(name, options={}) self.name = name self.sortable = options[:sortable] + self.default_order = options[:default_order] end def caption @@ -94,18 +95,18 @@ class Query < ActiveRecord::Base @@available_columns = [ QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position"), QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position"), - QueryColumn.new(:priority, :sortable => "#{Enumeration.table_name}.position"), - QueryColumn.new(:subject), + QueryColumn.new(:priority, :sortable => "#{Enumeration.table_name}.position", :default_order => 'desc'), + QueryColumn.new(:subject, :sortable => "#{Issue.table_name}.subject"), QueryColumn.new(:author), QueryColumn.new(:assigned_to, :sortable => "#{User.table_name}.lastname"), - QueryColumn.new(:updated_on, :sortable => "#{Issue.table_name}.updated_on"), + QueryColumn.new(:updated_on, :sortable => "#{Issue.table_name}.updated_on", :default_order => 'desc'), QueryColumn.new(:category, :sortable => "#{IssueCategory.table_name}.name"), QueryColumn.new(:fixed_version), QueryColumn.new(:start_date, :sortable => "#{Issue.table_name}.start_date"), QueryColumn.new(:due_date, :sortable => "#{Issue.table_name}.due_date"), QueryColumn.new(:estimated_hours, :sortable => "#{Issue.table_name}.estimated_hours"), QueryColumn.new(:done_ratio, :sortable => "#{Issue.table_name}.done_ratio"), - QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on"), + QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on", :default_order => 'desc'), ] cattr_reader :available_columns -- cgit v1.2.3