When I recently made a View with the table style I was surprised to not find any first and last classes on the first and last rows of the view.

I made a little patch that adds first and last classes - it's useful to for example getting rid of a border on the first or last row to make the view better looking.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

merlinofchaos’s picture

Status: Needs review » Needs work

Hmm. I think I'd rather see views-row-first and views-row-last. You never know how 'first' and 'last' will be used by a theme thinking they own the classes.

voxpelli’s picture

I would disagree - 'first' and 'last' are in my opinion the correct "semantic" classes and if anyone would like to limit a css definition to apply only on a row in a views table they can do so by writing: .views-table tr.first

Also - currently the rows are assigned the classes 'odd' and 'even' and to be consistent with the new classes either these should be changed in to views-row-odd and views-row-even (which I wouldn't like) or 'first' and 'last' shouldn't be prefixed.

merlinofchaos’s picture

You have it the other way around. Some theme is probably already going to have:

elements .first { 
  ... 
}

somewhere, and bam, suddenly their Views will be messed up and some user will have no idea why.

I understand the desire for semantic markup, but semantic markup fails when the left hand doesn't know what any of the left fingers are doing, let alone the right hand, elbow and shoulder. =)

dawehner’s picture

Version: 6.x-2.5 » 6.x-2.x-dev
Status: Needs work » Needs review
FileSize
512 bytes

Updated patch.

merlinofchaos’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

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