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

Remove "Add product" in admin order shipments page #3214

Merged
merged 5 commits into from
Sep 12, 2019

Conversation

spaghetticode
Copy link
Member

@spaghetticode spaghetticode commented May 28, 2019

This PR is the continuation of the work started by @tvdeyen with #3099.

Please refer to that PR for motivations and previous discussions.

This is the admin Shipment page before the changes, when it's still possible to add a product:

Schermata 2019-05-29 alle 17 03 01

This is the same page after the changes, when adding products is not possible anymore:

Schermata 2019-05-29 alle 16 49 44

Of course products can still be added from the Cart page:

Schermata 2019-05-29 alle 17 06 23

Retrocompatibility

Since some stores may want to keep the removed functionality, the code was extracted to the new Solidus extension solidus_shipments_add_product.
Usage is very simple, just add the extension to the Gemfile and run the installer:

gem 'solidus_shipments_add_product', github: 'solidusio-contrib/solidus_shipments_add_product'
bundle
bundle exec rails g solidus_shipments_add_product:install

The extension will work only on Solidus versions that include this PR.

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change (if needed)

Copy link
Contributor

@ericsaupe ericsaupe left a comment

Choose a reason for hiding this comment

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

LGTM!

@jacobherrington
Copy link
Contributor

This should close #3085.

Thanks for picking up the work on this one @spaghetticode! 🍝 Since this does affect the UI, do you mind adding a screenshot?

@spaghetticode
Copy link
Member Author

@jacobherrington thanks for the input, it makes sense 👍
I added a few screenshots to the PR description.

Copy link
Contributor

@jacobherrington jacobherrington left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @spaghetticode. 👍

@kennyadsl kennyadsl added changelog:solidus_backend Changes to the solidus_backend gem Important Change labels May 29, 2019
@spaghetticode spaghetticode self-assigned this Jun 21, 2019
@spaghetticode
Copy link
Member Author

As discussed during the Solidus core team meeting, before removing this functionality by merging this PR, we should provide an extension or similar mean that will allow users willing to continue to use this feature to do so.

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Thanks for continuing the work.

@spaghetticode spaghetticode force-pushed the no-product-add-at-shipments branch from 6789caa to e181e0c Compare August 30, 2019 09:49
tvdeyen and others added 4 commits August 30, 2019 11:53
The test setup creates an order without any line items but a shipped shipment. This is not possible in real world scenarios and leads to false negatives.
We do not need to visit the "Cart" before we visit the "Customer" tab after removing the country.
Mutating the order on the shipments screen is not a good idea and leads to lots of bugs and confusion by users.

Mutating the cart should only be possible on the cart page.

This removes lots of old, hard to maintain Javascript as well.
Adding a product from the Cart tab brings the order to `confirm` state instead
of `cart`, changing the label in the Payment tab.
@spaghetticode spaghetticode force-pushed the no-product-add-at-shipments branch from e181e0c to fa59e21 Compare August 30, 2019 09:53
spaghetticode added a commit to solidusio-contrib/solidus_shipments_add_product that referenced this pull request Aug 30, 2019
Adding JS code that was removed with solidusio/solidus#3214
spaghetticode added a commit to solidusio-contrib/solidus_shipments_add_product that referenced this pull request Aug 30, 2019
Adding JS code that was removed with solidusio/solidus#3214
@@ -18,6 +18,8 @@
<%= render 'spree/admin/orders/risk_analysis', latest_payment: @order.payments.reorder("created_at DESC").first %>
<% end %>

<div data-hook="add_product_button" />
Copy link
Member

Choose a reason for hiding this comment

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

I'd try to use a more generic name since other extensions could use this hook in other ways.

Copy link
Member Author

Choose a reason for hiding this comment

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

@kennyadsl makes sense 👍
I changed the name to admin_order_edit_sub_header

@spaghetticode spaghetticode force-pushed the no-product-add-at-shipments branch from fa59e21 to 5b8b8fb Compare August 30, 2019 12:34
This hook is used by the `solidus_shipments_add_product` extension that
brings back the "Add Product" link to the admin order shipments page
for stores that need that functionality.
@spaghetticode spaghetticode force-pushed the no-product-add-at-shipments branch from 5b8b8fb to b06c385 Compare August 30, 2019 12:46
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! Can you please add the link to the new extension in the PR description, and maybe a quick recap on how/when to use it?

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 @spaghetticode!

@kennyadsl kennyadsl merged commit bb75082 into solidusio:master Sep 12, 2019
@kennyadsl kennyadsl deleted the no-product-add-at-shipments branch September 12, 2019 14:06
spaghetticode added a commit to solidusio-contrib/solidus_shipments_add_product that referenced this pull request Sep 12, 2019
Now that solidusio/solidus#3214 is
merged, Solidus branch in the Gemfile must be updated to
`master`.

Until a new Solidus version will be released, only Solidus
`master` supports this extension.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_backend Changes to the solidus_backend gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants