module Write module ApplicationHelper def write_admin? login_user && Write.admin?(login_user.github) end def login_user defined?(current_user) && current_user end def timestamp_display post time_ago_in_words(post.created_at) + " ago" end def head_links content_for :head, auto_discovery_link_tag(:atom, atom_feed_url, :title => Write.full_title) + stylesheet_link_tag("write/application", :media => "all") end def atom_feed_url Write.feed_url || feed_url end def post_snippet post truncate_html(Write::MD.render(post.content), :length => 256).html_safe end end end