Hampton, thank your for your help or.. should I say helpers?

Regards,

Gustavo

On Mar 16, 5:49 pm, Hampton <[email protected]> wrote:
> So, Haml is *not* good at taking ugly code and making it pretty. Its good at
> making you make sure you do good stuff.
> def text_field_with_label(f, name, label_override = nil, options = {})
>   haml_tag :p do
>     puts f.label(name, label_override)
>     puts f.text_field(name, options)
>   end
> end
>
> then, you can do...
>
> - text_field_with_label(f, :name)
> - text_field_with_label(f, :address)
> - text_field_with_label(f, :country)
> .... etc....
>
> making it even more dry, i'd probably do this.
>
> def field_sets(f, *names)
>   names.each do |data|
>     name, label_override = *data
>     puts text_field_with_label(f, name, label_override)
>   end
> end
>
> - field_sets(f, :name, :address, :country, [:uri, "URI"], :postal_code)
>
> Also, let's say we kept this simple and a little WET. What is so wrong with
> doubling the lines.
> Its less characters than the erb! So what if its on a new line?
>
> Fin.
>
> -hampton.
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to