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

[Admin] Avoid javascript in saving positions #10396

Merged
merged 3 commits into from
Jun 19, 2019

Conversation

Zales0123
Copy link
Member

@Zales0123 Zales0123 commented May 20, 2019

Q A
Branch? master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets
License MIT

These scenarios were firstly problematic during #10228, so I've fixed it (apparently nope) by adding a focus() method on the element. However, it's still a problem in #10389. The thing is, in the javascript scenarios some other element is covering the "Save position" button if the screen size is too small 🚀 💃

I've realized that we can avoid using an ajax call for saving positions, by using a form attribute on inputs. If this change will be welcomed, we can do the same for the variants' positions.

@Zales0123 Zales0123 added Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). Admin AdminBundle related issues and PRs. labels May 20, 2019
@Zales0123 Zales0123 requested a review from a team as a code owner May 20, 2019 14:03
@Zales0123 Zales0123 changed the base branch from 1.3 to master May 21, 2019 09:29
@Zales0123 Zales0123 force-pushed the avoid-javascript-in-saving-positions branch from 8d42296 to a9c2498 Compare May 21, 2019 09:29
@Zales0123 Zales0123 force-pushed the avoid-javascript-in-saving-positions branch from a9c2498 to feca621 Compare June 17, 2019 09:08
@Zales0123 Zales0123 requested a review from kulczy June 18, 2019 06:39
@pamil pamil merged commit b850bc6 into Sylius:master Jun 19, 2019
@pamil
Copy link
Contributor

pamil commented Jun 19, 2019

Thank you, Mateusz! 🎉

pamil added a commit that referenced this pull request Aug 8, 2019
This PR was merged into the 1.4-dev branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | master
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | 
| License         | MIT

Welcome to the continuation of my war against JS scenarios in Sylius ⚔️ :D (see #10396). The idea is the same as previously, to avoid javascript scenarios whenever we can.

Currently, each scenario that contains some step with removing an item from the cart needs to be tagged as `@javascript`, as this functionality is done with the ajax call. We can easily avoid it, by setting a proper `form` attribute on each item quantity and coupon fields, as well as update, remove an item and apply coupon buttons.

The good thing is - no PHP code is changed 😄 only twigs, js and a new route in yaml. We should also probably deprecate an old `sylius_shop_ajax_cart_item_remove` route (or shouldn't we?).

As a result, the build should be at least one minute faster 🚤 (it's a good step forward, anyway 🚀)

Commits
-------

d9e7f02 Change removing cart item to non-js action
7203a70 Remove @javascript tag from all scenarios that removes cart item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin AdminBundle related issues and PRs. Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants