Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kika’s picture

Here's the patch

Apply against 4-4 version of misc/drupal.css

(I had to mark this issue as CVS one since 4.4 is not the option yet in project.module)

jhriggs’s picture

I like not wrapping the asc/desc control alone. It should be tied to the last word in the header. I don't like not wrapping the header at all, though. When the header is sufficiently long, and the content in the column is sufficiently short, I would much rather have it wrap...especially if I am trying to fit a lot of columns in a table. I am undecided about always forcing tables to be 100% width. I can think of cases where I may not want that. Finally, I am more or less indifferent with regards to the cell borders. They don't bother me, and actually help make distinctions between units of data (cells).

Couldn't this all just be handled in the theme or CSS, though? Why patch core? The only thing I see that may be worth adding to core is not wrapping the asc/desc control by itself. That may be a small usability issue. Everything else regarding the look, though, seems to be subjective.

kika’s picture

> When the header is sufficiently long, and the content in
> the column is sufficiently short, I would much rather have it
> wrap...especially if I am trying to fit a lot of columns in a table.

The solution is to patch tablesort.inc to include a special class to the cell where the asc/desc image currenly is. Even better, add a special class to the entire column - to allow "sorted by" column to stand out better (you can see such a behaviour in WinXP and OSX)

> Couldn't this all just be handled in the theme or CSS, though? Why
> patch core?

since it already being done there, i just tidied it up.

I do not care where the actual styling is taking place, in core or in xtemplate (a barebone example theme with übercool table is looking pretty weird)

kika’s picture

> Even better, add a special class to the entire
> asc/desc column -
> to allow "sorted by" column to stand out better
> (you can see such a behaviour in WinXP and OSX)

A mockup that expresses this behaviour (emphasis
of asc/desc column) is included

Brian@brianpuccio.net’s picture

My (personal, scientifically unproven) opinion is that I like the second one.

Dries’s picture

I committed this patch to HEAD.

The 'width: 100%;' makes wide tables look better, but makes narrow tables look weird (eg. admin/user/role). We need to fine-tune (or revert) that, which is why I set the status of this report to 'active'.

The proposed improvements look good. I like version #1 best as it is easier for the eye (less intrusive). It makes the tables look really nice.

Dries’s picture

For the pretty tables to work, we'd have to extend the emitted HTML code. Suggestions for how this HTML code should look like so we can do both version #1 and version #2 of the proposed tables?

moshe weitzman’s picture

Assigned: Unassigned » moshe weitzman
FileSize
4.12 KB

attached patch adds a class attribute called 'cell-highlight' to all cells within the actively sorted column. This class is not new - its the one we currently use in the table header. any themes currently defining this css class will automatically enjoy full column highlighting (e.g. phptemplate). Other themes may want to take advantage as well.

Dries’s picture

  1. Why do we do is_array($header) in if (is_array($header) && $i === $ts['index']) { when $header does not appear to be used further down?
  2. Is cell-highlight a good name? As a theme designer I wouldn't realize it is used to denote a cell that belongs to the active column. Maybe <tr class="active"> is more semantic (<tr>, not <td>)?
moshe weitzman’s picture

new patch which
- more secure tablesort SQL
- changed class name to 'active'. themes should use these css classes

th .active
td .active

- tidied up the is_array($header) stuff a bit. It is still present though because we want to skip cell highlighting for tables which don't have headers.

moshe weitzman’s picture

new patch. i had missed one instance of class='cell-highlight'

Dries’s picture

This patch is a _lot_ better but seems to overwrite existing 'td classes'. Take a look at the watchdog table.

moshe weitzman’s picture

attached patch adds onto existing TD classes instead of overwriting them.

moshe weitzman’s picture

even better this time. tables without sortable headers no longer get the 'active' attribute ...

DRUPAL.CSS
added italics to sorted column. may be further defined in theme css. use the css classes 'th.active' and 'td.active'. also prevented image in active table header from wrapping.

Dries’s picture

Committed to HEAD.

Kika, Megagrunt and friends: now all preparations have been made to support 'pretty tables', we expect theme patches to hit the patch queue. Marking this active, not fixed.

kika’s picture

FileSize
647 bytes

Here come the patches...

kika’s picture

kika’s picture

kika’s picture

FileSize
27.02 KB

An added screeshot to check the 010.* patches impact

kika’s picture

FileSize
16.84 KB

While creating the 010.* patches, I discovered the bug on "Home » administer
Comments" page: the 'delete comment' column is marked as "active", not the 'time' column, as it should be. An attached screenshot illustrates this odd behaviour

moshe weitzman’s picture

attached patch:
- fixes comment.module bug highlighted by kika in previous comment
- move a little tablesort logic from theme_table() to tablesort_x functions.
- fix bug when multiple sortable tables appear on same page

moshe weitzman’s picture

this time with a patch actually attached

Dries’s picture

Committed to HEAD. Thanks Kristjan and Moshe.

Dries’s picture

kika’s picture

FileSize
521 bytes

A small patch what removes the offending "table {witdh: 100%}", breaking the Chameleon theme and also enables the table bottom-borders on IE6.

kika’s picture

FileSize
31.12 KB

Adding a screenshot illustrating the 011.* patch behaviour

Dries’s picture

Committed to HEAD.

Anonymous’s picture

KeithDaniels’s picture

Possible interactions with class="active"?

I am having problems getting a:active{} to work with Drupal in any browser though I can get it to work in other sites. Is it possible that your use of class="active" is interfering with this proper functioning of this CSS code?

Also

When I try to use something like .content .active {color:#ff0000} to control an elements appearance the settings in .content .active a:visited{} override those settings. I know you are supposed to use "a.content" but that syntax does not work when I try to use it.

Is it possible that your use of the class "active" is conflicting with a:active and causing this?

I am going to post this else where since this thread seems to be over...

Keith