bluerail / twitter-bootstrap-rails-confirm

Confirm dialogs using Twitter Bootstrap
https://bluerail.nl
MIT License
85 stars 34 forks source link

Doesn't follow link after confirm. #7

Closed jonathansimmons closed 10 years ago

jonathansimmons commented 11 years ago

I've got this setup in my rails app gem version 1.0.0 with the link below:

<%= link_to 'Approve Quote', new_client_job_invoice_path(@client, @job), class: 'btn', confirm: 'This will approve the job and require deposit payment for work to beign.', "data-confirm-title" => "Approve Work" ,"data-confirm-cancel" => 'Cancel', "data-confirm-proceed" => 'Approve and Pay', "data-confirm-proceed-class" => "btn-hivemind" %>

The confirmation modal works fine, however it doesn't follow the link when the user clicks the proceed btn? any thoughts?

rvanlieshout commented 11 years ago

Not really. Got any javascript errors? What does it do after pressing proceed?

jonathansimmons commented 11 years ago

Nope no javascript errors. I did some further testing. But I have two new thoughts.

First, when using a normal browser confirm, when you click continue on a confirm popup the browser will give you an indication that the page it loading. In chrome that consists of a loading gif where the favicon is on your current tab.

When I implement this gem and get the fancy bootstrap confirm modal, if I click continue I get no such loading gif, no knowledge that the browser has moved on. I just thought i'd note that as I thought it was weird.

Second I realized that when I click confirm the action was happening, my page is just not refreshing as it should. When I looked in the log I found the following:

Completed 302 Found in 6885ms (ActiveRecord: 19.7ms)
[2013-04-24 16:30:37] ERROR Errno::ECONNRESET: Connection reset by peer
  /Users/jonathan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:80:in `eof?'
  /Users/jonathan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:80:in `run'
  /Users/jonathan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

You'll see the 302 to redirect but the app is giving a connection reset? any thoughts?

rvanlieshout commented 11 years ago

That's strange. The dialog does not really change the way the browser opens the page. This doesn't happen when you remove the confirm dialog?

How could your request take over 6 seconds?

jonathansimmons commented 11 years ago

If I remove the confirm dialog everything works fine.

It's possible the request i"m making is taking longer than 6 seconds. Its an external api call to Chargify that sometimes responds slowly.

jonathansimmons commented 11 years ago

Yea, I just can't work out what is up. I can use the example from the Readme and get this error. I just outright get this every time.

rvanlieshout commented 11 years ago

What if you create the dialog in a javascript console and execute it step by step? I just don't get the relationship between your problem and this code.