app/helpers/activities_helper.rb
# Given an activity, return the right icon.
Given an activity, return the right icon.
Given an activity return the right icon .
def feed_icon(activity)
    img = case activity_type(activity)
            when "StatusUpdate"
              "friend_guy.gif"
            when "BlogPost"
              "note.gif"
            when "Entry"
              "page_white_edit.png"
            when "Comment"
              "comment.png"
            when "WallComment"
              parent_type = activity.item.commentable.class.to_s
              case parent_type
              when "BlogPost"
                "comments.gif"
              when "Photo"
                "comments.gif"
              when "Event"
                "comments.gif"
              when "User"
                "wall_post.gif"
              when "Group"
                "wall_post.gif"
              when "NewsItem"
                "comments.gif"
              end
            when "Friendship"
              if activity.item.friend.admin?
                "affiliation.gif"
              else
                "friend.gif"
              end
            when "ForumPost"
              "note.png"
            when "Topic"
              "discussion.gif"
            when "User"
              "edit_profile.gif"
            when "Gallery"
              "gallery.png"
            when "Photo"
              "photo.gif"
            when "Event"
              "event.gif"
            when "EventAttendee"
              "fbpage_add.gif"
            when "Group"
              if activity.owner.class.to_s == "Group"
                "edit_profile.gif"
              else
                "group.gif"
              end
            when "Membership"
              "group.gif"
            when "NewsItem"
              if activity.owner.class.to_s == "User"
                "note.gif"
              elsif activity.owner.class.to_s == "Group"
                "marketplace.gif"
              elsif activity.owner.class.to_s == "Widget"
                "notifications.gif"
              end
            else
              raise "無法辨識活動類型 #{activity_type(activity).inspect}"
            end
    image_tag("icons/#{img}", :class => "icon")
  end
def feed_icon ( activity ) img = case activity_type ( activity ) when "StatusUpdate" "friend_guy.gif" when "BlogPost" "note.gif" when "Entry" "page_white_edit.png" when "Comment" "comment.png" when "WallComment" parent_type = activity . item . commentable . class . to_s case parent_type when "BlogPost" "comments.gif" when "Photo" "comments.gif" when "Event" "comments.gif" when "User" "wall_post.gif" when "Group" "wall_post.gif" when "NewsItem" "comments.gif" end when "Friendship" if activity . item . friend . admin? "affiliation.gif" else "friend.gif" end when "ForumPost" "note.png" when "Topic" "discussion.gif" when "User" "edit_profile.gif" when "Gallery" "gallery.png" when "Photo" "photo.gif" when "Event" "event.gif" when "EventAttendee" "fbpage_add.gif" when "Group" if activity . owner . class . to_s == "Group" "edit_profile.gif" else "group.gif" end when "Membership" "group.gif" when "NewsItem" if activity . owner . class . to_s == "User" "note.gif" elsif activity . owner . class . to_s == "Group" "marketplace.gif" elsif activity . owner . class . to_s == "Widget" "notifications.gif" end else raise "無法辨識活動類型 #{activity_type(activity).inspect}" end image_tag ( "icons/#{img}" , :class => "icon" ) end
Given an activity, return the right icon.
Given an activity return the right icon .
activity
<not_specific>