Try using a table to layout category view

This commit is contained in:
Kovid Goyal 2010-10-14 09:08:42 -06:00
parent 5523da3dde
commit f468fd5cf3
3 changed files with 14 additions and 16 deletions

View File

@ -206,30 +206,29 @@ h2.library_name {
/* }}} */ /* }}} */
/* Category {{{ */ /* Category {{{ */
.category ul { .category table {
list-style-type: none;
margin: 0; margin: 0;
padding: 0; padding: 0;
width: 100%;
border-collapse: collapse;
} }
.category li.category-item { .category tr.category-item td {
margin: 0.75em;
padding: 0.75em; padding: 0.75em;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
} }
.category li.category-item:hover { .category tr.category-item:hover {
background-color: #d6d3c9; background-color: #d6d3c9;
font-weight: bold;
-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;
} }
.category li.category-item h4 { display: inline } .category tr.category-item h4 { display: inline }
.category li.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

@ -92,10 +92,8 @@ function render_error(msg) {
// Category feed {{{ // Category feed {{{
function category() { function category() {
$(".category li").corner("15px"); $(".category tr").click(function() {
var href = $(this).find("span.href").html();
$(".category li").click(function() {
var href = $(this).children("span.href").html();
window.location = href; window.location = href;
}); });

View File

@ -106,9 +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'<li title="{4}" class="category-item">' templ = (u'<tr title="{4}" class="category-item">'
'<h4>{0}&nbsp;&nbsp;{1}</h4>&nbsp;&nbsp;{2}' '<td><h4>{0}</h4></td><td>{1}</td>'
'<span class="href">{3}</span></li>') '<td>{2}'
'<span class="href">{3}</span></td></tr>')
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':
@ -125,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(['<ul>'] + items + ['</ul>']) return '\n'.join(['<table>'] + items + ['</table>'])
# }}} # }}}