Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add basic created at paging to game listing.

  • Loading branch information...
commit 2ca97ec44186fffa8f5992665ba29e4b8a13787e 1 parent 65faa04
@okayzed okayzed authored
View
10 appengine.py
@@ -15,6 +15,7 @@
import os
import sys
import time
+import datetime
import ai as ai_module
import code_signature
@@ -216,7 +217,14 @@ def get(self):
class MainPage(webapp.RequestHandler):
def get(self):
- games = GameRun.all().order("-created_at").fetch(PAGESIZE)
+ before = self.request.get("before")
+
+ query = GameRun.all().order("-created_at")
+ if before:
+ query = query.filter("created_at < ", datetime.datetime.fromtimestamp(float(before)))
+
+ games = query.fetch(PAGESIZE+1)
+ log.info(map(lambda x: x.key().id(), games))
file_set = set()
View
5 media/css/game_runs.css
@@ -209,4 +209,7 @@ a.map_selection:visited {
margin-left: 5px;
}
-
+.newer_games, .older_games {
+ font-size: 150%;
+ margin-bottom: 25px;
+}
View
6 templates/game_run_paging.html
@@ -0,0 +1,6 @@
+{% if next_page %}
+ <h2>
+ <a class="older_games grid_6" href="/?before={{next_page|datetime_to_seconds}}">Older Games</a>
+ </h2>
+{% endif %}
+
View
3  templates/game_runs.html
@@ -44,6 +44,7 @@ <h3 >Sort By (Drag to change ordering): </h3>
<a id="close_controls">^ Hide Controls ^</a>
</div>
+{% include "game_run_paging.html" %}
<div id="game_run_collection"></div>
<div id="game_runs" class="hidden">
@@ -281,4 +282,6 @@ <h2 class="turns">
});
</script>
+{% include "game_run_paging.html" %}
+
{% endblock content %}
Please sign in to comment.
Something went wrong with that request. Please try again.