#514 ✓resolved
jet

Ajax-ify Hobo-login and friends --Enhancement

Reported by jet | October 25th, 2009 @ 04:15 PM | in Hobo 1.0 - Final

Would like to see Hobo-login and friends become Ajax friendly to
enable Ajax actions.

Here is the solution Bryan Larsen helped me with to implement this:

<def tag="login-form">
  <form action="&user_login_path" class="login"  merge>
    <labelled-item-list param>
   <labelled-item>
     <item-label param="login-label">EMAIL ADDRESS</item-label>
       <item-value>
              <input type="text" name="login" id="login" class="string" param="login-input" />
           </item-value>
   </labelled-item>
   <labelled-item>
       <item-label param="password-label-architect">
              PASSWORD
           </item-label>
       <item-value>
           <input type="password" name="password" id="password" class="string" param="password-input"/>
       </item-value>
   </labelled-item>
    </labelled-item-list>
<submit label='LOG IN' param/> or <cancel />
    </div> 
  </form>
</def>

And in users_controller.rb the action:

def login
 if logged_in?
  respond_to do |wants|
    wants.html { redirect_to home_page }
    wants.js { hobo_ajax_response }
  end
 else
  hobo_login do
    respond_to do |wants|
      wants.html { }
      wants.js { hobo_ajax_response }
    end
  end
 end
end

Thank you,

Jet

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Referenced by

Pages