show_last_comment_in_issues_list.patch

Chris Peterson, 2008-06-16 21:20

Download (7.22 KB)

View differences:

app/controllers/issues_controller.rb (working copy)
63 63
                           :conditions => @query.statement,
64 64
                           :limit  =>  limit,
65 65
                           :offset =>  @issue_pages.current.offset
66
	  @issues.each do |issue|
67
	    journals = issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on DESC LIMIT 1")
68
        issue.last_comment ||= journals.first[:notes] if !journals.first.nil?
69
	  end
66 70
      respond_to do |format|
67 71
        format.html { render :template => 'issues/index.rhtml', :layout => !request.xhr? }
68 72
        format.atom { render_feed(@issues, :title => l(:label_issue_plural)) }
......
116 120
    @issue.project = @project
117 121
    @issue.author = User.current
118 122
    @issue.tracker ||= @project.trackers.find(params[:tracker_id] ? params[:tracker_id] : :first)
123
	#@issue.last_comment = " " 
119 124
    if @issue.tracker.nil?
120 125
      flash.now[:error] = 'No tracker is associated to this project. Please check the Project settings.'
121 126
      render :nothing => true, :layout => true
app/helpers/issues_helper.rb (working copy)
25 25
    @cached_label_due_date ||= l(:field_due_date)
26 26
    @cached_label_assigned_to ||= l(:field_assigned_to)
27 27
    @cached_label_priority ||= l(:field_priority)
28
	#@cahced_label_last_comment ||= l(:field_last_comment)
28 29
    
29 30
    link_to_issue(issue) + ": #{h(issue.subject)}<br /><br />" +
30 31
      "<strong>#{@cached_label_start_date}</strong>: #{format_date(issue.start_date)}<br />" +
......
138 139
                  l(:field_done_ratio),
139 140
                  l(:field_estimated_hours),
140 141
                  l(:field_created_on),
141
                  l(:field_updated_on)
142
                  l(:field_updated_on),
143
				  l(:field_last_comment),
142 144
                  ]
143 145
      # Export project custom fields if project is given
144 146
      # otherwise export custom fields marked as "For all projects"
......
164 166
                  issue.done_ratio,
165 167
                  issue.estimated_hours,
166 168
                  format_time(issue.created_on),  
167
                  format_time(issue.updated_on)
169
                  format_time(issue.updated_on),
170
				  issue.last_comment
168 171
                  ]
169 172
        custom_fields.each {|f| fields << show_value(issue.custom_value_for(f)) }
170 173
        fields << issue.description
app/models/query.rb (working copy)
107 107
    QueryColumn.new(:estimated_hours, :sortable => "#{Issue.table_name}.estimated_hours"),
108 108
    QueryColumn.new(:done_ratio, :sortable => "#{Issue.table_name}.done_ratio"),
109 109
    QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on", :default_order => 'desc'),
110
	QueryColumn.new(:last_comment, :sortable => "#{Issue.table_name}.last_comment"),
110 111
  ]
111 112
  cattr_reader :available_columns
112 113
  
app/views/issues/index.rfpdf (working copy)
4 4
	pdf.AliasNbPages
5 5
	pdf.footer_date = format_date(Date.today)
6 6
	pdf.AddPage("L")
7
	row_height = 7
7
	row_height = 5
8 8
	
9 9
	#
10 10
	# title
......
18 18
	#	
19 19
	pdf.SetFontStyle('B',10)
20 20
	pdf.SetFillColor(230, 230, 230)
21
   	pdf.Cell(15, row_height, "#", 0, 0, 'L', 1)
22
   	pdf.Cell(30, row_height, l(:field_tracker), 0, 0, 'L', 1)
23
   	pdf.Cell(30, row_height, l(:field_status), 0, 0, 'L', 1)
24
   	pdf.Cell(30, row_height, l(:field_priority), 0, 0, 'L', 1)
25
   	pdf.Cell(40, row_height, l(:field_assigned_to), 0, 0, 'L', 1)
26
   	pdf.Cell(25, row_height, l(:field_updated_on), 0, 0, 'L', 1)
27
   	pdf.Cell(0, row_height, l(:field_subject), 0, 0, 'L', 1)
21
   	pdf.Cell(15, row_height, "#", 0, 0, 'C', 1)
22
   	pdf.Cell(30, row_height, l(:field_tracker), 0, 0, 'C', 1)
23
   	pdf.Cell(30, row_height, l(:field_status), 0, 0, 'C', 1)
24
   	pdf.Cell(30, row_height, l(:field_priority), 0, 0, 'C', 1)
25
   	pdf.Cell(50, row_height, l(:field_assigned_to), 0, 0, 'C', 1)
26
   	pdf.Cell(30, row_height, l(:field_updated_on), 0, 0, 'C', 1)
27
	pdf.Cell(0, row_height, l(:field_subject), 0, 0, 'L', 1)
28
   		
28 29
   	pdf.Line(10, pdf.GetY, 287, pdf.GetY)
29 30
   	pdf.Ln
30 31
   	pdf.Line(10, pdf.GetY, 287, pdf.GetY)
......
36 37
	pdf.SetFontStyle('',9)
37 38
	pdf.SetFillColor(255, 255, 255)
38 39
	@issues.each do |issue|		
39
	   	pdf.Cell(15, row_height, issue.id.to_s, 0, 0, 'L', 1)
40
	   	pdf.Cell(30, row_height, issue.tracker.name, 0, 0, 'L', 1)
41
	   	pdf.Cell(30, row_height, issue.status.name, 0, 0, 'L', 1)
42
	   	pdf.Cell(30, row_height, issue.priority.name, 0, 0, 'L', 1)
43
	   	pdf.Cell(40, row_height, issue.assigned_to ? issue.assigned_to.name : '', 0, 0, 'L', 1)
44
	   	pdf.Cell(25, row_height, format_date(issue.updated_on), 0, 0, 'L', 1)
45
	   	pdf.MultiCell(0, row_height, (@project == issue.project ? issue.subject : "#{issue.project.name} - #{issue.subject}"))
40
	   	pdf.Cell(15, row_height, issue.id.to_s, 0, 0, 'C', 1)
41
	   	pdf.Cell(30, row_height, issue.tracker.name, 0, 0, 'C', 1)
42
	   	pdf.Cell(30, row_height, issue.status.name, 0, 0, 'C', 1)
43
	   	pdf.Cell(30, row_height, issue.priority.name, 0, 0, 'C', 1)
44
	   	pdf.Cell(50, row_height, issue.assigned_to ? issue.assigned_to.name : '', 0, 0, 'C', 1)
45
	   	pdf.Cell(30, row_height, format_date(issue.updated_on), 0, 0, 'C', 1)
46
	  	pdf.MultiCell(0, row_height, (@project == issue.project ? issue.subject : "#{issue.project.name}\n#{issue.subject}"))
47
		if issue.last_comment != nil 
48
			if issue.last_comment != ""
49
				pdf.Cell(23, row_height, "Last Comment:",0,0,'R',1)
50
				pdf.MultiCell(0, row_height, issue.last_comment)		
51
			end
52
		end
46 53
   		pdf.Line(10, pdf.GetY, 287, pdf.GetY)
47 54
   		pdf.SetY(pdf.GetY() + 1)
48 55
	end
lang/en.yml (working copy)
174 174
field_assignable: Issues can be assigned to this role
175 175
field_redirect_existing_links: Redirect existing links
176 176
field_estimated_hours: Estimated time
177
field_last_comment: Last Comment
177 178
field_column_names: Columns
178 179
field_time_zone: Time zone
179 180
field_searchable: Searchable
public/stylesheets/application.css (working copy)
86 86

  
87 87
table.list.issues { margin-top: 10px; }
88 88
tr.issue { text-align: center; white-space: nowrap; }
89
tr.issue td.subject, tr.issue td.category { white-space: normal; }
90
tr.issue td.subject { text-align: left; }
89
tr.issue td.subject, tr.issue td.category, tr.issue td.last_comment { white-space: normal; }
90
tr.issue td.subject, tr.issue td.last_comment { text-align: left; width: 25%}
91 91
tr.issue td.done_ratio table.progress { margin-left:auto; margin-right: auto;}
92 92

  
93 93
tr.entry { border: 1px solid #f8f8f8; }