Files
danbooru/app/helpers/application_helper.rb
albert 23656e3fa9 * Continued work on improving post view templates
* Added statistics-based estimator for related tag calculator
* Fleshed out IpBan class based on changes to Danbooru 1.xx
2010-04-29 17:32:15 -04:00

33 lines
634 B
Ruby

module ApplicationHelper
def nav_link_to(text, url, options = nil)
if nav_link_match(params[:controller], url)
klass = "current"
else
klass = nil
end
content_tag("li", link_to(text, url, options), :class => klass)
end
def format_text(text, options = {})
DText.parse(text)
end
protected
def nav_link_match(controller, url)
url =~ case controller
when "tag_aliases", "tag_implications"
/^\/tags/
when "sessions", "user_maintenance"
/^\/users/
when "forum_posts"
/^\/forum_topics/
else
/^\/#{controller}/
end
end
end