RLG-Web client: explain when there are no games to watch

If no games are available for watching, display a message saying so
instead of showing an empty table.
This commit is contained in:
John "Elwin" Edwards 2012-06-18 16:53:44 -07:00
parent 2bdd26b2f4
commit ceed48eee5
3 changed files with 14 additions and 0 deletions

View file

@ -90,6 +90,7 @@
<div class="tcapt">Games in Progress</div> <div class="tcapt">Games in Progress</div>
<div><div>Player</div><div>Game</div></div> <div><div>Player</div><div>Game</div></div>
</div> </div>
<div id="nogames">There are no games to watch.</div>
</div> </div>
<div class="modal" id="startgame"> <div class="modal" id="startgame">
<div id="opttable" class="formtable"><div><div>Game</div><div>Actions</div></div></div> <div id="opttable" class="formtable"><div><div>Game</div><div>Actions</div></div></div>

View file

@ -429,6 +429,14 @@ function getcurrent() {
var gamediv = document.getElementById("gametable"); var gamediv = document.getElementById("gametable");
while (gamediv.children.length > 2) while (gamediv.children.length > 2)
gamediv.removeChild(optdiv.children[2]); gamediv.removeChild(optdiv.children[2]);
if (reply.g.length === 0) {
gamediv.style.display = "none";
document.getElementById("nogames").style.display = "block";
}
else {
gamediv.style.display = "table";
document.getElementById("nogames").style.display = "none";
}
for (var i = 0; i < reply.g.length; i++) { for (var i = 0; i < reply.g.length; i++) {
var row = document.createElement("div"); var row = document.createElement("div");
var cell1 = document.createElement("div"); var cell1 = document.createElement("div");

View file

@ -59,3 +59,8 @@ span.ibutton {
div#register div.formtable span.ibutton { div#register div.formtable span.ibutton {
font-weight: bold; font-weight: bold;
} }
div#nogames {
display: none;
text-align: center;
}