view.html 5.53 KB
Newer Older
1
2
3
{% extends "base.html" %}
{% load bt %}
{% load i18n %}
4
{% load comments %}
5
6
{% block styles %}
{% endblock %}
7
8
9
{% block adminext %}
, <a href="{%root_url%}/admin/bt/violation/{{v.id}}/ ">{% trans "Edit" %}</a>
{% endblock %}
10
{% block scripts %}
11
12
13
<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
14
15
16
17
    $('.toggle').click(function(){
      $(this).hide();
      $(this).next().show();
    });
18
19
20
21
22
23
24
25
26
27
    $('#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
28
                $('#comment_form form').replaceWith(html+" "+"{% trans 'It will appear here after moderation.' %}");
29
30
31
                bindPostCommentHandler();
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
stef's avatar
stef committed
32
                $('#comment_form form').replaceWith("{% trans 'Your comment was unable to be posted at this time. We apologise for the inconvenience.' %}");
33
34
35
36
37
38
39
40
            }
        });
        return false;
    });
}

$(document).ready(function() {
    bindPostCommentHandler();
stef's avatar
stef committed
41
42
  $('.confirm_form').submit(function() {
     var self=this;
43
44
45
46
47
48
49
     var email=$(this).children('input:first').attr('value');
     if( email.length>0) {
        $.ajax({url: '/confirm/'+$(this).attr('id')+'/'+email, success: function(data) { $(self).html(data); }});
     } else {
        console.log($(this).find('[type=submit]'));
        $(this).find('[type=text]').focus();
     }
stef's avatar
stef committed
50
51
     return false;
     });
52
    $('span').hover(function(){$('span#'+this.id+'_tooltip').fadeIn();}, function(){$('span#'+this.id+'_tooltip').hide();});
53
54
});
</script>
55
56
57
{% endblock %}

{%block content%}
stef's avatar
stef committed
58
<div id='global'>
stef's avatar
stef committed
59
  <h2>{{v.operator}} ({{v.country}}) {{v.contract}}</h2>
60
<div id="report">
61
62
	<div id="icons">
		<span id="verified_tooltip" class="tooltip">{% trans "This case was verified by the management team" %}</span>
63
		<span class="tooltip_on">{%if v.confirmations == 0 %} {% trans "Nobody has yet confirmed the case. Feel free to do it" %} {%else%} {{v.confirmations}} {%if v.confirmations == 1 %} {% trans "person has confirmed this case" %} {%else%} {% trans "persons have confirmed this case" %} {%endif%} {%endif%}</span>
stef's avatar
stef committed
64
		{% if v.state == 'verified' %}<span id="verified"></span> |{% endif %}
65
66
67
		<span id="confirmations">{{v.confirmations}}</span> |
	</div>

68
  <dl>{%if v.resource_name%}<dt>{% trans "Affected resource" %}</dt><dd>{{v.resource_name}}</dd>{%endif%}
69
  {%if v.type%}<dt>{% trans "Type" %}</dt><dd>{{v.type|type}}</dd>{%endif%}
70
  {%if v.media%}<dt>{% trans "Media" %}</dt><dd>{{v.media|media}}</dd>{%endif%}
stef's avatar
stef committed
71
  {%if v.state%}<dt>{% trans "Status" %}</dt><dd>{{v.state|status}}</dd>{%endif%}
72
  {%if v.temporary%}<dt>{% trans "Temporary restriction" %}</dt><dd>{% trans "yes" %}</dd>{%endif%}
stef's avatar
stef committed
73
  {%if v.loophole%}<dt>{% trans "Another offer provided by the same operator removes this restriction" %}</dt><dd>{% trans "yes" %}</dd>{%endif%}
74
75
76
77
78
  {%if v.contractual%}<dt>{% trans "Contractual restriction" %}</dt><dd>{% trans "yes" %}</dd>{%endif%}
  {%if v.contract_excerpt%}<dt>{% trans "Contract excerpt" %}</dt><dd class='text'>{{v.contract_excerpt|safe}}</dd>{%endif%}
  {%if v.comment_set.all%}</dl>
</div>

79
80
{% if v.editorial %}
<div id="editorial" class='round-box'>
81
   <h3>{% trans "RespectMyNet note" %}</h3>
stef's avatar
stef committed
82
   {{v.editorial|safe}}
83
84
85
</div>
{% endif %}

86
<div id="description" class='round-box'>
87
    <h3>{%trans "Description" %}</h3>
88
    {%for c in v.comment_set.all%}
89
    <div class="description-node">
90
91
92
	  {%if c.attachment_set.all%}
	  <div class="attachs">
         <h4>{% trans "Attachments" %}</h4>
93
94
        <ul>
          {%for a in c.attachment_set.all%}
95
          <li><a href="/attach/{{a.id}}">{{a.name}}</a></li>
96
97
98
99
          {%endfor%}
        </ul>
      </div>
      {%endif%}
100
101
      <div class="description">{{c.comment|safe}}</div>
      <span class="submitter">{%if c.submitter_name%}{{c.submitter_name}}{%else%}{{c.submitter_email}}{%endif%}</span> - <span class="comment_date">{{c.timestamp|date:"SHORT_DATE_FORMAT" }}</span>
102
    </div>
103
    {%endfor%}
104
105
106
</div>


107
  <h3>{%trans "This restriction affects me too" %}</h3>
stef's avatar
stef committed
108
  <div class="info-validate" style="display: inline-block;">
109
    <form method="get" id="{{ v.pk }}" class="confirm_form" >
110
        <label>{% trans "In order to <strong>confirm</strong> this report, please enter your email address" %}</label>
stef's avatar
stef committed
111
        <input type="text" name="email" />
112
        <input type="hidden" value="{{ v.pk }}" />
113
        <input type="submit" value="{% trans "Me too!" %}" />
stef's avatar
stef committed
114
115
      </form>
   </div>
116
  {%endif%}
117
  {% if not key %}
118
  <div id="comments">
stef's avatar
stef committed
119
  <h3>{% trans "Comments" %}</h3>
stef's avatar
stef committed
120
121
122
  {% get_comment_list for v as cmt_list %}
  {% for comment in cmt_list %}
  <div class="comment">
123
     <p>{{ comment.user_name }} - {{ comment.submit_date }}</p>
124
     <p>{{ comment.comment|striptags|urlize|linebreaks }}</p>
stef's avatar
stef committed
125
126
  </div>
  {% endfor %}
stef's avatar
stef committed
127
128
  <div class="toggle button">{% trans "Add comment" %}</div>
  <div id="comment_form" style="display: none;">
129
130
    {% render_comment_form for v %}
  </div>
131
  {% else %}
stef's avatar
stef committed
132
  <br />
Benjamin Sonntag's avatar
Benjamin Sonntag committed
133
134
  <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>
135
  </div>
136
  {% endif %}
stef's avatar
stef committed
137
</div>
138
{%endblock%}