summaryrefslogtreecommitdiffstats
path: root/hyperkitty/templates/thread.html
blob: 2730db951c8d26fdb32cd43885dd5b3c2247ff96 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{% 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 %}

	{% 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 replies %}
		<div class="{% cycle 'even' 'odd' %}">
			<!-- Start email -->
			{% include 'messages/message.html' %}
			<!-- End of email -->
		</div>
		{% endfor %}

	</section>

<!-- 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');
			{% if user.is_authenticated %}
			$.ajax({
				type : "POST",
				url : '{% url message_vote mlist_fqdn=list_address %}',
				data : {
					vote : 1,
					messageid : message_id,
					list : "{{list_address}}",
					csrfmiddlewaretoken : '{{ csrf_token }}'
				},
				success : function(response) {
					console.log(response);
					location.reload();
				}
			});
			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 : '{% url message_vote mlist_fqdn=list_address %}',
				data : {
					vote : -1,
					messageid : message_id,
					list : "{{list_address}}",
					csrfmiddlewaretoken : '{{ csrf_token }}'
				},
				success : function(response) {
					console.log(response);
					// @TODO : Remove this reload and update count using AJAX
					location.reload();
				}
			});
			return false;
			{% else %}
				alert('You need to login in order to vote');
			{% endif %}
	
		});

		$("#add_tag_form").submit( function () {
		       		   
			   {% if user.is_authenticated %}
		        $.ajax({   
		            type: "POST",
		            data : $(this).serialize(), 
		            url: "{% url add_tag mlist_fqdn=list_address, email_id=threadid %}",   
		            success: function(data){
		                console.log('Tag is added successfully');
		                location.reload();                     
		            }   
		        });   
		        return false;
				{% else %}
					alert('You need to login in order to add tag');
				{% endif %}
		 });
	
		
	}); 
</script>
{% endblock %}