|
List Info
Thread: Span Row Haml Filter
|
|
| Span Row Haml Filter |
  United States |
2007-12-19 12:54:07 |
I created a Rails form builder that creates lots o'
two-column
tabular forms. Occasionally, I need to intersperse textual
instructions and it comes out looking awful in my Haml. What
I did
was create a filter called span_row, and I'd like some
comment on it.
Usage:
Assuming you have a tabular_form_for kinda helper (see Rails
Recipes)
that generates one of these tables, the usage is like so:
- tabular_form_for( person) do |f|
= render :partial => 'form', :locals => {:f =>
f}
:span_row
When you click "signup," you will be taken to
a page where you
can enter your credit card information. Please follow
the
instructions there carefully.
= f.submit "Signup"
The code for the helper is at:
http://pastie.caboo.se/
130587
Issues:
- I couldn't use the Haml::Helpers.open and .puts so
indentation
doesn't exist. Huh?
- I'd like to use an optional argument to the filter for
columns, but
don't know exactly how to pass that. Suggestions?
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Span Row Haml Filter |
  United States |
2007-12-19 13:04:19 |
Filters are, at the moment, all evaluated at
precompile-time, rather
than render-time. This means that there's no way to get a
reference to
the view object that has helpers defined, nor to take
arguments from the
template. We plan to add this ability at some point.
s.ross wrote:
> I created a Rails form builder that creates lots o'
two-column
> tabular forms. Occasionally, I need to intersperse
textual
> instructions and it comes out looking awful in my Haml.
What I did
> was create a filter called span_row, and I'd like some
comment on it.
>
> Usage:
>
> Assuming you have a tabular_form_for kinda helper (see
Rails Recipes)
> that generates one of these tables, the usage is like
so:
>
> - tabular_form_for( person) do |f|
> = render :partial => 'form', :locals => {:f
=> f}
> :span_row
> When you click "signup," you will be
taken to a page where you
> can enter your credit card information. Please
follow the
> instructions there carefully.
> = f.submit "Signup"
>
> The code for the helper is at:
>
> http://pastie.caboo.se/
130587
>
> Issues:
>
> - I couldn't use the Haml::Helpers.open and .puts so
indentation
> doesn't exist. Huh?
> - I'd like to use an optional argument to the filter
for columns, but
> don't know exactly how to pass that. Suggestions?
>
> Thanks
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Span Row Haml Filter |
  United States |
2007-12-19 13:10:21 |
|
|
How about the optional argument specifying the number of cols?
Thx On Dec 19, 2007, at 11:04 AM, Nathan Weizenbaum wrote: Filters are, at the moment, all evaluated at precompile-time, rather than render-time. This means that there's no way to get a reference to the view object that has helpers defined, nor to take arguments from the template. We plan to add this ability at some point.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to haml googlegroups.com To unsubscribe from this group, send email to haml-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~----------~----~----~----~------~----~------~--~---
|
| Re: Span Row Haml Filter |

|
2007-12-19 13:26:33 |
|
| How about a helpers that accept blocks? Can't they kind of replace filters somehow?
Like for example this disfunctional code:
- evgeny
On Dec 19, 2007 9:10 PM,
s.ross < cwdinfo  gmail.com" >cwdinfo gmail.com> wrote:
How about the optional argument specifying the number of cols?
Thx On Dec 19, 2007, at 11:04 AM, Nathan Weizenbaum wrote:
Filters are, at the moment, all evaluated at precompile-time, rather
than render-time. This means that there's no way to get a reference to
the view object that has helpers defined, nor to take arguments from the
template. We plan to add this ability at some point.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to haml googlegroups.com To unsubscribe from this group, send email to haml-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~----------~----~----~----~------~----~------~--~---
|
| Re: Span Row Haml Filter |
  United States |
2007-12-19 13:31:34 |
|
|
That seems like it would work, and there's every reason to use it but it begs the question: Why not do pretty much every filtering thingie this way instead of filters? Conversely, there is the issue of the implied "do". The code reads like Ruby, but because it's Haml, you leave off the "do" so it looks invalid (ecch).
Thoughts? On Dec 19, 2007, at 11:26 AM, Evgeny wrote: How about a helpers that accept blocks?Can't they kind of replace filters somehow?
Like for example this disfunctional code:
- evgeny
On Dec 19, 2007 9:10 PM, s.ross < cwdinfo  gmail.com" >cwdinfo gmail.com> wrote:
How about the optional argument specifying the number of cols?
Thx On Dec 19, 2007, at 11:04 AM, Nathan Weizenbaum wrote: Filters are, at the moment, all evaluated at precompile-time, rather than render-time. This means that there's no way to get a reference to the view object that has helpers defined, nor to take arguments from the template. We plan to add this ability at some point.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to haml googlegroups.com To unsubscribe from this group, send email to haml-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~----------~----~----~----~------~----~------~--~---
|
| Re: Span Row Haml Filter |

|
2007-12-19 13:45:27 |
|
Didn't I use the word "disfunctional" ? 
On Dec 19, 2007 9:31 PM, s.ross < cwdinfo  gmail.com" >cwdinfo gmail.com> wrote:
That seems like it would work, and there' s every reason to use it but it begs the question: Why not do pretty much every filtering thingie this way instead of filters? Conversely, there is the issue of the implied "do". The code reads like Ruby, but because it's Haml, you leave off the "do" so it looks invalid (ecch).
Thoughts? On Dec 19, 2007, at 11:26 AM, Evgeny wrote: How about a helpers that accept blocks?Can't they kind of replace filters somehow?
Like for example this disfunctional code:
- evgeny
On Dec 19, 2007 9:10 PM, s.ross < cwdinfo  gmail.com" target="_blank">cwdinfo gmail.com> wrote:
How about the optional argument specifying the number of cols?
Thx On Dec 19, 2007, at 11:04 AM, Nathan Weizenbaum wrote:
Filters are, at the moment, all evaluated at precompile-time, rather
than render-time. This means that there's no way to get a reference to
the view object that has helpers defined, nor to take arguments from the
template. We plan to add this ability at some point.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to haml googlegroups.com To unsubscribe from this group, send email to haml-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~----------~----~----~----~------~----~------~--~---
|
| Re: Span Row Haml Filter |
  United States |
2007-12-19 15:49:55 |
Filters exist to process text that isn't Haml, and may obey
other rules
of indentation, etc. It's possible to implement a superset
of the
functionality of filters using helpers and the :plain filter
(although
obviously this requires at least the one filter to work),
but that's
just ugly.
In short, helpers should be used when doing something with
Haml, and
filters otherwise. Except filters can't dynamically access
anything (nor
can they take args, to answer your other question). Yet.
- Nathan
s.ross wrote:
> That seems like it would work, and there's every reason
to use it but
> it begs the question: Why not do pretty much every
filtering thingie
> this way instead of filters? Conversely, there is the
issue of the
> implied "do". The code reads like Ruby, but
because it's Haml, you
> leave off the "do" so it looks invalid
(ecch).
>
> Thoughts?
>
>
> On Dec 19, 2007, at 11:26 AM, Evgeny wrote:
>
>> How about a helpers that accept blocks?
>> Can't they kind of replace filters somehow?
>>
>> Like for example this disfunctional code:
>> http://pastie.caboo.se/
130606
>>
>>
>> - evgeny
>>
>>
>> On Dec 19, 2007 9:10 PM, s.ross <cwdinfo gmail.com
>> <mailto:cwdinfo gmail.com>> wrote:
>>
>> How about the optional argument specifying the
number of cols?
>>
>> Thx
>>
>> On Dec 19, 2007, at 11:04 AM, Nathan Weizenbaum
wrote:
>>
>>> Filters are, at the moment, all evaluated
at precompile-time,
>>> rather
>>> than render-time. This means that there's
no way to get a
>>> reference to
>>> the view object that has helpers defined,
nor to take arguments
>>> from the
>>> template. We plan to add this ability at
some point.
>>
>>
>>
>>
>>
>>
>>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
[1-7]
|
|