view.html 4.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
<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
    $('#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) {
stef's avatar
stef committed
26
                $('#comment_form form').replaceWith(html+" "+"{% trans 'It will appear here after moderation.' %}");
27
28
29
                bindPostCommentHandler();
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
stef's avatar
stef committed
30
                $('#comment_form form').replaceWith("{% trans 'Your comment was unable to be posted at this time. We apologise for the inconvenience.' %}");
31
32
33
34
35
36
37
38
            }
        });
        return false;
    });
}

$(document).ready(function() {
    bindPostCommentHandler();
stef's avatar
stef committed
39
40
41
42
43
  $('.confirm_form').submit(function() {
     var self=this;
     $.ajax({url: '/confirm/'+$(this).attr('id')+'/'+$(this).children('input:first').attr('value'), success: function(data) { $(self).html(data); }});
     return false;
     });
44
45
});
</script>
46
47
48
{% endblock %}

{%block content%}
stef's avatar
stef committed
49
<div id='global'>
stef's avatar
stef committed
50
  <h2>{{v.operator}} ({{v.country}}) {{v.contract}}</h2>
51
<ul id="report">
52
  {%if v.comment_set.all%}
stef's avatar
stef committed
53
  <li id="description" class='round-box'>
54
    <h3>{%trans "Description" %}</h3>
55
    {%for c in v.comment_set.all%}
56
57
    <div class="description-node">
      <div class="description">{{c.comment|safe}}</div>
stef's avatar
stef committed
58
      <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>
59
60
      {%if c.attachment_set.all%}
      <div class="attachs">
stef's avatar
stef committed
61
         {% trans "Attachments" %}
62
63
        <ul>
          {%for a in c.attachment_set.all%}
64
          <li><a href="{%media_url%}/{{a.storage.url}}">{{a.name}}</a></li>
65
66
67
68
          {%endfor%}
        </ul>
      </div>
      {%endif%}
69
    </div>
70
    {%endfor%}
71
  </li>
stef's avatar
stef committed
72
73
74
75
76
77
78
   {%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%}
79
</ul>
stef's avatar
stef committed
80
81
  <div class="info-validate" style="display: inline-block;">
    <form method="get" id="{{ violation.pk }}" class="confirm_form" >
82
        <label>{% trans "In order to <strong>confirm</strong> this report, please enter your email address" %}</label>
stef's avatar
stef committed
83
84
85
86
87
        <input type="text" name="email" />
        <input type="hidden" value="{{ violation.pk }}" />
        <input type="submit" value="{% trans "confirm" %}" />
      </form>
   </div>
88
  {%endif%}
89
  {% if not key %}
90
  <div id="comments">
stef's avatar
stef committed
91
  <h3>{% trans "Comments" %}</h3>
stef's avatar
stef committed
92
93
94
  {% get_comment_list for v as cmt_list %}
  {% for comment in cmt_list %}
  <div class="comment">
95
96
     <p><a href="{{ comment.user_url }}">{{ comment.user_name }}</a> - {{ comment.submit_date }}</p>
     <p>{{ comment.comment }}</p>
stef's avatar
stef committed
97
98
  </div>
  {% endfor %}
stef's avatar
stef committed
99
100
  <div class="toggle button">{% trans "Add comment" %}</div>
  <div id="comment_form" style="display: none;">
101
102
    {% render_comment_form for v %}
  </div>
103
  {% else %}
stef's avatar
stef committed
104
  <br />
Benjamin Sonntag's avatar
Benjamin Sonntag committed
105
106
  <a class="button" href='/moderate/?key={{key}}&action=approve'>{% trans "Approve Submission" %}</a>
  <a class="button" href='/moderate/?key={{key}}&action=delete'>{% trans "Delete Submission" %}</a>
107
  </div>
108
  {% endif %}
stef's avatar
stef committed
109
</div>
110
{%endblock%}