view.html 3.38 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
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
<script type="text/javascript" src="{%media_url%}/js/jquery.1.4.2.min.js"></script>
<script type="text/javascript" charset="utf-8">
function bindPostCommentHandler() {
    $('#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>
37
38
39
{% endblock %}

{%block content%}
40
<ul id="report">
stef's avatar
stef committed
41
42
43
44
45
46
47
48
49
50
   <li><dl><dt>{% trans "Operator" %}</dt><dd>{{v.operator}} ({{v.country}})</dd></dl></li>
   <li><dl><dt>{% trans "Contract" %}</dt><dd>{{v.contract}}</dd></dl></li>
   {%if v.resource%}<li><dl><dt>{% trans "Resource" %}</dt><dd>{{v.resource}}</dd></dl></li>{%endif%}
   {%if v.resource_name%}<li><dl><dt>{% trans "Resource name" %}</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>{{v.loophole}}</dd></dl></li>{%endif%}
   {%if v.contractual%}<li><dl><dt>{% trans "Contractual restriction" %}</dt><dd>{{v.Contractual}}</dd></dl></li>{%endif%}
   {%if v.contract_excerpt%}<li><dl><dt>{% trans "Contract excerpt" %}</dt><dd>{{v.contract_excerpt|safe}}</dd></dl></li>{%endif%}
51
  {%if v.comment_set.all%}
52
53
  <li id="description">
    <h3>{%trans "Description" %}</h3>
54
    {%for c in v.comment_set.all%}
55
56
57
    <div class="description-node">
      <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>
      <div class="description">{{c.comment|safe}}</div>
58
59
      {%if c.attachment_set.all%}
      <div class="attachs">
stef's avatar
stef committed
60
         {% trans "Attachments" %}
61
62
63
64
65
66
67
        <ul>
          {%for a in c.attachment_set.all%}
          <li><a href="{{a.storage.url}}">{{a.storage.name}}</a></li>
          {%endfor%}
        </ul>
      </div>
      {%endif%}
68
    </div>
69
    {%endfor%}
70
71
  </li>
</ul>
72
  {%endif%}
73
  {% if not key %}
stef's avatar
stef committed
74
  <h3>{% trans "Comments" %}</h3>
75
  {% render_comment_list for v %}
stef's avatar
stef committed
76
  <h3>{% trans "Comment" %}</h3>
77
78
79
80
  {% get_comment_form for v as form %}
  <div id="comment_form">
    {% render_comment_form for v %}
  </div>
81
82
83
84
  {% else %}
  <a href='/moderate/?key={{key}}&action=approve'>Approve Submission</a>
  <a href='/moderate/?key={{key}}&action=delete'>Delete Submission</a>
  {% endif %}
85
{%endblock%}