Project

General

Profile

Patch #1475 ยป subject_sort_subproject.patch

Chris Peterson, 2008-06-16 21:25

View differences:

app/helpers/queries_helper.rb (working copy)
end
def column_header(column)
column.sortable ? sort_header_tag(column.sortable, :caption => column.caption,
:default_order => column.default_order) :
content_tag('th', column.caption)
column.sortable ? sort_header_tag(column.sortable, :caption => column.caption,
:default_order => column.default_order) :
content_tag('th', column.caption)
end
def column_content(column, issue)
......
else
case column.name
when :subject
h((@project.nil? || @project != issue.project) ? "#{issue.project.name} - " : '') +
((@project.nil? || @project != issue.project) ? '<font color="#B26917">' + h("[#{issue.project.name}] ") + '</font>': '') +
link_to(h(value), :controller => 'issues', :action => 'show', :id => issue)
when :done_ratio
progress_bar(value, :width => '80px')
progress_bar(value)
else
h(value)
end
app/helpers/sort_helper.rb (working copy)
# - The optional caption explicitly specifies the displayed link text.
# - A sort icon image is positioned to the right of the sort link.
#
def sort_link(column, caption, default_order)
def sort_link(column, caption, default_order, project_id)
key, order = session[@sort_name][:key], session[@sort_name][:order]
if key == column
if order.downcase == 'asc'
icon = 'sort_asc.png'
order = 'desc'
else
icon = 'sort_desc.png'
order = 'asc'
end
if order.downcase == 'asc'
icon = 'sort_asc.png'
order = 'desc'
else
icon = 'sort_desc.png'
order = 'asc'
end
if key !~ /#{column}/
icon = nil
order = default_order
end
if column == 'issues.subject'
project_id = params[:project_id]
column = 'projects.name,issues.subject'
end
caption = titleize(Inflector::humanize(column)) unless caption
sort_options = { :sort_key => column, :sort_order => order }
# don't reuse params if filters are present
url_options = params.has_key?(:set_filter) ? sort_options : params.merge(sort_options)
......
caption = options.delete(:caption) || titleize(Inflector::humanize(column))
default_order = options.delete(:default_order) || 'asc'
options[:title]= l(:label_sort_by, "\"#{caption}\"") unless options[:title]
content_tag('th', sort_link(column, caption, default_order), options)
project_id = options.delete(:project_id) || 'est'
content_tag('th', sort_link(column, caption, default_order, project_id), options)
end
private
    (1-1/1)