Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

New UJS helpers do not have a way to render a "loading..." text / icon

#4486

I am migrating an application from Rails 2.3 to Rails 3, and I looked through the code in actionpack/lib/action_view/helpers/ and I couldn't find a way to display an indicator that an AJAX request is in progress. I like link_to :remote => true and I can probably live without a failure indicator, but I'd really like a "request in progress" indicator.

I am opening a ticket without doing any work because I think API decisions need to be made before writing failing tests.

Thank you!

Reported by Victor Costan · April 27th, 2010 @ 08:34 AM

State: invalid
Milestone: none
Assigned to: Ryan Bigg Ryan Bigg
Importance: Low

Activity

  1. Victor Costan
    Victor Costan

    How about allowing :remote to take a Hash of options instead of true? The option :indicator (rendered as a data-indicator-name attribute) would be a name that would match the data-indicator attribute of one or many elements inside the form. The elements' style would be set to "visibility: hidden;" at rendering time, then to "visibility: visible;" before the AJAX request, and back to "visibility: hidden;" after the completion of the AJAX request.

    May 9th, 2010 @ 06:11 AM

  2. Steve St. Martin
    Steve St. Martin
    • Tag changed from rails3, ujs to invalid, rails3, ujs

    This can easily be accomplished each driver has a custom callback that fires before the request is sent, here is an example using the jQuery driver.

      $('#new_resource').live('ajax:loading', function() {
        // code to display loading div
      });
    

    you could also do this globally by using

      $.ajaxSetup({
        beforeSend: function() {
          // code to display loading div
        }
      });
    

    ticket should be marked as invalid

    May 17th, 2010 @ 02:52 PM

  3. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to invalid

    June 15th, 2010 @ 01:50 PM

  4. Ryan Bigg
    Ryan Bigg
    • Tag cleared.

    Automatic cleanup of spam.

    October 14th, 2010 @ 04:51 AM