view.html 3.34 KB
Newer Older
1
2
3
4
{% extends "base.html" %}
{% load bt %}
{% load i18n %}
{% load babel %}
5
{% load comments %}
6
7
8
{% block styles %}
{% endblock %}
{% block scripts %}
9
10
11
<script type="text/javascript" src="{%media_url%}/js/jquery.1.4.2.min.js"></script>
<script type="text/javascript" charset="utf-8">
function bindPostCommentHandler() {
stef's avatar
stef committed
12
13
14
15
    $('.toggle').click(function(){
      $(this).hide();
      $(this).next().show();
    });
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
    $('#comment_form form input.submit-preview').remove();
    $('#comment_form form').submit(function() {
        var postdata=$('#comment_form form').serialize()+'&csrftoken={{csrf_token}}';
        $.ajax({
            type: "POST",
            data: postdata,
            url: "{% comment_form_target %}",
            cache: false,
            dataType: "html",
            success: function(html, textStatus) {
                $('#comment_form form').replaceWith(html);
                bindPostCommentHandler();
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $('#comment_form form').replaceWith('Your comment was unable to be posted at this time.  We apologise for the inconvenience.');
            }
        });
        return false;
    });
}

$(document).ready(function() {
    bindPostCommentHandler();
});
</script>
41
42
43
{% endblock %}

{%block content%}
stef's avatar
stef committed
44
45
<div id='container'>
  <h2>{{v.operator}} ({{v.country}}) {{v.contract}}</h2>
46
<ul id="report">
47
  {%if v.comment_set.all%}
48
49
  <li id="description">
    <h3>{%trans "Description" %}</h3>
50
    {%for c in v.comment_set.all%}
51
52
    <div class="description-node">
      <div class="description">{{c.comment|safe}}</div>
stef's avatar
stef committed
53
      <span class="submitter">{%if c.submitter_name%}{{c.submitter_name}}{%else%}{{c.submitter_email}}{%endif%}</span> - <span class="comment_date">{{c.timestamp|datetimefmt:"short" }}</span>
54
55
      {%if c.attachment_set.all%}
      <div class="attachs">
stef's avatar
stef committed
56
         {% trans "Attachments" %}
57
58
59
60
61
62
63
        <ul>
          {%for a in c.attachment_set.all%}
          <li><a href="{{a.storage.url}}">{{a.storage.name}}</a></li>
          {%endfor%}
        </ul>
      </div>
      {%endif%}
64
    </div>
65
    {%endfor%}
66
  </li>
stef's avatar
stef committed
67
68
69
70
71
72
73
   {%if v.resource_name%}<li><dl><dt>{% trans "Resource" %}</dt><dd>{{v.resource_name}}</dd></dl></li>{%endif%}
   {%if v.type%}<li><dl><dt>{% trans "Type" %}</dt><dd>{{v.type}}</dd></dl></li>{%endif%}
   {%if v.media%}<li><dl><dt>{% trans "Media" %}</dt><dd>{{v.media}}</dd></dl></li>{%endif%}
   {%if v.temporary%}<li><dl><dt>{% trans "Temporary restriction" %}r</dt><dd>{{v.temporary}}</dd></dl></li>{%endif%}
   {%if v.loophole%}<li><dl><dt>{% trans "Loophole offering" %}</dt><dd>{% trans "yes" %}</dd></dl></li>{%endif%}
   {%if v.contractual%}<li><dl><dt>{% trans "Contractual restriction" %}</dt><dd>{% trans "yes" %}</dd></dl></li>{%endif%}
   {%if v.contract_excerpt%}<li><dl><dt>{% trans "Contract excerpt" %}</dt><dd class='text'>{{v.contract_excerpt|safe}}</dd></dl></li>{%endif%}
74
</ul>
75
  {%endif%}
76
  {% if not key %}
stef's avatar
stef committed
77
  <h3>{% trans "Comments" %}</h3>
78
  {% render_comment_list for v %}
stef's avatar
stef committed
79
80
  <div class="toggle button">{% trans "Add comment" %}</div>
  <div id="comment_form" style="display: none;">
81
82
    {% render_comment_form for v %}
  </div>
83
  {% else %}
stef's avatar
stef committed
84
85
  <a class="button" href='/moderate/?key={{key}}&action=approve'>Approve Submission</a>
  <a class="button" href='/moderate/?key={{key}}&action=delete'>Delete Submission</a>
86
  {% endif %}
stef's avatar
stef committed
87
</div>
88
{%endblock%}