Skip to content

Instantly share code, notes, and snippets.

@anna-is-cute
Created April 6, 2015 21:04
Show Gist options
  • Save anna-is-cute/07b7db893874c62e3aca to your computer and use it in GitHub Desktop.
Save anna-is-cute/07b7db893874c62e3aca to your computer and use it in GitHub Desktop.
{% extends 'layouts/master.twig' %}
{# Without this set line, master.twig is rendered, but the blocks do nothing. With this line, an NPE is thrown #}
{% set nick = (humanity.getBot.getNick is null) ? "TheHumanity" : humanity.getBot.getNick %}
{% block title %}{{ nick }}{% endblock %}
{% block content %}
<h1>{{ nick }}</h1>
{% if (humanity.getGames is not empty) %}
<h2>Games</h2>
<table class="table table-striped">
<thead>
<tr>
<th>Channel</th>
<th>Players</th>
<th>Status</th>
<th>Round</th>
</tr>
</thead>
<tbody>
{% for channel, game in humanity.getGames %}
<tr>
<td><a href="/game/{{ channel.getName.substring(1) }}">{{ channel.getName }}</a></td>
<td>{{ game.getPlayers.size }}</td>
<td>{{ game.getGameStatus }}</td>
<td>{{ game.getCurrentRound.getNumber }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endblock %}
{# Location is really layouts/master.twig #}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"/>
</head>
<body>
{% block content %}{% endblock %}
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment