Module: ForumPage::InstanceMethods

Defined in:
lib/forum_page.rb

Instance Method Summary collapse

Instance Method Details

#locked?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/forum_page.rb', line 35

def locked?
  !still_commentable?
end

#show_comments?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/forum_page.rb', line 21

def show_comments?
  !virtual? && !self.is_a?(RailsPage) && commentable?
end

#still_commentable?Boolean

commentable? is a boolean model column

Returns:

  • (Boolean)


26
27
28
29
30
31
32
33
# File 'lib/forum_page.rb', line 26

def still_commentable?
  return false if virtual? or self.is_a? RailsPage
  return false unless Radiant::Config['forum.allow_page_comments?'] && commentable?
  return false if comments_closed?
  return true unless commentable_period && commentable_period > 0
  age = (Time.now - self.published_at).to_i
  return age < commentable_period
end