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.

Add disable_with to button_to in a unobtrusive manner

#4993

I've added a patch to use disable_with in the button_to helper in a unobtrusive manner.

See the patch

Reported by PacoGuzman · June 28th, 2010 @ 11:26 AM

State: committed
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Voloshin Ruslan
  2. Voloshin Ruslan
    Voloshin Ruslan

    this bug existed in rails 3.0.0

    September 3rd, 2010 @ 10:45 AM

  3. Jeff Kreeftmeijer
    Jeff Kreeftmeijer
    • Tag set to button_to, disable_with, patch
    • Importance changed from to Low

    October 10th, 2010 @ 08:43 AM

  4. Santiago Pastorino
    Santiago Pastorino

    The patch doesn't apply cleanly anymore. Rebase it please.

    October 10th, 2010 @ 05:41 PM

  5. PacoGuzman
    PacoGuzman

    Attached new patch. I've created the patch from master

    October 11th, 2010 @ 08:05 AM

  6. Jeff Kreeftmeijer
    Jeff Kreeftmeijer
    • State changed from new to open

    +1

    Patch applies cleanly and tests pass. :)

    October 11th, 2010 @ 08:22 AM

  7. Santiago Pastorino
    Santiago Pastorino

    One more thing PacoGuzman, the patch needs docs because is a new feature.
    Thanks and well done!!!

    October 11th, 2010 @ 02:07 PM

  8. PacoGuzman
    PacoGuzman

    Santiago, I think this is already documented.

    http://github.com/rails/rails/blob/master/actionpack/lib/action_vie...

    module ActionView
    module Helpers

    module UrlHelper
    
      #   <%= button_to('Destroy', 'http://www.example.com', :confirm => 'Are you sure?',
      #             :method => "delete", :remote => true, :disable_with => 'loading...') %>
      #   # => "<form class='button_to' method='post' action='http://www.example.com' data-remote='true'>
      #   #       <div>
      #   #         <input name='_method' value='delete' type='hidden' />
      #   #         <input value='Destroy' type='submit' disable_with='loading...' data-confirm='Are you sure?' />
      #   #       </div>
      #   #     </form>"
      #   #
      def button_to(name, options = {}, html_options = {})
      end
    end
    

    end end

    October 11th, 2010 @ 03:34 PM

  9. Repository
  10. Repository