long_and_textilized_time_entry_comments.patch

Gustavo Gama, 2010-03-19 15:49

Download (4.23 KB)

View differences:

app/models/time_entry.rb
37 37

  
38 38
  validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_on
39 39
  validates_numericality_of :hours, :allow_nil => true, :message => :invalid
40
  validates_length_of :comments, :maximum => 255, :allow_nil => true
41 40

  
42 41
  def after_initialize
43 42
    if new_record? && self.activity.nil?
app/views/issues/_edit.rhtml
24 24
        <div class="splitcontentright">
25 25
        <p><%= time_entry.select :activity_id, activity_collection_for_select_options %></p>
26 26
        </div>
27
        <p><%= time_entry.text_field :comments, :size => 60 %></p>
27
        <p><%= time_entry.text_area :comments, :rows => 8 %></p>
28 28
        <% @time_entry.custom_field_values.each do |value| %>
29 29
        	<p><%= custom_field_tag_with_label :time_entry, value %></p>
30 30
        <% end %>
app/views/my/blocks/_timelog.rhtml
32 32
    <tr class="time-entry" style="border-bottom: 1px solid #f5f5f5;">
33 33
    <td class="activity"><%=h entry.activity %></td>
34 34
    <td class="subject"><%=h entry.project %> <%= ' - ' + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td>
35
    <td class="comments"><%=h entry.comments %></td>
35
    <td class="comments"><%= textilizable entry, :comments, :wiki_links => :local %></td>
36 36
    <td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
37 37
    <td align="center">
38 38
    <% if entry.editable_by?(@user) -%>
app/views/timelog/_list.rhtml
23 23
<%= entry.issue.visible? ? link_to_issue(entry.issue, :truncate => 50) : "##{entry.issue.id}" -%>
24 24
<% end -%>
25 25
</td>
26
<td class="comments"><%=h entry.comments %></td>
26
<td class="comments"><%= textilizable entry, :comments, :wiki_links => :local %></td>
27 27
<td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
28 28
<td align="center">
29 29
<% if entry.editable_by?(User.current) -%>
app/views/timelog/edit.rhtml
8 8
<p><%= f.text_field :issue_id, :size => 6 %> <em><%= h("#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}") if @time_entry.issue %></em></p>
9 9
<p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
10 10
<p><%= f.text_field :hours, :size => 6, :required => true %></p>
11
<p><%= f.text_field :comments, :size => 100 %></p>
11
<p><%= f.text_area :comments, :rows => 8 %></p>
12 12
<p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p>
13 13
<% @time_entry.custom_field_values.each do |value| %>
14 14
	<p><%= custom_field_tag_with_label :time_entry, value %></p>
db/migrate/20100203222505_convert_time_entry_comment_to_text.rb
1
class ConvertTimeEntryCommentToText < ActiveRecord::Migration
2
  def self.up
3
      change_column :time_entries, :comments, :text
4
  end
5

  
6
  def self.down
7
      change_column :time_entries, :comments, :string, :limit => 255
8
  end
9
end
public/stylesheets/application.css
364 364
width: auto;
365 365
}
366 366

  
367
input#time_entry_comments { width: 90%;}
367
textarea#time_entry_comments { width: 99%;}
368 368

  
369 369
#preview fieldset {margin-top: 1em; background: url(../images/draft.png)}
370 370