Add return to lobby button

This commit is contained in:
s3lph 2022-10-02 17:12:15 +02:00
parent 6125ac5eab
commit bde19234ba
3 changed files with 14 additions and 5 deletions

View file

@ -70,7 +70,7 @@
</svg>
</div>
<div id="gameinfo" class="{% if abandoned or score is not none %}over{% elif current_player == colormap[player.uuid] %}active{% else %}passive{% endif %}">
<div id="gameinfo" class="{% if game.is_completed %}over{% elif current_player == colormap[player.uuid] %}active{% else %}passive{% endif %}">
{% if abandoned %}
<b>Game abandoned</b>
{% elif score is not none %}
@ -91,7 +91,11 @@
{% endif %}
</div>
{% if game.is_completed %}
<a href="{{ baseurl }}/{{ me.uuid }}">Return to lobby</a>
{% else %}
<a href="{{ baseurl }}/{{ player.uuid }}/{{ game.uuid }}/play">Refresh</a>
{% endif %}
<ul>
{% for p in players.keys() %}

View file

@ -52,7 +52,12 @@
</li>
{%- endfor %}
</ol>
{% if game.is_completed %}
<a href="{{ baseurl }}/{{ me.uuid }}">Return to lobby</a>
{% else %}
<a href="{{ baseurl }}/{{ player.uuid }}/{{ game.uuid }}/play">Refresh</a>
{% endif %}
<script src="{{ baseurl }}/static/set.js"></script>
{%- endblock %}

View file

@ -281,7 +281,7 @@ Press Play! to play against GNU Go or invite a second player.
@property
def is_completed(self) -> bool:
return self.black_passed and self.white_passed
return (self.black_passed and self.white_passed) or self._abandoned
GoPuzzle()