Can you work this down to a minimal case (both in terms of Haml and Ruby
code) that still exhibits this behavior?
- Nathan
walther curly_a diechmann punta net wrote:
> Situation:
>
> I have a welcome_controller.rb with a index.haml which renders a
> partial account/_login.haml perfectly on the initial run - but when I
> post my login/pw, I get 'text' kind of output on the "second" run - ie
> - my account/ajax_login method renders the partial _login.haml with a
> flash[:error] full of great wisdom :))
>
> So - this is how my _login.haml looks like:
>
>
> - form_remote_tag( :update=> {:success => 'documentcontent'}, :url
> => { :controller => 'account', :action => 'ajax_login' }) do
> %table
> %tr
> %td
> %label Brugernavn
> %td=text_field_tag 'login', '',
> { :autocomplete=>'off', :onfocus=> 'new Effect.Highlight(this,
> { duration: 1.5 });'}
> %td
> %td{ :rowspan=>"3" }
>
> = if (flash[:error]) then
> %span.error-message flash[:error]
> end
> = if (flash[:warning]) then
> %span.warning-message flash[:warning]
> end
> %tr
> %td
> %label Adgangskode
> %td=password_field_tag 'password', '',
> { :autocomplete=>'off', :onfocus=> 'new Effect.Highlight(this,
> { duration: 1.5 });'}
> %td
> %tr
> %td
> %td
> %button{ :type=>"submit", :style=>"width: 100px;"} Login
> %td
>
>
>
> And this is how my account_controller.rb/ajax_login looks like
>
> def ajax_login
> return unless request.post?
> #self.current_user = User.authenticate(params[:login],
> params[:password])
> if logged_in?
> if params[:remember_me] == "1"
> self.current_user.remember_me
> cookies[:auth_token] = { :value =>
> self.current_user.remember_token , :expires =>
> self.current_user.remember_token_expires_at }
> end
> redirect_back_or_default(:controller => '/account', :action =>
> 'index')
> flash[:notice] = "Logged in successfully"
> else
> flash[:error] = "Du har opgivet en kombination af brugernavn og
> adgangskode, som ikke kan genkendes! Prøv venligst igen!"
> render :update do |page|
> page.replace_html 'documentcontent', :partial => 'account/login'
> end
> end
> end
>
>
> No great inventions there - I'm afraid - just some code that I cannot
> seem to get working.
>
> Anybody up for "spanking" me for not doing this or that?
>
>
> ps. on the second run - the div id="documentcontent" fills up with
> "try { Ajax.Updater....bla bla bla"
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---