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 cart page revamp #1710

Merged
merged 16 commits into from
Feb 28, 2017
Merged

Admin cart page revamp #1710

merged 16 commits into from
Feb 28, 2017

Conversation

jhawthorn
Copy link
Contributor

@jhawthorn jhawthorn commented Feb 9, 2017

This builds on top of #1709.

New Order

  • We display the "new item" row immediately
  • "Add item" is disabled (we are already adding a row)
  • The "cancel" button is removed

Validation failed

  • After clicking save
  • blank fields are highlighted in red

After saving one item

  • "Add item" button is enabled

Adding second item

  • "Add item" button is disabled
  • Cancel button is available (clicking it removes the row and re-enables the "Add item button")

@jhawthorn jhawthorn added the WIP label Feb 9, 2017
within(#{table_column.inspect}) do
fill_in #{selector.inspect}, with: #{quantity.inspect}
end
WARN
Copy link
Member

Choose a reason for hiding this comment

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

Ah, you already did :)

@Mandily
Copy link
Contributor

Mandily commented Feb 10, 2017

👍 Looks good to me!

@jhawthorn jhawthorn removed the WIP label Feb 10, 2017
@jhawthorn jhawthorn changed the title [WIP] Cart page revamp Cart page revamp Feb 10, 2017
@jhawthorn jhawthorn changed the title Cart page revamp Admin cart page revamp Feb 14, 2017
@jhawthorn jhawthorn added changelog:solidus_backend Changes to the solidus_backend gem UI labels Feb 14, 2017
@vfonic
Copy link
Contributor

vfonic commented Feb 17, 2017

I've never seen the UI in which "Add Item" is disabled. From my experience, the button/link is enabled and, when the user clicks on it, it adds a new empty row (or if we don't want that, we can focus on the above empty row). If the user didn't want to do this, s/he can remove that row.
To me, this UI looks like:
I fill in the cart item details and then "Add Item" button is enabled, so I click on it to confirm adding this first item. Of course this is wrong, since "Add Item" doesn't confirm my action, but the button on the right does.

PS I've noticed that action buttons/icons in solidus admin are usually outside of the table and table row. I think if the action button is referring to the item in the table row, it should be inside the table itself:
Screenshot
Not sure why it was explicitly made look like it doesn't belong to the table.

PPS I'm trying to bring a new "outside" view. Maybe I'm wrong in some things so please either correct me or ignore me if you want to ship things faster. ;)

@Mandily
Copy link
Contributor

Mandily commented Feb 17, 2017

I also like the idea of putting the icons in the table to keep relative things grouped together, but it might be better to keep it separate for consistency right now, and then globally change the location of all icons in a separate PR. I realize in suggesting that though, someone would have to volunteer to do that chunk of work. This sounds like a thing that I might be capable of, but I'm not sure when I'll have the time.

I can see how on first glance a user might think that the "add item" button at the bottom of the page would save the new row. I know they're figure it out and learn pretty quickly, but in the interest of a more intuitive UI, it would be nice if we could rename the label to "Add new item"

The note about the disabled button raises a bigger discussion about whether we want to put the user into a stateful interaction (which is how Solidus works now) to keep them focused on their task or make it stateless to give them more flexibility. Again, I'm inclined to say keep it consistent until we have a bigger bandwidth to think through and change things on a more global scale.

@jhawthorn
Copy link
Contributor Author

Not sure why it was explicitly made look like it doesn't belong to the table.

This is the pattern used throughout the admin and is way outside the scope of this PR.

If you have thoughts on how the admin UI should be please file a new issue or come discuss it in our #gui slack channel

@vfonic
Copy link
Contributor

vfonic commented Feb 18, 2017

@jhawthorn

I was talking generally:

PS I've noticed that action buttons/icons in solidus admin are usually outside of the table...

I'll start the discussion in #gui

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.

Great. Some thoughts about backbone model organizing as discussed in #1715

<a class="edit-line-item fa fa-edit no-text with-tip" href="#" title="{{ t "actions.edit" }}"></a>
<a class="delete-line-item fa fa-trash no-text with-tip" href="#" title="{{ t "actions.delete" }}"></a>
{{/if}}
</td>
Copy link
Member

Choose a reason for hiding this comment

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

The indenting of this file is a little off

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rebased and fixed.

.line-item:not(.editing) {
.save-line-item,
.cancel-line-item,
.line-item-qty-edit {
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove these classes from the html as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.save-line-item and .cancel-line-item are still in use and also used in specs (a more dubious use).

I'm not sure they aren't appropriate classes to have.

Copy link
Member

Choose a reason for hiding this comment

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

.line-item-qty-edit and .line-item-qty-show are JS utility classes used in the old JS only AFAIK. Maybe there are others. Not mandatory, for sure. But I like to clean up as we have the chance.

$ ->
if $("table.line-items").length
url = Spree.routes.orders_api + "/" + order_number
lineItemModel = Backbone.Model.extend
Copy link
Member

Choose a reason for hiding this comment

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

Can we put this model into its own file and use the Spree.Model namespace discussed in #1715?

Copy link
Contributor Author

@jhawthorn jhawthorn Feb 28, 2017

Choose a reason for hiding this comment

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

Can't be done here. At this point the model needs to be defined where we have access to url. #1715 is a follow up to this where this will be fixed.

Copy link
Member

Choose a reason for hiding this comment

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

Okidoki

$('.line-items').remove()
window.Spree.advanceOrder()

Spree.CartLineItemView = Backbone.View.extend
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can also introduce a Spree.Views namespace for views as we discussed for models in #1715?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd rather address this in the #1715, which is a follow up to this. This PR was intended only to be the UI change, with #1715 being a more complete switch to backbone.

Copy link
Member

Choose a reason for hiding this comment

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

Sure.

</table>
<% end %>
<tbody>
</tbody>
Copy link
Member

Choose a reason for hiding this comment

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

It really helped me today that in the other backbone powered templates we have a comment noting that the content is handled via JS. Maybe we could also add a comment here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Excellent idea

Copy link
Member

Choose a reason for hiding this comment

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

Not mine ;) d2ec380

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 all your late work on making the admin UX better 🙏🏻

@jhawthorn
Copy link
Contributor Author

jhawthorn commented Feb 28, 2017

Can't run test on CircleCI because of AWS issues, but this is passing locally

:shipit: 🔥

@jhawthorn jhawthorn merged commit 0d9c72b into solidusio:master Feb 28, 2017
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.

5 participants