proposal.rb
824 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
class ProposalsDiscussionPlugin::Proposal < TinyMceArticle
scope :private, lambda {|user| {:conditions => {:last_changed_by_id => user.id, :published => false}}}
alias :topic :parent
def self.short_description
_("Proposal")
end
def self.description
_('Proposal')
end
validates_presence_of :abstract
def to_html(options = {})
proc do
render :file => 'content_viewer/proposal'
end
end
def allow_edit?(user)
super || created_by == user
end
def score
comments_count
end
def normalized_score(holder)
(score/holder.max_score.to_f).round(2)
end
def cache_key_with_person(params = {}, user = nil, language = 'en')
cache_key_without_person + (user && created_by == user ? "-#{user.identifier}" : '')
end
alias_method_chain :cache_key, :person
end