Class: Journal

Inherits:
ActiveRecord::Base show all
Defined in:
app/models/journal.rb

Overview

redMine - project management software Copyright (C) 2006 Jean-Philippe Lang

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Instance Attribute Summary

Instance Method Summary

Methods inherited from ActiveRecord::Base

quoted_table_name

Instance Attribute Details

- (Object) indice

Returns the value of attribute indice



26
27
28
# File 'app/models/journal.rb', line 26

def indice
  @indice
end

Instance Method Details

- (Object) attachments



65
66
67
# File 'app/models/journal.rb', line 65

def attachments
  journalized.respond_to?(:attachments) ? journalized.attachments : nil
end

- (Boolean) editable_by?(usr)

Returns:

  • (Boolean)


57
58
59
# File 'app/models/journal.rb', line 57

def editable_by?(usr)
  usr && usr.logged? && (usr.allowed_to?(:edit_issue_notes, project) || (self.user == usr && usr.allowed_to?(:edit_own_issue_notes, project)))
end

- (Object) new_status

Returns the new status if the journal contains a status change, otherwise nil



47
48
49
50
# File 'app/models/journal.rb', line 47

def new_status
  c = details.detect {|detail| detail.prop_key == 'status_id'}
  (c && c.value) ? IssueStatus.find_by_id(c.value.to_i) : nil
end

- (Object) new_value_for(prop)



52
53
54
55
# File 'app/models/journal.rb', line 52

def new_value_for(prop)
  c = details.detect {|detail| detail.prop_key == prop}
  c ? c.value : nil
end

- (Object) project



61
62
63
# File 'app/models/journal.rb', line 61

def project
  journalized.respond_to?(:project) ? journalized.project : nil
end

- (Object) save(*args)



41
42
43
44
# File 'app/models/journal.rb', line 41

def save(*args)
  # Do not save an empty journal
  (details.empty? && notes.blank?) ? false : super
end