view.html 3.01 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">
41
42
43
  <li><dl><dt>Operator</dt><dd>{{v.operator}} ({{v.country}})</dd></dl></li>
  <li><dl><dt>Contract</dt><dd>{{v.contract}}</dd></dl></li>
  {%if v.resource%}<li><dl><dt>Resource</dt><dd>{{v.resource}}</dd></dl></li>{%endif%}
44
  {%if v.resource_name%}<li><dl><dt>Resource name</dt><dd>{{v.resource_name}}</dd></dl></li>{%endif%}
45
46
47
  {%if v.type%}<li><dl><dt>Type</dt><dd>{{v.type}}</dd></dl></li>{%endif%}
  {%if v.media%}<li><dl><dt>Media</dt><dd>{{v.media}}</dd></dl></li>{%endif%}
  {%if v.temporary%}<li><dl><dt>Temporary restriction</dt><dd>{{v.temporary}}</dd></dl></li>{%endif%}
stef's avatar
stef committed
48
  {%if v.loophole%}<li><dl><dt>Loophole offering</dt><dd>{{v.loophole}}</dd></dl></li>{%endif%}
49
  {%if v.contractual%}<li><dl><dt>Contractual restriction</dt><dd>{{v.Contractual}}</dd></dl></li>{%endif%}
50
  {%if v.contract_excerpt%}<li><dl><dt>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
60
61
62
63
64
65
66
67
      {%if c.attachment_set.all%}
      <div class="attachs">
        Attachments
        <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
74
75
76
77
78
79
  <h3>Comments</h3>
  {% render_comment_list for v %}
  <h3>Comment</h3>
  {% get_comment_form for v as form %}
  <div id="comment_form">
    {% render_comment_form for v %}
  </div>
80
{%endblock%}