Module: ApplicationHelper

Defined in:
lib/tamed_beast/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#avatar_for(user, size = 32) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/tamed_beast/application_helper.rb', line 2

def avatar_for(user, size=32)
  begin
    image_tag "http://www.gravatar.com/avatar.php?gravatar_id=#{MD5.md5(user.email)}&rating=PG&size=#{size}", :size => "#{size}x#{size}", :class => 'photo'
  rescue
    image_tag "http://www.gravatar.com/avatar.php?rating=PG&size=#{size}", :size => "#{size}x#{size}", :class => 'photo'
  end
end


10
11
12
13
14
15
16
17
# File 'lib/tamed_beast/application_helper.rb', line 10

def topic_title_link(topic, options)
  if topic.title =~ /^\[([^\]]{1,15})\]((\s+)\w+.*)/
    "<span class='flag'>#{$1}</span>" +
    link_to(h($2.strip), forum_topic_path(@forum, topic), options)
  else
    link_to(h(topic.title), forum_topic_path(@forum, topic), options)
  end
end