From f92025c7fa063e34a11d5629dd60bd091141aa92 Mon Sep 17 00:00:00 2001 From: hcatlin Date: Wed, 14 Mar 2007 16:00:08 +0000 Subject: [PATCH] adding attributes to open_tag git-svn-id: svn://hamptoncatlin.com/haml/trunk@404 7063305b-7217-0410-af8c-cdc13e5119b9 --- lib/haml/helpers/action_view_mods.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/haml/helpers/action_view_mods.rb b/lib/haml/helpers/action_view_mods.rb index f3b8e091..90cb2edb 100644 --- a/lib/haml/helpers/action_view_mods.rb +++ b/lib/haml/helpers/action_view_mods.rb @@ -79,8 +79,10 @@ if action_view_included # end # # TODO: Make it output with better tabulation - def open_tag(named, &block) - push_text "<#{named}>" + def open_tag(named, options = {}, &block) + # TODO: I'm sure re-coding this is bad. I know we do this elsewhere, obviously. + attributes = (options.collect { |key, value| "#{key}='#{value}'" }).join(" ") + push_text "<#{named}#{attributes}>" tab_up block.call concat "\n" @@ -95,7 +97,7 @@ if action_view_included tab_up oldproc.call(*args) tab_down - end + end end old_form_for(object_name, *args, &proc) concat "\n" if block_given? && is_haml?