I'm just using it for readability for one long statement that takes a block (usually form_for). Moving this to a helper isn't really much value. Or if I did, I'd prefer after working out my logic.
The | is working well for me now. It's not bad- hardly notice it. Thanks, Nick On Sun, Jun 7, 2009 at 9:07 PM, Chris Eppstein <[email protected]> wrote: > I have to admit, I find the whole multiline syntax awkward enough that I > never use it. I think maybe that was the plan ;-) Helpers FTW. > chris > > > On Fri, Jun 5, 2009 at 9:13 PM, Nicholas Van Weerdenburg < > [email protected]> wrote: > >> Ah! That worked. I'll look at doc more closely next time. >> Thanks, >> Nick >> >> >> On Fri, Jun 5, 2009 at 4:29 PM, Nathan Weizenbaum <[email protected]>wrote: >> >>> >>> You have to put the multiline character on the last line as well. >>> >>> On Fri, Jun 5, 2009 at 1:27 PM, Nicholas Van >>> Weerdenburg<[email protected]> wrote: >>> > Forgot the error: >>> > Invalid filter name ":with => "'search=' + encodeuricomponent(value)"". >>> > If I put \: in, I get crazy compile errors... >>> > compile error >>> > /Users/vanweerd/work2/innerplate/app/views/track/_item_search.haml:12: >>> > syntax error, unexpected $undefined >>> > ...mp = observe_field :search, \:frequency => 0.5, \:update ... >>> > ^ >>> > /Users/vanweerd/work2/innerplate/app/views/track/_item_search.haml:12: >>> > syntax error, unexpected ',', expecting kEND >>> > ... \:update => 'ajaxWrapper', \:before => "Element.show(... >>> > Thanks, >>> > Nick >>> > On Fri, Jun 5, 2009 at 4:26 PM, Nicholas Van Weerdenburg >>> > <[email protected]> wrote: >>> >> >>> >> Hmm. Doesn't work for me. Here is the code- a HAMLized example from >>> the >>> >> Agile Rails book. I've also tried with \ in front of the :'s- >>> >> - form_tag('javascript:void(0)') do >>> >> .fake-h1 >>> >> Listing Items >>> >> = text_field_tag 'search', @search >>> >> = observe_field :search, | >>> >> :frequency => 0.5, | >>> >> :update => 'ajaxWrapper', | >>> >> :before => "Element.show('spinner')", | >>> >> :complete => "Element.hide('spinner')", | >>> >> :url => {:action=>'search', :only_path => false}, | >>> >> :with => "'search=' + encodeURIComponent(value)" >>> >> .ajaxWrapper >>> >> = render :partial=>'search' >>> >> Any thoughts? >>> >> Thanks, >>> >> Nick >>> >> On Fri, Jun 5, 2009 at 4:09 PM, Nicholas Van Weerdenburg >>> >> <[email protected]> wrote: >>> >>> >>> >>> Thanks. It didn't occur to me to use that with executable code. >>> >>> >>> >>> On Sun, May 31, 2009 at 10:31 PM, Nathan Weizenbaum < >>> [email protected]> >>> >>> wrote: >>> >>>> >>> >>>> The best way to do this is to take this big glob of code out of your >>> >>>> view and move it into a helper. If you don't want to do that, >>> though, use >>> >>>> the Haml multiline syntax: >>> >>>> >>> >>>> - form_remote_for :portion, Portion.new, :url=> new_portion_url, | >>> >>>> :loading=> 'Form.disable("portion_form")', >>> >>>> :complete=> 'Form.enable("portion_form")', >>> >>>> :html=> {:id=> 'portion_form' } do |f| >>> >>>> >>> >>>> On Sun, May 31, 2009 at 7:26 PM, Nicholas Van Weerdenburg >>> >>>> <[email protected]> wrote: >>> >>>>> >>> >>>>> I want to do the following: >>> >>>>> :ruby >>> >>>>> form_remote_for :portion, Portion.new, :url=> new_portion_url, >>> >>>>> :loading=> 'Form.disable("portion_form")', >>> >>>>> :complete=> 'Form.enable("portion_form")', >>> >>>>> :html=> {:id=> 'portion_form' } do |f| >>> >>>>> .meal_type{:style=>"float: left;"} >>> >>>>> e.g. have my form_remote_for on multiple lines. However, I need to >>> >>>>> indent the following line (meal_type), and I'm not sure how to do >>> it. >>> >>>>> The other option: >>> >>>>> - form_remote_for :portion, Portion.new, :url=> >>> new_portion_url, >>> >>>>> - :loading=> 'Form.disable("portion_form")', >>> >>>>> - :complete=> 'Form.enable("portion_form")', >>> >>>>> - :html=> {:id=> 'portion_form' } do |f| >>> >>>>> Didn't work either due to ";" being added after each line. >>> >>>>> Any suggestions? >>> >>>>> 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 -~----------~----~----~----~------~----~------~--~---
