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

Simplify store_credit memo edit JS #2547

Merged
merged 1 commit into from
Feb 5, 2018

Conversation

jhawthorn
Copy link
Contributor

The previous store credit coffeescript did a lot more than it needed to, and recreated much of the work that we could get for free from rails-ujs. We were already specifying remote: true, but weren't using that functionality and instead were performing the ajax explicitly.

This commit replaces the existing JS and relies on CSS for display, and jquery-ujs for submitting via AJAX. The user-facing behaviour should be identical.

The resulting code has very little to do with store credits, we should consider at a future date looking through our inline edits in the admin and possibly consolidating them.

The previous store credit JS did a lot more than it needed to, and
recreated much of the work that we could get for free from rails-ujs. We
were already specifying remote: true, but weren't using that
functionality and instead were performing the AJAX explicitly.

This commit replaces the existing JS and relies on CSS for display , and
jquery-ujs for submitting via AJAX. The user-facing behaviour should be
identical.

The resulting code has very little to do with store credits, we should
consider at a future date looking through our inline edits in the admin
and possibly consolidating them.
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Thanks, I had some doubts about the usage of 'ajax:success' bound directly on the form (where remote: true is set). My doubts come from this statement on the jQuery .ajaxSuccess documentation page:

As of jQuery 1.9, all the handlers for the jQuery global Ajax events, including those added with the .ajaxSuccess() method, must be attached to document.

I initially thought that this applies to ajax:success as well but than I found this guide.

This seems to be the accepted way in rails land, so 👍

@jhawthorn jhawthorn merged commit 976c33a into solidusio:master Feb 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants