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
118
119
120
121
122
123
124
125
126
127
128
129
130
|
{% extends "base.html" %}
{% load gravatar %}
{% load hk_generic %}
{% load storm %}
{% block content %}
<div class="thread-header">
{% for thread in neighbors %}
{% if thread %}
<a class="thread-{% ifequal forloop.counter 1 %}older{% else %}newer{% endifequal %}"
href="{% url thread threadid=thread.thread_id, mlist_fqdn=list_address %}"
>{{ thread.subject|strip_subject:mlist|truncatesmart:"22" }}</a>
{% endif %}
{% endfor %}
<h1>{{ subject }}</h1>
</div>
{% 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 }}js/libs/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 %}
});
$("ul.email_info li.attachments ul.attachments-list").hide();
$("ul.email_info li.attachments > a").click(function() {
$(this).next("ul").fadeToggle('fast');
});
});
</script>
{% endblock %}
|