Patch #44157 » add_query_parent_issue_column.patch
| app/models/issue_query.rb | ||
|---|---|---|
|
:default_order => 'desc', :caption => '#', :frozen => true),
|
||
|
QueryColumn.new(:project, :sortable => "#{Project.table_name}.name", :groupable => true),
|
||
|
QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position", :groupable => true),
|
||
|
QueryColumn.new(:parent,
|
||
|
QueryParentIssueColumn.new(:parent,
|
||
|
:sortable => ["#{Issue.table_name}.root_id", "#{Issue.table_name}.lft ASC"],
|
||
|
:default_order => 'desc', :caption => :field_parent_issue),
|
||
|
QueryAssociationColumn.new(:parent, :subject, :caption => :field_parent_issue_subject),
|
||
| app/models/query.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
class QueryParentIssueColumn < QueryColumn
|
||
|
def groupable?
|
||
|
true
|
||
|
end
|
||
|
def group_by_statement
|
||
|
"#{Issue.table_name}.parent_id"
|
||
|
end
|
||
|
def group_value(object)
|
||
|
object.parent
|
||
|
end
|
||
|
end
|
||
|
class QueryFilter
|
||
|
include Redmine::I18n
|
||
| ... | ... | |
|
column_sortable = column.sortable
|
||
|
if column.is_a?(TimestampQueryColumn)
|
||
|
column_sortable = Redmine::Database.timestamp_to_date(column.sortable, User.current.time_zone)
|
||
|
elsif column.is_a?(QueryParentIssueColumn)
|
||
|
column_sortable = "#{Issue.table_name}.parent_id"
|
||
|
end
|
||
|
Array(column_sortable).map {|s| Arel.sql("#{s} #{order}")}
|
||
|
end
|
||