Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
def avatar_for(user, link = false, size = "64x64", options_for_link = {}) buddy_icon = buddy_icon_for(user, size) if featured?(user) featured(size) do |badge| (link) ? link_to_profile(user, options_for_link) { badge + buddy_icon } : badge + buddy_icon end else (link) ? link_to_profile(user, options_for_link) { buddy_icon } : buddy_icon end end def buddy_icon_for(user, size="64x64") image_tag user.buddy_icon, :class => "photo", :size => size, :alt => :icon end def featured(size = "64x64") width, height = size.split(/x/) output = "" #output << %q{<div class="featuredv featured-avatarv">} output << %Q{<div class="featured-avatar" style="width: #{width}px; height: #{height}px; border: 1px solid green !important;">} output << yield(%q{<img class="featured-swash" src="/img/featured-swash.gif" alt="Featured" />}) output << %q{</div>} end def link_to_profile(user, options = {}) result = yield link_to result, profile_url(:screen_name => user.screen_name), options end
This paste will be private.
From the Design Piracy series on my blog: