More semantic table markup.

This commit is contained in:
Kovid Goyal 2010-10-14 09:38:52 -06:00
parent f468fd5cf3
commit dbcf47468b
3 changed files with 23 additions and 16 deletions

View File

@ -206,29 +206,38 @@ h2.library_name {
/* }}} */ /* }}} */
/* Category {{{ */ /* Category {{{ */
.category table { .category > div.category-container {
margin: 0;
padding: 0;
width: 100%; width: 100%;
border-collapse: collapse; margin-top: 1ex;
margin-bottom: 1ex;
display: table;
} }
.category tr.category-item td { .category div.category-item {
display: table-row;
}
.category div.category-item > div {
padding: 0.75em; padding: 0.75em;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
display: table-cell;
} }
.category tr.category-item:hover { .category div.category-name { font-weight: bold }
.category div.category-item:hover > div {
background-color: #d6d3c9; background-color: #d6d3c9;
-moz-box-shadow: 5px 5px 5px #ccc; -moz-box-shadow: 5px 5px 5px #ccc;
-webkit-box-shadow: 5px 5px 5px #ccc; -webkit-box-shadow: 5px 5px 5px #ccc;
box-shadow: 5px 5px 5px #ccc; box-shadow: 5px 5px 5px #ccc;
border-radius: 15px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
} }
.category tr.category-item h4 { display: inline } .category div.category-item span.href { display: none }
.category tr.category-item span.href { display: none }
#groups span.load_href { display: none } #groups span.load_href { display: none }

View File

@ -77,8 +77,6 @@ function init() {
function toplevel() { function toplevel() {
$(".sort_select").hide(); $(".sort_select").hide();
$(".toplevel li").corner("15px");
$(".toplevel li").click(function() { $(".toplevel li").click(function() {
var href = $(this).children("span").html(); var href = $(this).children("span").html();
window.location = href; window.location = href;
@ -92,7 +90,7 @@ function render_error(msg) {
// Category feed {{{ // Category feed {{{
function category() { function category() {
$(".category tr").click(function() { $(".category .category-item").click(function() {
var href = $(this).find("span.href").html(); var href = $(this).find("span.href").html();
window.location = href; window.location = href;
}); });

View File

@ -106,10 +106,10 @@ def render_rating(rating, container='span'): # {{{
def get_category_items(category, items, db, datatype): # {{{ def get_category_items(category, items, db, datatype): # {{{
def item(i): def item(i):
templ = (u'<tr title="{4}" class="category-item">' templ = (u'<div title="{4}" class="category-item">'
'<td><h4>{0}</h4></td><td>{1}</td>' '<div class="category-name">{0}</div><div>{1}</div>'
'<td>{2}' '<div>{2}'
'<span class="href">{3}</span></td></tr>') '<span class="href">{3}</span></div></div>')
rating, rstring = render_rating(i.avg_rating) rating, rstring = render_rating(i.avg_rating)
name = xml(i.name) name = xml(i.name)
if datatype == 'rating': if datatype == 'rating':
@ -126,7 +126,7 @@ def get_category_items(category, items, db, datatype): # {{{
xml(desc), xml(quote(href)), rstring) xml(desc), xml(quote(href)), rstring)
items = list(map(item, items)) items = list(map(item, items))
return '\n'.join(['<table>'] + items + ['</table>']) return '\n'.join(['<div class="category-container">'] + items + ['</div>'])
# }}} # }}}