Download & Extend

Display empty text messages for main listing Views in tables

Project:Drupal Commerce
Version:7.x-1.x-dev
Component:User experience
Category:task
Priority:normal
Assigned:mr.baileys
Status:closed (fixed)
Issue tags:Usability

Issue Summary

Reviewing Drupal commerce I saw there are no "Empty tables", instead we display just the line "No products have been created yet." where it should display a table, within that a line that says "There are no products links yet. Add product."

AttachmentSizeStatusTest resultOperations
empty-product-table.png5.35 KBIgnored: Check issue status.NoneNone

Comments

#1

#2

Tagging.

#3

Views is now fixed, can we fix this?

#4

Assigned to:Anonymous» bojanz

Sure. This is an easy tweak.

#5

#6

Status:active» needs review

#7

Title:No empty tables» Display empty text messages for main listing Views in tables
Category:bug report» feature request
Status:needs review» needs work

I don't think we need this option on every table (for example, the shopping cart shouldn't need it anywhere, and some Views don't have empty text like the line item table and Payment tab View). Additionally, the mock-up specified links to add missing items if applicable.

I'd just limit this to the three main Views for now: Customer profiles, Products, and Orders.

#8

Category:feature request» bug report
Assigned to:bojanz» Anonymous

Why is this not in yet?

#9

Category:bug report» task

I guess because no one got around to fixing it. *Bump.* : D

#10

Status:needs work» needs review
Issue tags:-dcsprint5+low-hanging fruit

Patch attached that switches to using table layout for the empty text for the Customer Profiles, Orders and Products-views.

I did not implement the "links to add missing items" mentioned in #7 and shown in the mock-up since:

  • It would require to switch the text format from plain-text to formatted to include the link tags. I think plain-text is the only text format guaranteed to be available (I installed commerce on a minimal core profile and do not have any other text formats available), so switching text format might break the view on some sites.
  • The link to add a "missing item" is displayed prominently above the table (see mock-up). Is this sufficient?
AttachmentSizeStatusTest resultOperations
1029638-commerce-views-empty-table.patch2.57 KBIdlePASSED: [[SimpleTest]]: [MySQL] 3,546 pass(es).View details

#11

Here's what it looks like for Customer Profiles with the patch from #10 applied:

customer-profiles-empty-table-view.png

AttachmentSizeStatusTest resultOperations
customer-profiles-empty-table-view.png12.97 KBIgnored: Check issue status.NoneNone

#12

Status:needs review» reviewed & tested by the community

Looks good.

#13

Status:reviewed & tested by the community» needs work

Actually according to http://drupal.org/node/1146122 - it should always also have the "action" in this case Add a customer profile at the end of the empty message.

#14

Status:needs work» needs review

Fair enough, here's a patch that includes the action links in the empty results text.

Screenshot of the empty order UI view

For now I've just switched to "Filtered HTML" since this is used by Commerce in a number of places. I'll open a separate issue to address the fact that "Filtered HTML" is not always available which might cause link-tags to show up escaped.

AttachmentSizeStatusTest resultOperations
1029638-14-commerce-views-empty-table.patch5.14 KBIdlePASSED: [[SimpleTest]]: [MySQL] 3,546 pass(es).View details
Screenshot.png11.75 KBIgnored: Check issue status.NoneNone

#15

Nice, I don't think I was aware that Views could still use the table for the empty message.

mr.baileys is really rocking the queue lately! I smell a big Commerce project in the works over there... : )

Will leave this open for review later today.

#16

Status:needs review» needs work

I'm not sure I want to commit this as is while it depends on relative URLs for the empty message text. The problem is Drupal may be used in a folder on the domain (which is the case for my development environment, for example), and using a relative URL beginning with a / will break these "add" links. This means we may actually have to implement area handlers for the empty text (if that's even possible). I'd be fine with the short term workaround of just committing the patch without the links until we have a solution for those, but I also suppose there isn't much reason to rush it in.

#17

Assigned to:Anonymous» mr.baileys

Ah yes. People with clean URLs disabled will probably not like this solution either.

#18

Status:needs work» needs review

First exposure to writing handlers for the Views 3 API...

This patch creates 3 area handlers to display empty text for Products, Orders and Customer profiles.The screenshot from #14 remains valid, it's just the way that the text is generated that changed. Using a views handler does allow us to bypass the problem the the Filtered HTML format might not be available.

One thing to note is that ever since the exposed filters were added to filter by SKU/order number/customer name, the empty text message used is not longer correct. In all three cases it states that no entity of that type has been created yet, while in reality they might exist but be ignored because of the exposed filter. So I guess we need to tweak the actual text too?

AttachmentSizeStatusTest resultOperations
1029638-18-empty-text-views-handlers.patch11.31 KBIdlePASSED: [[SimpleTest]]: [MySQL] 3,546 pass(es).View details

#19

Less low-hanging than I figured :)

#20

Hmm, good call. Maybe we can just have the handler check to see if there are any filters on the View, and if so have it say something like "No products match your filter criteria." without including the add link.

#21

Status:needs review» fixed

I went ahead and pushed this through to completion. First I moved all the area handlers to the base modules instead of the UI modules; they should really be available whether the site is using the default UI modules or not. To accommodate this, I added an option for the 'add_path' that will be used to generate the appropriate add link if specified. As I described above, I also check to see if there's any exposed filter input in the View, and if so I assume the View has been filtered and display an appropriate message instead of the default empty text message.

Commit: http://drupalcode.org/project/commerce.git/commitdiff/182bbcb

#22

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.