Class: Journal
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Journal
- Defined in:
- app/models/journal.rb
Overview
Redmine - project management software Copyright (C) 2006-2011 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 (collapse)
-
- (Object) indice
Returns the value of attribute indice.
Instance Method Summary (collapse)
- - (Object) attachments
-
- (Object) css_classes
Returns a string of css classes.
- - (Boolean) editable_by?(usr)
-
- (Object) new_status
Returns the new status if the journal contains a status change, otherwise nil.
- - (Object) new_value_for(prop)
- - (Object) project
- - (Object) save(*args)
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
70 71 72 |
# File 'app/models/journal.rb', line 70 def journalized.respond_to?(:attachments) ? journalized. : nil end |
- (Object) css_classes
Returns a string of css classes
75 76 77 78 79 80 |
# File 'app/models/journal.rb', line 75 def css_classes s = 'journal' s << ' has-notes' unless notes.blank? s << ' has-details' unless details.blank? s end |
- (Boolean) editable_by?(usr)
62 63 64 |
# File 'app/models/journal.rb', line 62 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
52 53 54 55 |
# File 'app/models/journal.rb', line 52 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)
57 58 59 60 |
# File 'app/models/journal.rb', line 57 def new_value_for(prop) c = details.detect {|detail| detail.prop_key == prop} c ? c.value : nil end |
- (Object) project
66 67 68 |
# File 'app/models/journal.rb', line 66 def project journalized.respond_to?(:project) ? journalized.project : nil end |
- (Object) save(*args)
46 47 48 49 |
# File 'app/models/journal.rb', line 46 def save(*args) # Do not save an empty journal (details.empty? && notes.blank?) ? false : super end |