Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable via js double click on remove link and update button, fixes #187... #1934

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions core/app/assets/javascripts/store/cart.js.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
$ ->
if ($ 'form#update-cart').is('*')
($ 'form#update-cart a.delete').show().on 'click', ->
($ 'form#update-cart a.delete').show().one 'click', ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you may have made a mistake here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one() is a jquery method that allows to execute the handler at most once per element as defined here: http://api.jquery.com/one/
It allows to prevent double click on the link.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, alright then. I didn't know about one :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even I until yesterday :)

($ this).parents('.line-item').first().find('input.line_item_quantity').val 0
($ this).parents('form').first().submit()
false
false

($ 'form#update-cart').submit ->
($ 'form#update-cart #update-button').attr('disabled', true)