You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@steve.apache.org by hu...@apache.org on 2016/02/08 16:57:53 UTC

svn commit: r1729196 - /steve/trunk/pysteve/www/htdocs/js/steve_rest.js

Author: humbedooh
Date: Mon Feb  8 15:57:53 2016
New Revision: 1729196

URL: http://svn.apache.org/viewvc?rev=1729196&view=rev
Log:
weave in some of sebb's concerns, make sure people can see that the vote has been caught

Modified:
    steve/trunk/pysteve/www/htdocs/js/steve_rest.js

Modified: steve/trunk/pysteve/www/htdocs/js/steve_rest.js
URL: http://svn.apache.org/viewvc/steve/trunk/pysteve/www/htdocs/js/steve_rest.js?rev=1729196&r1=1729195&r2=1729196&view=diff
==============================================================================
--- steve/trunk/pysteve/www/htdocs/js/steve_rest.js (original)
+++ steve/trunk/pysteve/www/htdocs/js/steve_rest.js Mon Feb  8 15:57:53 2016
@@ -930,6 +930,7 @@ function renderElectionBulk(response, el
             
             // Add issue
             var inner = document.createElement('span')
+            inner.setAttribute("id", "inner_yna_" + issue.id)
             inner.innerHTML = issue.title;
             outer.appendChild(no)
             outer.appendChild(inner)
@@ -1033,16 +1034,22 @@ function castVote(election, issue, uid,
     }
     postREST("/steve/voter/vote/" + election + "/" + issue, {
         uid: uid,
-        vote: vote
+        vote: vote,
+        issue: issue
     },
     undefined,
     castVoteCallback,
     issue)
 }
 
-function castVoteCallback(code, response, issue) {
+function castVoteCallback(code, response, state) {
     if (code == 200) {
-        //code
+        if (state && state.issue) {
+            var yna = document.getElementById('inner_yna_' + state.issue);
+            if (yna && !yna.innerHTML.match(/Vote registered/i)) {
+                yna.innerHTML += " (Vote registered!)"
+            }
+        }
     } else {
         alert(response.message)
     }