summaryrefslogtreecommitdiffstats
path: root/templates/thread.html
blob: 508b03a2509d7e4c54e42570ad021d3b564b65a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{% extends "base.html" %}

{% load gravatar %}

{% block additional_stylesheets %}
<link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/thread.css" />
{% endblock %}

{% block content %}

<div class="content">

	{% include 'threads/right_col.html' %}

	<!-- main section, the email thread -->
	<section id="thread_content">

		<!-- Start first email -->
		{% include 'messages/first_email.html' %}
		<!-- End first email -->

		{% for email in threads %}
		<!-- Start email -->
		<div class="even">
			{% include 'messages/message.html' %}
		</div>
		<!-- End of email -->

		{% empty %}
		Sorry no emails could be found for your search.
		{% endfor %}

	</section>

</div>
<!-- end of content -->
{% endblock %}

{% 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 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 %}