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)
22 22
  end
23 23
  
24 24
  def column_header(column)
25
    column.sortable ? sort_header_tag(column.sortable, :caption => column.caption,
26
                                                       :default_order => column.default_order) : 
27
                      content_tag('th', column.caption)
25
	column.sortable ? sort_header_tag(column.sortable, :caption => column.caption,
26
														   :default_order => column.default_order) : 
27
						  content_tag('th', column.caption)
28 28
  end
29 29
  
30 30
  def column_content(column, issue)
......
40 40
      else
41 41
        case column.name
42 42
        when :subject
43
        h((@project.nil? || @project != issue.project) ? "#{issue.project.name} - " : '') +
43
          ((@project.nil? || @project != issue.project) ? '<font color="#B26917">' + h("[#{issue.project.name}] ") + '</font>': '') +		  
44 44
          link_to(h(value), :controller => 'issues', :action => 'show', :id => issue)
45 45
        when :done_ratio
46
          progress_bar(value, :width => '80px')
46
          progress_bar(value)
47 47
        else
48 48
          h(value)
49 49
        end
app/helpers/sort_helper.rb (working copy)
92 92
  # - The optional caption explicitly specifies the displayed link text.
93 93
  # - A sort icon image is positioned to the right of the sort link.
94 94
  #
95
  def sort_link(column, caption, default_order)
95
  def sort_link(column, caption, default_order, project_id)
96 96
    key, order = session[@sort_name][:key], session[@sort_name][:order]
97
    if key == column
98
      if order.downcase == 'asc'
99
        icon = 'sort_asc.png'
100
        order = 'desc'
101
      else
102
        icon = 'sort_desc.png'
103
        order = 'asc'
104
      end
97
    if order.downcase == 'asc'
98
      icon = 'sort_asc.png'
99
      order = 'desc'
105 100
    else
101
      icon = 'sort_desc.png'
102
      order = 'asc'
103
    end
104
    if key !~ /#{column}/
106 105
      icon = nil
107 106
      order = default_order
108 107
    end
108
	
109
	if column == 'issues.subject'
110
		project_id = params[:project_id]
111
	    column = 'projects.name,issues.subject'
112
	end	
113

  
109 114
    caption = titleize(Inflector::humanize(column)) unless caption
110
    
111 115
    sort_options = { :sort_key => column, :sort_order => order }
112 116
    # don't reuse params if filters are present
113 117
    url_options = params.has_key?(:set_filter) ? sort_options : params.merge(sort_options)
......
142 146
    caption = options.delete(:caption) || titleize(Inflector::humanize(column))
143 147
    default_order = options.delete(:default_order) || 'asc'
144 148
    options[:title]= l(:label_sort_by, "\"#{caption}\"") unless options[:title]
145
    content_tag('th', sort_link(column, caption, default_order), options)
149
	project_id = options.delete(:project_id) || 'est'
150
    content_tag('th', sort_link(column, caption, default_order, project_id), options)
146 151
  end
147 152

  
148 153
  private
    (1-1/1)