summaryrefslogtreecommitdiffstats
path: root/templates/thread.html
diff options
context:
space:
mode:
authorAamir Khan <syst3m.w0rm@gmail.com>2012-06-24 16:52:23 -0400
committerAamir Khan <syst3m.w0rm@gmail.com>2012-06-24 16:52:23 -0400
commit00f021987e466c67aba3d925a49e2975d0e431b0 (patch)
tree325c5a83211ab659da198effe29f5bdef70875a4 /templates/thread.html
parent8e325c2250b8a7eaa75c2e988cbf7af4e596d0c0 (diff)
Template refactoring: Rating now works on threads and message page
Diffstat (limited to 'templates/thread.html')
-rw-r--r--templates/thread.html44
1 files changed, 40 insertions, 4 deletions
diff --git a/templates/thread.html b/templates/thread.html
index 7d08701..8ffd5ea 100644
--- a/templates/thread.html
+++ b/templates/thread.html
@@ -37,14 +37,50 @@
-{% block addtionaljs %}
-<script src="{{ STATIC_URL }}jquery.expander.js"></script>
- <script>
+{% block additionaljs %}
+
+ <script src="{{ STATIC_URL }}jquery.expander.js"></script>
+ <script type="text/javascript">
$(document).ready(function() {
$('div.email_body').expander({
userCollapseText: 'View Less',
expandText: 'View More'
});
});
- </script>
+ </script>
+
+
+ <script type="text/javascript">
+
+ $(document).ready(function() {
+ $(".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');
+ $.ajax({
+ type: "POST",
+ url: '/vote/{{list_address}}/',
+ data: { vote : 1, messageid : message_id, list: "{{list_address}}", csrfmiddlewaretoken: '{{ csrf_token }}' },
+ success: function(response){
+ alert(response);
+ }
+ });
+ return false;
+ });
+
+ $(".votedown").click(function(){
+ message_id = this.parentElement.getAttribute('messageid');
+ $.ajax({
+ type: "POST",
+ url: '/vote/{{list_address}}/',
+ data: { vote : -1, messageid : message_id , list: "{{list_address}}", csrfmiddlewaretoken: '{{ csrf_token }}' },
+ success: function(response){
+ alert(response);
+ }
+ });
+ return false;
+ });
+
+ });
+ </script>
+
{% endblock %}