diff options
-rw-r--r-- | templates/message.html | 9 | ||||
-rw-r--r-- | templates/thread.html | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/templates/message.html b/templates/message.html index 58187c0..d3d884b 100644 --- a/templates/message.html +++ b/templates/message.html @@ -19,6 +19,7 @@ $(".voteup").click(function() { // @TODO: Extract the message id from the HTML DOM element instead of hard coding it in Javascript. message_id = this.parentElement.getAttribute('messageid'); + {% if user.is_authenticated %} $.ajax({ type : "POST", url : '/vote/{{list_address}}/', @@ -33,10 +34,14 @@ } }); return false; + {% else %} + alert('You need to login in order to vote'); + {% endif %} }); $(".votedown").click(function() { message_id = this.parentElement.getAttribute('messageid'); + {% if user.is_authenticated %} $.ajax({ type : "POST", url : '/vote/{{list_address}}/', @@ -51,6 +56,10 @@ } }); return false; + {% else %} + alert('You need to login in order to vote'); + {% endif %} + }); }); diff --git a/templates/thread.html b/templates/thread.html index 508b03a..b15dd45 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -53,6 +53,7 @@ $(".voteup").click(function() { // @TODO: Extract the message id from the HTML DOM element instead of hard coding it in Javascript. message_id = this.parentElement.getAttribute('messageid'); + {% if user.is_authenticated %} $.ajax({ type : "POST", url : '/vote/{{list_address}}/', @@ -67,10 +68,14 @@ } }); return false; + {% else %} + alert('You need to login in order to vote'); + {% endif %} }); $(".votedown").click(function() { message_id = this.parentElement.getAttribute('messageid'); + {% if user.is_authenticated %} $.ajax({ type : "POST", url : '/vote/{{list_address}}/', @@ -85,6 +90,10 @@ } }); return false; + {% else %} + alert('You need to login in order to vote'); + {% endif %} + }); }); |