Permalink
Browse files

Two gallery changes:

- display thumbnails as sized to fit space instead of cropped
- sort games by id descending (roughly most recent first)
  • Loading branch information...
1 parent 0c018e1 commit e1bbadfd3b9efcd64e3ea1e90e14dc2b533fd8d1 @potch potch committed Jan 14, 2011
Showing with 10 additions and 5 deletions.
  1. +5 −4 apps/games/templates/games/game_listing.html
  2. +1 −1 apps/games/views.py
  3. +4 −0 media/css/games.css
@@ -1,9 +1,10 @@
<section class="game" id="game-{{ game.id }}">
<div class="thumb">
- <div>
- {% if game.screenshot_set.all %}
- <img src="{{ game.screenshot_set.all.0.get_absolute_url }}">
- {% endif %}
+ {% if game.screenshot_set.all %}
+ <div style="background-image: url({{ game.screenshot_set.all.0.get_absolute_url }});">
@potch

potch Jan 14, 2011

Owner

hush you.

@jsocol

jsocol Jan 14, 2011

Member

I recall Ricky running into a problem with Django templates last week. I believe his response was quite profane. Dirty Django indeed.

+ {% else %}
+ <div>
+ {% endif %}
</div>
</div>
<h2><a href="{{ game.get_absolute_url }}">{{ game.name }}</a></h2>
View
@@ -103,7 +103,7 @@ def view_list(request):
if not user or not user.is_superuser:
filters.append(Q(is_approved=True))
- games = Game.objects.filter(reduce(or_, filters, Q()))
+ games = Game.objects.filter(reduce(or_, filters, Q())).order_by('-id')
@gkoberger

gkoberger Jan 14, 2011

Why not sort by rating, descending? Maybe weight it randomly somehow, so you can't see exactly who's winning- but make it so that the best is at the top. Nobody is going to want to go through 25 games to get to one good one, and we'd want to put our best foot forward.

@potch

potch Jan 14, 2011

Owner

let's say, hypothetically, that that isn't possible because average ratings are never calculated and associated with the game model.

@jsocol

jsocol Jan 14, 2011

Member

I'd rather not order by random since it isn't stable and this is roughly "newest first." Which is fine. Though Alpha may make more sense, ultimately.

return render(request, 'games/list.html', {'games': games})
View
@@ -60,6 +60,10 @@
.thumb div {
background: url("/media/img/game_placeholder.png");
+ background-position: center;
+ -webkit-background-size: cover;
+ -moz-background-size: cover;
@gkoberger

gkoberger Jan 14, 2011

I'm assuming this is on purpose, to line things up? Looks a bit weird, but I actually like it- it's almost like nesting them.

@jsocol

jsocol Jan 14, 2011

Member

If even Fligtar things your code is gross...

@potch

potch Jan 14, 2011

Owner

A guy seriously can't have a little CSS formatting whimsy in his 1am commit huh?

+ background-size: cover;
width: 71px;
height: 71px;
overflow: hidden;

0 comments on commit e1bbadf

Please sign in to comment.