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 ul {
list-style-type: none;
.category table {
margin: 0;
padding: 0;
width: 100%;
border-collapse: collapse;
}
.category li.category-item {
margin: 0.75em;
.category tr.category-item td {
padding: 0.75em;
text-align: center;
cursor: pointer;
}
.category li.category-item:hover {
.category tr.category-item:hover {
background-color: #d6d3c9;
font-weight: bold;
-moz-box-shadow: 5px 5px 5px #ccc;
-webkit-box-shadow: 5px 5px 5px #ccc;
box-shadow: 5px 5px 5px #ccc;
}
.category li.category-item h4 { display: inline }
.category li.category-item span.href { display: none }
.category tr.category-item h4 { display: inline }
.category tr.category-item span.href { display: none }
#groups span.load_href { display: none }

View File

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

View File

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