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 2015/03/21 11:09:14 UTC

svn commit: r1668222 - in /steve/trunk/pytest/www/htdocs: js/steve_rest.js request_link.html

Author: humbedooh
Date: Sat Mar 21 10:09:13 2015
New Revision: 1668222

URL: http://svn.apache.org/r1668222
Log:
add voter id request page and js

Added:
    steve/trunk/pytest/www/htdocs/request_link.html
Modified:
    steve/trunk/pytest/www/htdocs/js/steve_rest.js

Modified: steve/trunk/pytest/www/htdocs/js/steve_rest.js
URL: http://svn.apache.org/viewvc/steve/trunk/pytest/www/htdocs/js/steve_rest.js?rev=1668222&r1=1668221&r2=1668222&view=diff
==============================================================================
--- steve/trunk/pytest/www/htdocs/js/steve_rest.js (original)
+++ steve/trunk/pytest/www/htdocs/js/steve_rest.js Sat Mar 21 10:09:13 2015
@@ -216,6 +216,9 @@ function displayElection(code, response,
 		window.setTimeout(el[2], 100, response, el);
 	} else {
 		document.getElementById('preloaderWrapper').innerHTML = "<h1>Sorry, an error occured while fetching election data:</h1><h2>" + response.message + "</h2>"
+		if (code == 403) {
+			document.getElementById('preloaderWrapper').innerHTML += "<p>If this is an open election, you may request a voter ID sent to you by following <a href='/request_link.html?" + el[0] + "'>this link</a>.</p>"
+		}
 	}
 }
 

Added: steve/trunk/pytest/www/htdocs/request_link.html
URL: http://svn.apache.org/viewvc/steve/trunk/pytest/www/htdocs/request_link.html?rev=1668222&view=auto
==============================================================================
--- steve/trunk/pytest/www/htdocs/request_link.html (added)
+++ steve/trunk/pytest/www/htdocs/request_link.html Sat Mar 21 10:09:13 2015
@@ -0,0 +1,44 @@
+ <!DOCTYPE HTML>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href="css/steve_interactive.css">
+<link rel="stylesheet" href="css/jquery-ui.css">
+<script src="js/steve_rest.js" type="text/javascript"></script>
+<script src="js/jquery.js" type="text/javascript"></script>
+<script src="js/jquery-ui.js" type="text/javascript"></script>
+<script type="text/javascript">
+    function requestLink() {
+        var election =  document.location.search.substr(1);
+        postREST("/steve/voter/request/" + election, {
+            email: document.getElementById('email').value
+        }, undefined,
+        function(code, response, state) { alert(response.message); }, null);
+    }
+</script>
+<title>Apache STeVe: Request link</title>
+
+</head>
+<body>
+    <p style="text-align: center;">
+        <img src="/images/steve_logo.png"/>
+    </p>
+    <div class="formbox">
+        <h2>Request vote link:</h2>
+        <p>
+            In open elections, anyone can request a voter ID and participate.
+            To receive a voter ID, please enter your email address in the field below and click 'Request link'.
+            An email will be sent to you with your own personalized voter ID.
+            With this ID, you may vote as many times as you wish on any of the issues in this election,
+            however only the last vote you cast on any given issue will be your final vote.
+        </p>
+        <div class="keyvaluepair">
+        <div class="keyfield">Email address:</div>
+        
+        <input type="text" id="email" style="width: 200px;"/>
+        <input type="button" class="btn-green" value="Request link" onclick="requestLink();"/>
+        </div>
+        
+    </div>
+</body>
+</html>
\ No newline at end of file