view.html 5.58 KB
Newer Older
Okhin's avatar
Okhin committed
1
2
3
4
{% extends "base.html" %}
{% load bt %}
{% load i18n %}
{% load comments %}
5
{% block active_tab_cases %}class="active"{% endblock %}
Okhin's avatar
Okhin committed
6
7
8
{% block styles %}
{% endblock %}
{% block adminext %}
Okhin's avatar
Okhin committed
9
, <a href="{%root_url%}/admin/bt/violation/{{v.id}}/ ">{% trans "Edit" %}</a>
Okhin's avatar
Okhin committed
10
11
{% endblock %}
{% block scripts %}
Okhin's avatar
Okhin committed
12
13
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
Okhin's avatar
Okhin committed
14
15
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
41
42
43
44
45
function bindPostCommentHandler() {
    $('.toggle').click(function(){
      $(this).hide();
      $(this).next().show();
    });
    $('#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+" "+"{% trans 'It will appear here after moderation.' %}");
                bindPostCommentHandler();
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $('#comment_form form').replaceWith("{% trans 'Your comment was unable to be posted at this time. We apologise for the inconvenience.' %}");
            }
        });
        return false;
    });
}

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

{%block content%}
<div id='global'>
Okhin's avatar
Okhin committed
60
  <h2>{{v.operator}} ({{v.country}}) {{v.contract}}</h2>
Okhin's avatar
Okhin committed
61
62
<div id="report">
	<div id="icons">
Okhin's avatar
Okhin committed
63
64
65
66
67
		<span id="verified_tooltip" class="tooltip">{% trans "This case was verified by the management team" %}</span>
		<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>
		{% if v.state == 'verified' %}<span id="verified"></span> |{% endif %}
		<span id="confirmations">{{v.confirmations}}</span> |
	</div>
Okhin's avatar
Okhin committed
68

Okhin's avatar
Okhin committed
69
70
71
72
73
74
75
76
77
78
  <dl>{%if v.resource_name%}<dt>{% trans "Affected resource" %}</dt><dd>{{v.resource_name}}</dd>{%endif%}
  {%if v.type%}<dt>{% trans "Type" %}</dt><dd>{{v.type|type}}</dd>{%endif%}
  {%if v.media%}<dt>{% trans "Media" %}</dt><dd>{{v.media|media}}</dd>{%endif%}
  {%if v.state%}<dt>{% trans "Status" %}</dt><dd>{{v.state|status}}</dd>{%endif%}
  {%if v.temporary%}<dt>{% trans "Temporary restriction" %}</dt><dd>{% trans "yes" %}</dd>{%endif%}
  {%if v.loophole%}<dt>{% trans "Another offer provided by the same operator removes this restriction" %}</dt><dd>{% trans "yes" %}</dd>{%endif%}
  {%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>
Okhin's avatar
Okhin committed
79
80
81

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

<div id="description" class='round-box'>
Okhin's avatar
Okhin committed
88
    <h3>{%trans "Description" %}</h3>
Okhin's avatar
Okhin committed
89
90
91
92
    {%for c in v.comment_set.all%}
    <div class="description-node">
	  {%if c.attachment_set.all%}
	  <div class="attachs">
Okhin's avatar
Okhin committed
93
         <h4>{% trans "Attachments" %}</h4>
Okhin's avatar
Okhin committed
94
95
        <ul>
          {%for a in c.attachment_set.all%}
Okhin's avatar
Okhin committed
96
          <li><a href="{% url attach a.id %}">{{a.name}}</a></li>
Okhin's avatar
Okhin committed
97
          {%endfor%}
Okhin's avatar
Okhin committed
98
99
        </ul>
      </div>
Okhin's avatar
Okhin committed
100
      {%endif%}
Okhin's avatar
Okhin committed
101
102
103
      <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>
    </div>
Okhin's avatar
Okhin committed
104
    {%endfor%}
Okhin's avatar
Okhin committed
105
</div>
Okhin's avatar
Okhin committed
106
107


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