move to STI for journals so the journals themselves can be events

This commit is contained in:
Tim Felgentreff 2010-07-21 17:57:45 +02:00
parent 2287d7ce8c
commit ff31875149
5 changed files with 7 additions and 5 deletions

View File

@ -197,7 +197,7 @@ class MailHandler < ActionMailer::Base
# Reply will be added to the issue
def receive_journal_reply(journal_id)
journal = Journal.find_by_id(journal_id)
if journal && journal.versioned_type == 'Issue'
if journal && journal.versioned.is_a? Issue
receive_issue_reply(journal.versioned_id)
end
end

View File

@ -67,7 +67,7 @@ class Mailer < ActionMailer::Base
# Watchers in cc
cc(issue.watcher_recipients - @recipients)
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] "
s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
s << "(#{issue.status.name}) " if journal.details['status_id']
s << issue.subject
subject s
body :issue => issue,

View File

@ -26,7 +26,7 @@ class TimeEntry < ActiveRecord::Base
attr_protected :project_id, :user_id, :tyear, :tmonth, :tweek
acts_as_customizable
acts_as_journalized :event_title => Proc.new {|o| "#{l_hours(o.hours)} (#{(o.issue || o.project).event_title})"},
acts_as_journalized :event_title => Proc.new {|o| "#{l_hours(o.hours)} (#{(o.issue || o.project).current_journal.event_title})"},
:event_url => Proc.new {|o| {:controller => 'timelog', :action => 'details', :project_id => o.project, :issue_id => o.issue}},
:event_author => :user,
:event_description => :comments

View File

@ -9,7 +9,9 @@
<% if journal.details.any? %>
<ul class="details">
<% for detail in journal.details %>
<li><%= journal.show_detail(detail) %></li>
<% if d = journal.show_detail(detail) %>
<li><%= d %></li>
<% end %>
<% end %>
</ul>
<% end %>

View File

@ -73,7 +73,7 @@ module Redmine
end
with_scope(:find => scope_options) do
Journal.find(:all, provider_options[:find_options].dup)
journal_class.find(:all, provider_options[:find_options].dup)
end
end
end