Module: ForumsHelper

Defined in:
app/helpers/forums_helper.rb

Instance Method Summary collapse

Instance Method Details

#icon_and_color_and_post_for(topic) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'app/helpers/forums_helper.rb', line 19

def icon_and_color_and_post_for(topic)
  icon = "comment"
  color = ""
  post = ''
  if topic.locked?
    icon = "lock" 
    post = ", "+:this_topic_is_locked.l
    color = "darkgrey"
  end  
  [icon, color, post  ]
end

#recent_forum_activity(forum) ⇒ Object

used to know if a forum has changed since we read it last



12
13
14
15
16
17
# File 'app/helpers/forums_helper.rb', line 12

def recent_forum_activity(forum)
  return false unless logged_in? && forum.topics.first
  return false unless last_active || session[:forums]
   
  return forum.topics.order("replied_at desc").first.replied_at > (last_active || session[:forums][forum.id])
end

#recent_topic_activity(topic) ⇒ Object

used to know if a topic has changed since we read it last



4
5
6
7
8
9
# File 'app/helpers/forums_helper.rb', line 4

def recent_topic_activity(topic)
  return false if not logged_in?
  return false unless last_active || session[:topics]
  
  return topic.replied_at > (last_active || session[:topics][topic.id])
end