timelog_comments.patch

Balazs Dan, 2008-02-03 11:01

Download (2.85 KB)

View differences:

app/models/time_entry.rb (working copy)
25 25
  
26 26
  attr_protected :project_id, :user_id, :tyear, :tmonth, :tweek
27 27
  
28
  validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_on
28
  validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_on, :comments
29 29
  validates_numericality_of :hours, :allow_nil => true
30
  validates_length_of :comments, :maximum => 255
31 30

  
32 31
  def before_validation
33 32
    self.project = issue.project if issue && project.nil?
app/views/timelog/details.rhtml (working copy)
36 36
	</div>
37 37
	<% end %>
38 38
</td>
39
<td><%=h entry.comments %></td>
39
<td><%= textilizable entry.comments %></td>
40 40
<td align="center"><strong><%= entry.hours %></strong></td>
41 41
<td align="center"><%= link_to_if_authorized(l(:button_edit), {:controller => 'timelog', :action => 'edit', :id => entry}, :class => "icon icon-edit") if entry.user_id == @owner_id %></td>
42 42
</tr>
app/views/timelog/edit.rhtml (working copy)
7 7
<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>
8 8
<p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
9 9
<p><%= f.text_field :hours, :size => 6, :required => true %></p>
10
<p><%= f.text_field :comments, :size => 100 %></p>
10
<p><%= f.text_area :comments, :required => true, :cols => 60, :rows => 15, :class => 'wiki-edit' %></p>
11 11
<p><%= f.select :activity_id, (@activities.collect {|p| [p.name, p.id]}), :required => true %></p>
12 12
</div>
13 13

  
......
20 20
<%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
21 21
<%= javascript_include_tag 'calendar/calendar-setup' %>
22 22
<%= stylesheet_link_tag 'calendar' %>
23
<% end %>
23
<% end %>
24

  
25
<%= wikitoolbar_for 'time_entry_comments' %>
db/migrate/058_change_time_entries_comments.rb (revision 0)
1
class ChangeTimeEntriesComments < ActiveRecord::Migration
2
  def self.up
3
    change_column :time_entries, :comments, :text, :default => nil
4
  end
5

  
6
  def self.down
7
    raise IrreversibleMigration
8
  end
9
end