Feature #202 » long_and_textilized_time_entry_comments.patch
| app/models/time_entry.rb | ||
|---|---|---|
|
validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_on
|
||
|
validates_numericality_of :hours, :allow_nil => true, :message => :invalid
|
||
|
validates_length_of :comments, :maximum => 255, :allow_nil => true
|
||
|
def after_initialize
|
||
|
if new_record? && self.activity.nil?
|
||
| app/views/issues/_edit.rhtml | ||
|---|---|---|
|
<div class="splitcontentright">
|
||
|
<p><%= time_entry.select :activity_id, activity_collection_for_select_options %></p>
|
||
|
</div>
|
||
|
<p><%= time_entry.text_field :comments, :size => 60 %></p>
|
||
|
<p><%= time_entry.text_area :comments, :rows => 8 %></p>
|
||
|
<% @time_entry.custom_field_values.each do |value| %>
|
||
|
<p><%= custom_field_tag_with_label :time_entry, value %></p>
|
||
|
<% end %>
|
||
| app/views/my/blocks/_timelog.rhtml | ||
|---|---|---|
|
<tr class="time-entry" style="border-bottom: 1px solid #f5f5f5;">
|
||
|
<td class="activity"><%=h entry.activity %></td>
|
||
|
<td class="subject"><%=h entry.project %> <%= ' - ' + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td>
|
||
|
<td class="comments"><%=h entry.comments %></td>
|
||
|
<td class="comments"><%= textilizable entry, :comments, :wiki_links => :local %></td>
|
||
|
<td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
|
||
|
<td align="center">
|
||
|
<% if entry.editable_by?(@user) -%>
|
||
| app/views/timelog/_list.rhtml | ||
|---|---|---|
|
<%= entry.issue.visible? ? link_to_issue(entry.issue, :truncate => 50) : "##{entry.issue.id}" -%>
|
||
|
<% end -%>
|
||
|
</td>
|
||
|
<td class="comments"><%=h entry.comments %></td>
|
||
|
<td class="comments"><%= textilizable entry, :comments, :wiki_links => :local %></td>
|
||
|
<td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
|
||
|
<td align="center">
|
||
|
<% if entry.editable_by?(User.current) -%>
|
||
| app/views/timelog/edit.rhtml | ||
|---|---|---|
|
<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>
|
||
|
<p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
|
||
|
<p><%= f.text_field :hours, :size => 6, :required => true %></p>
|
||
|
<p><%= f.text_field :comments, :size => 100 %></p>
|
||
|
<p><%= f.text_area :comments, :rows => 8 %></p>
|
||
|
<p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p>
|
||
|
<% @time_entry.custom_field_values.each do |value| %>
|
||
|
<p><%= custom_field_tag_with_label :time_entry, value %></p>
|
||
| db/migrate/20100203222505_convert_time_entry_comment_to_text.rb | ||
|---|---|---|
|
class ConvertTimeEntryCommentToText < ActiveRecord::Migration
|
||
|
def self.up
|
||
|
change_column :time_entries, :comments, :text
|
||
|
end
|
||
|
def self.down
|
||
|
change_column :time_entries, :comments, :string, :limit => 255
|
||
|
end
|
||
|
end
|
||
| public/stylesheets/application.css | ||
|---|---|---|
|
width: auto;
|
||
|
}
|
||
|
input#time_entry_comments { width: 90%;}
|
||
|
textarea#time_entry_comments { width: 99%;}
|
||
|
#preview fieldset {margin-top: 1em; background: url(../images/draft.png)}
|
||