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

[Spree Upgrade] Fix admin new order page #3194

Merged

Conversation

HugsDaniel
Copy link
Contributor

@HugsDaniel HugsDaniel commented Dec 7, 2018

What? Why?

Closes #3109 and #3107 and #2416
The spec in #3107 should be green.

@HugsDaniel said:
New new/edit order page in back office! Upgraded Spree views to 2.0 and applied overrides.
There's no error anymore for blank line_items (it was added with deface), and line items can be added.
I used Spree default routes for these actions (see in _routes.html.erb to make this work.

@luisramos0 said:
Regarding the fix to #2416 by adapting app/views/spree/admin/variants/_autocomplete.js.erb and the respective search.rabl file: this is a quick fix to the problem, there's plenty we could improve here, I suggest we leave for after the upgrade, I created this tech debt issue #3440

Remaining work to be done in follow up PRs:

For the review, I recommend reviewers to follow the commits in order.

@HugsDaniel HugsDaniel self-assigned this Dec 7, 2018
Copy link
Contributor

@luisramos0 luisramos0 left a comment

Choose a reason for hiding this comment

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

awesome, keep going!

  • Two JS errors coming from _form.html.haml:30 :

If you are stuck, please provide full details on the two JS errors you are seeing.

There are a lot of JS function that could/should be converted into Angular's

I wouldnt worry about converting everything to angular, at least not yet.

app/views/spree/admin/shared/_routes.html.erb Outdated Show resolved Hide resolved
app/views/spree/admin/shared/_routes.html.erb Show resolved Hide resolved
<button class="add_variant no-text icon-plus icon_link with-tip" data-stock-location-id="{{this.stock_location_id}}" title="Add" data-action="add"></button>
</td>
{{else}}
<td><%= Spree.t(:out_of_stock) %></td>
Copy link
Contributor

Choose a reason for hiding this comment

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

all Spree.t entries should be replaced by normal lazy loaded entries (may need to add these to our en.yml file).

@mkllnk
Copy link
Member

mkllnk commented Dec 7, 2018

Oh no, we are working on the same thing. Have a look at #2938 (comment). Different approach.

@HugsDaniel
Copy link
Contributor Author

@mkllnk are you just working on the translation issue or on the whole new page ?

@mkllnk
Copy link
Member

mkllnk commented Dec 7, 2018

Just on the translation issue. I'm trying to get ./spec/features/admin/orders_spec.rb:48 passing.

@mkllnk
Copy link
Member

mkllnk commented Dec 7, 2018

But I am changing app/views/spree/admin/variants/_autocomplete.js.erb for that while you are replacing it. So there is a conflict in our work.

@mkllnk
Copy link
Member

mkllnk commented Dec 7, 2018

I opened my pull request: #3195. You can see what I did.

I think it is quite useful to have the count on hand in that view. But maybe not essential? Should we just x the on hand display? @luisramos0

@HugsDaniel Where did you get the original view from? I though Spree 2 switched to using the API and doesn't have that view any more. Did you import the Spree 1 view?

@HugsDaniel
Copy link
Contributor Author

_autocomplete.js.erb you mean ? It's in Spree 2

@mkllnk
Copy link
Member

mkllnk commented Dec 10, 2018

Ah, sorry for the confusion @HugsDaniel. I mixed it up with app/views/spree/admin/variants/search.rabl which is gone in Spree 2.

@luisramos0
Copy link
Contributor

Hugs I see this PR is updating adjustments on the order page. There's an issue for two of the specs here: #2940
We need to make sure we know where 1. adjustments included in the line items and 2. shipping costs are being displayed.

@luisramos0
Copy link
Contributor

@HugsDaniel I pushed a new commit that fixes line item controller spec

@HugsDaniel HugsDaniel force-pushed the 3109-fix-orders-new branch 2 times, most recently from 9b38e9d to acc6fbd Compare January 31, 2019 16:10
@luisramos0 luisramos0 self-assigned this Jan 31, 2019
@luisramos0 luisramos0 changed the title [WIP] [Spree Upgrade] Fix admin new order page [Spree Upgrade] Fix admin new order page Jan 31, 2019
@luisramos0
Copy link
Contributor

luisramos0 commented Jan 31, 2019

No wonder @HugsDaniel was a bit stuck with this one. What a difficult job!
I have updated the description above: all the things to be done after this PR are mapped in other issues now.
We should review and merge this PR as is.

@luisramos0 luisramos0 force-pushed the 3109-fix-orders-new branch 2 times, most recently from e26801c to 4d784c2 Compare February 3, 2019 17:19
@luisramos0 luisramos0 changed the title [Spree Upgrade] Fix admin new order page [Spree Upgrade] WIP WIPFix admin new order page Feb 4, 2019
@luisramos0 luisramos0 changed the title [Spree Upgrade] WIP WIPFix admin new order page [Spree Upgrade] Fix admin new order page Feb 4, 2019
Copy link
Member

@mkllnk mkllnk left a comment

Choose a reason for hiding this comment

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

I can't comprehend all the view changes. I would need to look into what's changed in Spree and look into our modifications. That would be almost as much work as doing it again. ;-)

It looks all good though. If there is something important missing, we should find it in the testing phase and write specs for it.

spec/features/admin/orders_spec.rb Show resolved Hide resolved
# Moves the order back to the cart state
# A nil user keeps the order in the cart state
# Even if the edit page tries to automatically progress the order workflow
@order.state = 'cart'; @order.user = nil; @order.completed_at = nil; @order.save
Copy link
Contributor

@sauloperez sauloperez Feb 7, 2019

Choose a reason for hiding this comment

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

why not in multiple lines? we can even extract a helper method where we can document in detail why this is needed.

Copy link
Contributor

@luisramos0 luisramos0 Feb 7, 2019

Choose a reason for hiding this comment

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

👍
I keep it as multilines in the same place without extracting to method, I think the test is simple enough to take this.
see new commit.

@@ -101,18 +101,18 @@ def new_order_with_distribution(distributor, order_cycle)
scenario "displays error when incorrect distribution for products is chosen" do
d = create(:distributor_enterprise)
oc = create(:simple_order_cycle, distributors: [d])
puts d.name
puts @distributor.name
Copy link
Contributor

Choose a reason for hiding this comment

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

🙈

spec/features/admin/orders_spec.rb Show resolved Hide resolved
@sauloperez sauloperez merged commit 92dca0c into openfoodfoundation:2-0-stable Feb 12, 2019
@luisramos0
Copy link
Contributor

hurray!!!!

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.

4 participants