Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I took some examples from TypePad (http://www.typepad.com/news/screenshots/lists-links.html) and Drupal 4.2 (http://drupal.org/node/view/1912) and created a patch to improve the look of Drupal standard tables.
Changes are marked in attached screenshot.
The patch will follow in next followup.
Comment | File | Size | Author |
---|---|---|---|
#26 | 011.kika.prettytablefix.png | 31.12 KB | kika |
#25 | 011.kika.misc.drupal.css.patch | 521 bytes | kika |
#22 | highlight_active_column_in_tables_4.patch | 6.6 KB | moshe weitzman |
#20 | 010.kika.commentsbug.png | 16.84 KB | kika |
#19 | 010.kika.prettytables.png | 27.02 KB | kika |
Comments
Comment #1
kika CreditAttribution: kika commentedHere'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)
Comment #2
jhriggs CreditAttribution: jhriggs commentedI 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.
Comment #3
kika CreditAttribution: kika commented> 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)
Comment #4
kika CreditAttribution: kika commented> 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
Comment #5
Brian@brianpuccio.net CreditAttribution: Brian@brianpuccio.net commentedMy (personal, scientifically unproven) opinion is that I like the second one.
Comment #6
Dries CreditAttribution: Dries commentedI 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.
Comment #7
Dries CreditAttribution: Dries commentedFor 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?
Comment #8
moshe weitzman CreditAttribution: moshe weitzman commentedattached 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.
Comment #9
Dries CreditAttribution: Dries commentedis_array($header)
inif (is_array($header) && $i === $ts['index']) {
when$header
does not appear to be used further down?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>
)?Comment #10
moshe weitzman CreditAttribution: moshe weitzman commentednew patch which
- more secure tablesort SQL
- changed class name to 'active'. themes should use these css classes
- 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.
Comment #11
moshe weitzman CreditAttribution: moshe weitzman commentednew patch. i had missed one instance of class='cell-highlight'
Comment #12
Dries CreditAttribution: Dries commentedThis patch is a _lot_ better but seems to overwrite existing 'td classes'. Take a look at the watchdog table.
Comment #13
moshe weitzman CreditAttribution: moshe weitzman commentedattached patch adds onto existing TD classes instead of overwriting them.
Comment #14
moshe weitzman CreditAttribution: moshe weitzman commentedeven 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.
Comment #15
Dries CreditAttribution: Dries commentedCommitted 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.
Comment #16
kika CreditAttribution: kika commentedHere come the patches...
Comment #17
kika CreditAttribution: kika commentedComment #18
kika CreditAttribution: kika commentedComment #19
kika CreditAttribution: kika commentedAn added screeshot to check the 010.* patches impact
Comment #20
kika CreditAttribution: kika commentedWhile 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
Comment #21
moshe weitzman CreditAttribution: moshe weitzman commentedattached 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
Comment #22
moshe weitzman CreditAttribution: moshe weitzman commentedthis time with a patch actually attached
Comment #23
Dries CreditAttribution: Dries commentedCommitted to HEAD. Thanks Kristjan and Moshe.
Comment #24
Dries CreditAttribution: Dries commentedComment #25
kika CreditAttribution: kika commentedA small patch what removes the offending "table {witdh: 100%}", breaking the Chameleon theme and also enables the table bottom-borders on IE6.
Comment #26
kika CreditAttribution: kika commentedAdding a screenshot illustrating the 011.* patch behaviour
Comment #27
Dries CreditAttribution: Dries commentedCommitted to HEAD.
Comment #28
(not verified) CreditAttribution: commentedComment #29
KeithDaniels CreditAttribution: KeithDaniels commentedPossible 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