This project is archived and is in readonly mode.

#4486 ✓invalid
Victor Costan

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

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

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!

Comments and changes to this ticket

  • Victor Costan

    Victor Costan May 9th, 2010 @ 06:11 AM

    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.

  • Steve St. Martin

    Steve St. Martin May 17th, 2010 @ 02:52 PM

    • 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

  • Rohit Arondekar

    Rohit Arondekar June 15th, 2010 @ 01:50 PM

    • State changed from “new” to “invalid”
  • Ryan Bigg

    Ryan Bigg October 14th, 2010 @ 04:51 AM

    • Tag cleared.

    Automatic cleanup of spam.

Create your profile

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

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages