Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit e1bbadfd3b9efcd64e3ea1e90e14dc2b533fd8d1 1 parent 0c018e1
@potch potch authored
View
9 apps/games/templates/games/game_listing.html
@@ -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 }});">
@jbalogh
jbalogh added a note

Dirty Django!

@potch Owner
potch added a note

hush you.

@jsocol Collaborator
jsocol added a note

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ {% else %}
+ <div>
+ {% endif %}
</div>
</div>
<h2><a href="{{ game.get_absolute_url }}">{{ game.name }}</a></h2>
View
2  apps/games/views.py
@@ -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')

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 Owner
potch added a note

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

@jsocol Collaborator
jsocol added a note

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
return render(request, 'games/list.html', {'games': games})
View
4 media/css/games.css
@@ -60,6 +60,10 @@
.thumb div {
background: url("/media/img/game_placeholder.png");
+ background-position: center;
+ -webkit-background-size: cover;
+ -moz-background-size: cover;

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.

@fligtar
fligtar added a note

ewwwww

@jsocol Collaborator
jsocol added a note

If even Fligtar things your code is gross...

@potch Owner
potch added a note

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ background-size: cover;
width: 71px;
height: 71px;
overflow: hidden;
Please sign in to comment.
Something went wrong with that request. Please try again.