Skip to content

Commit

Permalink
Add awesome new link_to helper. I love HAML.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmans committed Mar 9, 2012
1 parent 5d503de commit 47e1b3c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/schnitzelpress/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,12 @@ def icon(name)

"<span class=\"font-awesome\">&#x#{char};</span>"
end

def link_to(title, target = "", options = {})
options[:href] = target.respond_to?(:to_url) ? target.to_url : target
options[:data] ||= {}
[:method, :confirm].each { |a| options[:data][a] = options.delete(a) }
haml "%a#{options} #{title}"
end
end
end

0 comments on commit 47e1b3c

Please sign in to comment.