##// END OF EJS Templates
remove trailing white-spaces from WikiContent model source....
Toshi MARUYAMA -
r5675:97abb12aeb77
parent child
Show More
@@ -1,16 +1,16
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
1 # RedMine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 #
8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 #
13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -23,28 +23,28 class WikiContent < ActiveRecord::Base
23 23 belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
24 24 validates_presence_of :text
25 25 validates_length_of :comments, :maximum => 255, :allow_nil => true
26
26
27 27 acts_as_versioned
28
28
29 29 def visible?(user=User.current)
30 30 page.visible?(user)
31 31 end
32
32
33 33 def project
34 34 page.project
35 35 end
36
36
37 37 def attachments
38 38 page.nil? ? [] : page.attachments
39 39 end
40
40
41 41 # Returns the mail adresses of users that should be notified
42 42 def recipients
43 43 notified = project.notified_users
44 44 notified.reject! {|user| !visible?(user)}
45 45 notified.collect(&:mail)
46 46 end
47
47
48 48 class Version
49 49 belongs_to :page, :class_name => '::WikiPage', :foreign_key => 'page_id'
50 50 belongs_to :author, :class_name => '::User', :foreign_key => 'author_id'
@@ -84,7 +84,7 class WikiContent < ActiveRecord::Base
84 84 end
85 85 plain
86 86 end
87
87
88 88 def text
89 89 @text ||= case compression
90 90 when 'gzip'
@@ -92,16 +92,16 class WikiContent < ActiveRecord::Base
92 92 else
93 93 # uncompressed data
94 94 data
95 end
95 end
96 96 end
97
97
98 98 def project
99 99 page.project
100 100 end
101
101
102 102 # Returns the previous version or nil
103 103 def previous
104 @previous ||= WikiContent::Version.find(:first,
104 @previous ||= WikiContent::Version.find(:first,
105 105 :order => 'version DESC',
106 106 :include => :author,
107 107 :conditions => ["wiki_content_id = ? AND version < ?", wiki_content_id, version])
General Comments 0
You need to be logged in to leave comments. Login now