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

[WIP] tables #2092

Closed
wants to merge 13 commits into from
Closed

[WIP] tables #2092

wants to merge 13 commits into from

Conversation

Mandily
Copy link
Contributor

@Mandily Mandily commented Jul 14, 2017

I've started some work to clean up the tables in the Solidus admin. I think a lot of the existing table code is redundant now that we've got Bootstrap in the project, so I removed what I could to clean it up, and then added a couple of styles back in to "clean up" what was left. I've just tackled the index pages (except for the stock page) at the moment, and I'd like some feedback before I go through the rest of the views.

Orders
screen shot 2017-07-13 at 5 01 01 pm

Products
screen shot 2017-07-13 at 5 01 19 pm

Reports
screen shot 2017-07-13 at 5 00 41 pm

Promotions
screen shot 2017-07-13 at 5 05 50 pm

Users
screen shot 2017-07-13 at 5 22 22 pm

@Sinetheta @jhawthorn @tvdeyen @graygilmore can I get your thoughts on this?

@jhawthorn jhawthorn changed the title Wip tables [WIP] tables Jul 14, 2017
@cbrunsdon
Copy link
Contributor

I'm hardly the right person to comment, but everything here looks reasonable to me.

Though we'll likely have to do a semi-large manual QA to make sure there aren't tables somewhere in the deep dark parts of solidus we will need to change.

@tvdeyen
Copy link
Member

tvdeyen commented Jul 17, 2017

I will make a QA session tomorrow morning

@graygilmore
Copy link
Contributor

Cool! Going to run through this now.

Copy link
Contributor

@graygilmore graygilmore left a comment

Choose a reason for hiding this comment

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

  • spacing is a little odd on the products table (too much space between the image and the name)

It looks like almost all of the tables need some alignment adjustment. I'm going to have a look at fixing these.

@graygilmore
Copy link
Contributor

The stock management table in particular falls apart here. I had already been working on some changes to that table. I will coordinate with @Mandily to clean up that area.

@tvdeyen
Copy link
Member

tvdeyen commented Jul 18, 2017

Nice work @Mandily 👏

Sorry in advance - this is hence the nature of this change - a very long review comment 😞

I really like the new table style. Hence tables are a mayor UI pattern in Solidus admin there is still some work to do.

Walking through the admin I found these issues:

  1. All what @graygilmore said

  2. align-center should be removed from nearly all tables (some examples below) or the header also needs to be centered (like in the "Countries" table -> "States required" column)

countries - locations - settings 2017-07-18 09-42-44

tax categories - taxes - settings 2017-07-18 09-44-01

zones - locations - settings 2017-07-18 09-30-59

payment methods - payments - settings 2017-07-18 09-30-28

  1. Some tables has hard coded inline styles for padding-left or margin-left (like the "Product Properties" and "Reports" table)

reports

monosnap 2017-07-18 09-26-50

  1. Some tables with a "sorting handle" miss an empty header column - otherwise the second column header looks misplaced

product properties - product 10 - 8963 - products 2017-07-18 09-22-35

product properties - product 10 - 8963 - products 2017-07-18 09-22-24

monosnap 2017-07-18 09-24-26

  1. We should consider to top align all table cells. Tables that have more than one row though word wrapping look weird (like the "Order / Payments" or the "User / Store Credit" table)

order payments

store credit - mikki_langworth satterfield co uk - users 2017-07-18 09-55-09

Again, great work. Please feel free to contact me for help. Maybe we should even consider to split this PR up into smaller PRs.

Thanks for the great work!

@graygilmore
Copy link
Contributor

@tvdeyen beauty! I nabbed the align-centers yesterday but I'll grab these other ones, too. Just need access to push to @Mandily's PR. I also have a commit that removes the cycle() for odd/even classes.

There might also be some no-border classes that can go away now, too. We'll have clean tables in no time!

Mandily and others added 5 commits July 18, 2017 10:46
Bootstap handles the bulk of the styling and we no longer need these extra
styles.
This increases data scanability.
Now that we have new table styles where table headings are aligned to
the left by default we want our table cells to follow suit.
These no longer apply any styles. If striping is desired this can be
much more easily accomplish by using nth-child in your CSS.
Now that we are using Bootstrap table styles we no longer need to push
around pixels like this.
This was necessary before switching to Bootstrap table styles but this
class now has no effect.
@graygilmore
Copy link
Contributor

I believe I've nabbed all of @tvdeyen's concerns as well as a couple of my own. This PR is rebased and I believe ready for a proper review.

This will make sure that the table headers properly line up with their
content below.
Now that the majority of text is left aligned this will make multi-line
table cells easier to read.
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 progress. Thanks @graygilmore for helping out. I found some small glitches here and there. Just commented them below for further reference, but will provide a PR against @Mandily branch.

border-right: 1px solid $color-border;
border-bottom: 1px solid $color-border;
vertical-align: middle;
vertical-align: top;
Copy link
Member

Choose a reason for hiding this comment

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

This is bootstraps default. We can remove this line

Copy link
Member

Choose a reason for hiding this comment

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

We should consider to add a line-height: 2 to fix the vertical alignment of single line rows. This seems like a large value, but it actually looks pretty good.

Before

line-height-before

After

line-height-after

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 actually prefer the before to the after. As a general rule, I try to keep less space between the lines of the same label/list item/paragraph and more between it and whatever is around. It helps keep the item grouped with itself a little better.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm with @Mandily on this one, not a fan of the large line-height.

Copy link
Member

Choose a reason for hiding this comment

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

I agree that the large line-height is not ideal, but I also think that the vertical alignment of single line rows should be corrected. What makes me thinking is that the default tables in Bootstraps documentation are all correctly aligned. 🤔

I will have a second look into this problem

Copy link
Member

Choose a reason for hiding this comment

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

@graygilmore @Mandily I know why the vertical alignment for single line rows is off. The action buttons occupy more space then the text and thats why the row is too high.

monosnap 2017-07-19 21-09-55

Solution would be to get rid of the round background.

option types - products 2017-07-19 21-13-06

We should handle this problem in separate PR.
WDYT about this approach?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Separate PR makes sense. I think we're due for another solution in that area entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A bunch of these (this particular example included) can be removed and replaced with the inline editing solution that Martin worked on. I linked a drive document in #2042 for those. I'm ok with this style for the ones that remain.

@@ -1,6 +1,6 @@
<tr class="option_value fields" id="spree_<%= dom_id(f.object) %>" data-hook="option_value" class="<%= cycle('odd', 'even')%>">
<tr class="option_value fields" id="spree_<%= dom_id(f.object) %>" data-hook="option_value">
<% if f.object.persisted? %>
Copy link
Member

Choose a reason for hiding this comment

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

The <td> only appears if the object is persisted. This looks wrong compared to other sortable tables.

I suggest changing this to:

<td>
  <% if f.object.persisted? %>
    <span class="handle"></span>
    <%= f.hidden_field :id %>
  <% end %>
</td>

and remove the colspan from the name cell.

Before

option types - before

After

option types - after

@@ -65,17 +65,17 @@
<tr data-hook="admin_products_index_headers">
<th><%= Spree::Variant.human_attribute_name(:sku) %></th>
<th colspan="2"><%= sort_link @search,:name, Spree::Product.human_attribute_name(:name), { default_order: "desc" }, {title: 'admin_products_listing_name_title'} %></th>
Copy link
Member

Choose a reason for hiding this comment

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

We should remove the colspan here and add an empty <td> instead.

<td class="align-center"><%= render 'spree/admin/shared/image', image: product.display_image, size: :mini %></td>
<tr <%== "style='color: red;'" if product.deleted? %> id="<%= spree_dom_id product %>" data-hook="admin_products_index_rows">
<td><%= product.sku %></td>
<td><%= render 'spree/admin/shared/image', image: product.display_image, size: :mini %></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 image should have a align-center class and we should reduce the column width, so the image looks belonging to the name.

@tvdeyen
Copy link
Member

tvdeyen commented Jul 19, 2017

tvdeyen added 3 commits July 19, 2017 10:07
The table cell for the sortable handle of the options types
form was not present for newly builded records. The cell should
always be present only the handle should be hidden.
The stock management table still had a lot of redundant styles.
@graygilmore
Copy link
Contributor

Is there any other work required to get this into an acceptable state?

@tvdeyen
Copy link
Member

tvdeyen commented Jul 31, 2017

  • We redundantly declare vertical-align: top on table td although this is Bootstrap's default
  • Sortable tables should have vertically centered table rows
  • The reimbursements table of customer return is horizontally centered. It sits in a fieldset with align-center class.

All of the above are solved in Mandily#2

@tvdeyen
Copy link
Member

tvdeyen commented Jul 31, 2017

@graygilmore FYI

@jhawthorn jhawthorn added this to the 2.4.0 milestone Aug 9, 2017
@jhawthorn
Copy link
Contributor

jhawthorn commented Aug 17, 2017

Merged as #2159

@jhawthorn jhawthorn closed this Aug 17, 2017
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.

5 participants