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> </svg>
</div> </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 %} {% if abandoned %}
<b>Game abandoned</b> <b>Game abandoned</b>
{% elif score is not none %} {% elif score is not none %}
@ -90,8 +90,12 @@
<input id="go-input-col" name="go-input-col" type="hidden" value="-1" /> <input id="go-input-col" name="go-input-col" type="hidden" value="-1" />
{% endif %} {% endif %}
</div> </div>
<a href="{{ baseurl }}/{{ player.uuid }}/{{ game.uuid }}/play">Refresh</a> {% 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> <ul>
{% for p in players.keys() %} {% for p in players.keys() %}

View file

@ -52,7 +52,12 @@
</li> </li>
{%- endfor %} {%- endfor %}
</ol> </ol>
<a href="{{ baseurl }}/{{ player.uuid }}/{{ game.uuid }}/play">Refresh</a>
{% 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> <script src="{{ baseurl }}/static/set.js"></script>
{%- endblock %} {%- endblock %}

View file

@ -281,7 +281,7 @@ Press Play! to play against GNU Go or invite a second player.
@property @property
def is_completed(self) -> bool: 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() GoPuzzle()