Browse files

Add awesome new link_to helper. I love HAML.

  • Loading branch information...
1 parent 5d503de commit 47e1b3ce4f38378b86bbe072461d2faf16e45bf0 @hmans committed Mar 9, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 lib/schnitzelpress/helpers.rb
View
7 lib/schnitzelpress/helpers.rb
@@ -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.