summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAamir Khan <syst3m.w0rm@gmail.com>2012-06-29 18:58:46 -0400
committerAamir Khan <syst3m.w0rm@gmail.com>2012-06-29 18:58:46 -0400
commit3d837940413c0ada663bd9671e2fa0b5e241df9c (patch)
tree2ab421556ad05a015be4542ad6f91f2ad6929d0a
parentfce897afd93b1703b4953a2c1cd37b6c6bb6d630 (diff)
downloadhyperkitty-3d837940413c0ada663bd9671e2fa0b5e241df9c.tar.gz
hyperkitty-3d837940413c0ada663bd9671e2fa0b5e241df9c.tar.xz
hyperkitty-3d837940413c0ada663bd9671e2fa0b5e241df9c.zip
Fix #5 : Added alert box in case user is not logged in and tries to vote
-rw-r--r--templates/message.html9
-rw-r--r--templates/thread.html9
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 %}
+
});
});