changeset 333:018817535fab

Make voting more visually pleasant(?).
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 28 Nov 2013 04:45:24 +0200
parents 48d53945c6d3
children a02422200eca
files main.css vote.inc.php
diffstat 2 files changed, 29 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/main.css	Thu Nov 28 03:32:49 2013 +0200
+++ b/main.css	Thu Nov 28 04:45:24 2013 +0200
@@ -183,3 +183,23 @@
 		visibility: hidden;
 	}
 }
+
+
+table.vote * input[type="radio"] {
+	display: none;
+}
+
+table.vote * input[type="radio"] + label:before {
+	content: "O";
+	display: inline-block;
+	color: green;
+	font-size: 2em;
+}
+
+table.vote * input[type="radio"]:checked + label:before {
+	content: "X";
+	display: inline-block;
+	color: red;
+	font-weight: bold;
+	font-size: 2em;
+}
--- a/vote.inc.php	Thu Nov 28 03:32:49 2013 +0200
+++ b/vote.inc.php	Thu Nov 28 04:45:24 2013 +0200
@@ -132,10 +132,9 @@
       ($compo["showAuthors"] ? "   <th class=\"vauthor\">Author</th>\n" : "").
       "   ";
 
-      for ($i = stGetSetting("voteMin"); $i <= stGetSetting("voteMax"); $i++)
+      for ($i = stGetSetting("voteMax"); $i >= stGetSetting("voteMin"); $i--)
       {
-        echo
-        "<th class=\"vvalue\">".$i."</th>";
+        echo "<th class=\"vvalue\">".$i."</th>";
       }
       echo "\n".
       "  </tr>\n";
@@ -153,14 +152,16 @@
 
         $val = isset($votes[$eid]) ? $votes[$eid] : 0;
 
-        for ($i = stGetSetting("voteMin"); $i <= stGetSetting("voteMax"); $i++)
+        for ($i = stGetSetting("voteMax"); $i >= stGetSetting("voteMin"); $i--)
         {
+          $nid = "ve".$eid."_".$i;
           echo
             "<td class=\"vvalue\">".
-            stGetFormRadioButtonInput(
-              "ventry".$eid, "", "", $i, ($i == $val),
-              "",
-              "onClick=\"updateVote(".$eid.",".$i.")\"").
+            "<input type=\"radio\" id=\"".$nid.
+            "\" name=\"ventry".$eid."\" value=\"".$i."\" ".
+            "onClick=\"updateVote(".$eid.",".$i.")\" ".
+            ($val == $i ? "checked=\"checked\" ": "")."/>".
+            "<label for=\"".$nid."\"></label>".
             "</td>";
         }