forum.rb
727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class Forum < Folder
acts_as_having_posts :order => 'updated_at DESC'
include PostsLimit
def self.type_name
_('Forum')
end
def self.short_description
_('Forum')
end
def self.description
_('An internet forum, also called message board, where discussions can be held.')
end
include ActionView::Helpers::TagHelper
def to_html(options = {})
proc do
render :file => 'content_viewer/forum_page'
end
end
def forum?
true
end
def self.icon_name(article = nil)
'forum'
end
def notifiable?
true
end
def first_paragraph
return '' if body.blank?
paragraphs = Hpricot(body).search('p')
paragraphs.empty? ? '' : paragraphs.first.to_html
end
end