Class: Journal
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Journal
- Defined in:
- app/models/journal.rb
Overview
Redmine - project management software Copyright © 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
-
#indice ⇒ Object
Returns the value of attribute indice.
Instance Method Summary collapse
- #attachments ⇒ Object
-
#css_classes ⇒ Object
Returns a string of css classes.
- #editable_by?(usr) ⇒ Boolean
-
#new_status ⇒ Object
Returns the new status if the journal contains a status change, otherwise nil.
- #new_value_for(prop) ⇒ Object
- #project ⇒ Object
- #save(*args) ⇒ Object
Instance Attribute Details
#indice ⇒ Object
Returns the value of attribute indice.
26 27 28 |
# File 'app/models/journal.rb', line 26 def indice @indice end |
Instance Method Details
#attachments ⇒ Object
70 71 72 |
# File 'app/models/journal.rb', line 70 def journalized.respond_to?(:attachments) ? journalized. : nil end |
#css_classes ⇒ Object
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 |
#editable_by?(usr) ⇒ Boolean
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 |
#new_status ⇒ Object
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 |
#new_value_for(prop) ⇒ Object
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 |
#project ⇒ Object
66 67 68 |
# File 'app/models/journal.rb', line 66 def project journalized.respond_to?(:project) ? journalized.project : nil end |
#save(*args) ⇒ Object
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 |