Skip to content

Commit

Permalink
Game browser now functions
Browse files Browse the repository at this point in the history
-User can create new game
-User can join existing game and see basic info about current
games
  • Loading branch information
johngunderman committed Jan 2, 2012
1 parent ee9751f commit 485d00a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
5 changes: 4 additions & 1 deletion catan/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ def get_file(filename):

@app.route("/")
def get_index():
return render_template('index.html')
game = Game();
games = game.query.filter_by(State=Game.States.NOTSTARTED)
# passing in len is a huge hack, but it does the job.
return render_template('index.html',games=games, len=len)
#return send_from_directory('../client', "index.html")

if __name__ == "__main__":
Expand Down
23 changes: 7 additions & 16 deletions client/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h1>Welcome to Catan!</h1>
<p><strong>Oh Noes!</strong> You need to log in before you can start playing.</p>
</div>

<a id="create-game-button" href="/create_game" class="btn primary right">New Game</a>
<a id="create-game-button" href="/game.html" class="btn primary right">New Game</a>
<a id="login-button" onclick="login()" class="btn primary right invis">Log In</a>
<table id="games-table" class="zebra-striped">
<thead>
Expand All @@ -40,25 +40,16 @@ <h1>Welcome to Catan!</h1>
</tr>
</thead>
<tbody>
{% for game in games %}
<tr>
<td>3</td>
<td>1</td>
<td>{{game.GameID}}</td>
<td>{{len(game.players)}}</td>
<td>
<a id="join-link" class="btn success" href="">Join</a>
<a id="join-link" class="btn success"
href="/game.html#{{game.GameID}}">Join</a>
</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>
<a id="join-link" class="btn success" href="">Join</a>
</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
<td><a id="join-link" class="btn success disabled" href="">Full</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>

0 comments on commit 485d00a

Please sign in to comment.