2011-11-21 21:36:42 +00:00
|
|
|
module ApplicationHelper
|
2012-07-25 18:24:20 +00:00
|
|
|
def page_title
|
|
|
|
title = "ascii.io"
|
|
|
|
|
|
|
|
if @title
|
|
|
|
title = "#{@title} - #{title}"
|
|
|
|
end
|
|
|
|
|
|
|
|
title
|
|
|
|
end
|
|
|
|
|
2012-02-26 15:40:30 +00:00
|
|
|
def twitter_auth_path
|
|
|
|
"/auth/twitter"
|
|
|
|
end
|
|
|
|
|
|
|
|
def github_auth_path
|
|
|
|
"/auth/github"
|
|
|
|
end
|
2012-03-03 07:52:10 +00:00
|
|
|
|
2012-04-05 20:30:57 +00:00
|
|
|
def markdown(&block)
|
2012-06-08 07:08:30 +00:00
|
|
|
text = capture(&block)
|
2012-06-09 13:23:56 +00:00
|
|
|
MKD_RENDERER.render(capture(&block)).html_safe
|
2012-04-05 20:30:57 +00:00
|
|
|
end
|
2012-06-10 13:16:12 +00:00
|
|
|
|
|
|
|
def indented(string, width)
|
|
|
|
string.lines.map { |l| "#{' ' * width}#{l}" }.join('')
|
|
|
|
end
|
2012-07-25 18:24:20 +00:00
|
|
|
|
|
|
|
def category_link(text, url, name)
|
|
|
|
opts = {}
|
|
|
|
|
|
|
|
if name == @current_category
|
|
|
|
opts[:class] = 'active'
|
|
|
|
end
|
|
|
|
|
|
|
|
link_to text, url, opts
|
|
|
|
end
|
2012-08-25 12:24:53 +00:00
|
|
|
|
|
|
|
def timeago(time, options = {})
|
|
|
|
options[:class] ||= "timeago"
|
|
|
|
content_tag(:abbr, time.to_s, options.merge(:title => time.getutc.iso8601))
|
|
|
|
end
|
2011-11-21 21:36:42 +00:00
|
|
|
end
|