Add 'region' class to regions

jjeff - May 1, 2008 - 17:48
Project:Zen
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:critical
Assigned:jjeff
Status:closed
Description

I'm starting some experimental work on a drag-and-drop block rearrangement system (similar to iGoogle or BBC.co.uk). In order to do this, there needs to be some sort of semantic markup for JQuery to target regions and to figure out which region they represent.

This patch adds class="region" to all of the divs which immediately surround output of the contents of a region (i.e. blocks). It also adds a 'name' attribute to this div with the internal naming convention of the region. This way JQuery can say, "Find me all the regions and tell me their names." Semantically, they're regions. It's also useful to know their names.

This patch also rearranges #site-name div to place the <strong> tag INSIDE the <a> instead of surrounding it. This makes it possible to make the 'a' tag into a block element, put a background image on it and then place the contents of the 'strong' tag off the page. The end result is basically an text replacement (usually a site logo) which is still clickable to return the user to the home page. Without the 'strong' tag inside the 'a' tag, this would be a much trickier maneuver.

Sorry about this being essentially two different issues combined into one, but I though it better to submit the patch that I had rather than one I *might* create in the future.

AttachmentSize
zen-region-classes.patch3.38 KB

#1

jjeff - May 5, 2008 - 21:41
Priority:normal» critical

I'm bumping this one up in priority since it's an HTML structure change. The movement of the <strong> tag is especially important for doing text-replacement on the site name element. I'd really like to see this change get into the next release version.

#2

JohnAlbin - May 5, 2008 - 21:57
Category:task» feature request

I see the utility in this request. And while <strong><a>link</a></strong> seems more natural, the only other alternative HTML that would do what you want, <strong><a><span>link</span></a></strong>, is definitely no good.

I will make sure this goes in before a 6.x-1.0-beta1 is released.

#3

jjeff - May 5, 2008 - 22:10

See... John, you *get* me... I like that about you!

:-)

Which is to say... "exactly!"

#4

JohnAlbin - May 13, 2008 - 21:57

I split off the #site-name strong part to a separate issue: #258123: Rearrange placement of #site-name strong

I have a concern with the remaining part of this. "name" isn't a valid attribute for a div tag.

Take a look at the "title" attribute: http://127.0.0.1/reference/xhtml/html401/struct/global.html#adef-title

Looking at the code in your patch, I think an attribute that "offers advisory information about the element for which it is set" is an exact semantic fit to what you are putting in the "name" attribute.

And jQuery should still be able to read the data out of the title attributes.

So, I've updated the patch to change name to title.

Finally, does the data in the title attribute need to be a js var name? I'm wondering why the patch uses title="content_top" instead of title="<?php print t('Content top'); ?>"

AttachmentSize
zen-region-classes.patch2.7 KB

#5

JohnAlbin - May 14, 2008 - 14:43
Title:Add 'region' class to regions. Also rearrange placement of #site-name strong» Add 'region' class to regions

#6

JohnAlbin - May 14, 2008 - 17:06

Per our IRC conversation, here is a new patch that adds class="region region-REGION_NAME"

AttachmentSize
zen-region-classes.patch2.7 KB

#7

JohnAlbin - May 14, 2008 - 17:09
Status:patch (code needs review)» fixed

Committed.

#8

Anonymous (not verified) - May 28, 2008 - 17:13
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.