I created the following helper:
def xhr_form_for *args, &block
if request.xhr?
remote_form_for *args, &block
else
form_for *args, &block
end
end
To allow dynamic selection of form type based on whether the page is an AJAX
request or not.
Is there a way to do this outside of a helper? Not that I wish to do evil
and break any rules, but I'm curious for my understanding of HAML.
e.g. along the lines of ...
-if request.xhr?
-remote_form_for(@item) do |f|
-else !request.xhr?
-form_for( @item ) do |f|
= f.error_messages
= f.text_field ....
HAML won't let me put in an -end. and thus I don't know how to specify
indentation. The above may not work because of the block, but a similar case
is:
-if color==:blue
.blue_div
-else
.red_div
Is there a way to indent under the red div without using a helper?
Thanks,
Nick
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---