changeset 57:e7c864e80a79

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.
author John "Elwin" Edwards <elwin@sdf.org>
date Mon, 18 Jun 2012 16:53:44 -0700
parents 7f3ca16409fe
children 7a50b4412fea
files index-rlg.html rlgterm.js style-rlg.css
diffstat 3 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/index-rlg.html	Mon Jun 18 14:30:05 2012 -0700
+++ b/index-rlg.html	Mon Jun 18 16:53:44 2012 -0700
@@ -90,6 +90,7 @@
  <div class="tcapt">Games in Progress</div>
  <div><div>Player</div><div>Game</div></div>
 </div>
+<div id="nogames">There are no games to watch.</div>
 </div>
 <div class="modal" id="startgame">
 <div id="opttable" class="formtable"><div><div>Game</div><div>Actions</div></div></div>
--- a/rlgterm.js	Mon Jun 18 14:30:05 2012 -0700
+++ b/rlgterm.js	Mon Jun 18 16:53:44 2012 -0700
@@ -429,6 +429,14 @@
     var gamediv = document.getElementById("gametable");
     while (gamediv.children.length > 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++) {
       var row = document.createElement("div");
       var cell1 = document.createElement("div");
--- a/style-rlg.css	Mon Jun 18 14:30:05 2012 -0700
+++ b/style-rlg.css	Mon Jun 18 16:53:44 2012 -0700
@@ -59,3 +59,8 @@
 div#register div.formtable span.ibutton {
 	font-weight: bold;
 }
+
+div#nogames {
+	display: none;
+	text-align: center;
+}