module ApplicationHelper
  def hashtag_link(hash)
    link_to " ##{hash} ", hashtag_public_image_actu_path(hash.to_slug), :target => "_blank"
  end
  
  def parse_hashtag(text)
    text.gsub(Hashtag::REGEX) {hashtag_link($1)}
  
  end
  
  def flash_js
    r = raw ("$('#flashs').append('"+ escape_javascript(bootstrap_flash) +"');flash_delay();")
    flash[:notice] = nil
    flash[:error] = nil
    flash[:success] = nil
    
    r
  end
  
  
  def forum_avatar_url(user)
    if user
      user.avatar_url
    else
      "/default_avatar.png"
    
    end
  end
end
