Sha256: 608aa7e19bfb3e4d2036ad41efa3043e9c662d5930d26fa9f766c95fa10ac6cf

Contents?: true

Size: 886 Bytes

Versions: 10

Compression:

Stored size: 886 Bytes

Contents

module ForumsHelper
  
  # used to know if a topic has changed since we read it last
  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 
  
  # used to know if a forum has changed since we read it last
  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
  
  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
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
community_engine-3.2.0 app/helpers/forums_helper.rb
community_engine-3.0.0 app/helpers/forums_helper.rb
community_engine-2.3.2 app/helpers/forums_helper.rb
community_engine-2.3.1 app/helpers/forums_helper.rb
community_engine-2.3.0 app/helpers/forums_helper.rb
community_engine-2.1.0 app/helpers/forums_helper.rb
community_engine-2.0.0 app/helpers/forums_helper.rb
community_engine-2.0.0.beta3 app/helpers/forums_helper.rb
community_engine-2.0.0.beta2 app/helpers/forums_helper.rb
community_engine-2.0.0.beta1 app/helpers/forums_helper.rb