view.html 5.58 KB
Newer Older
Okhin's avatar
Okhin committed
1
2
3
4
5
6
7
8
9
10
11
{% extends "base.html" %}
{% load bt %}
{% load i18n %}
{% load comments %}
{% block active_tab_cases %}id="current"{% endblock %}
{% block styles %}
{% endblock %}
{% block adminext %}
, <a href="{%root_url%}/admin/bt/violation/{{v.id}}/ ">{% trans "Edit" %}</a>
{% endblock %}
{% block scripts %}
12
<script type="text/javascript" src="{%media_url%}/js/jquery.min.js"></script>
Okhin's avatar
Okhin committed
13
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<script type="text/javascript" charset="utf-8">
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) {
        $.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();
     }
     return false;
     });
    $('span').hover(function(){$('span#'+this.id+'_tooltip').fadeIn();}, function(){$('span#'+this.id+'_tooltip').hide();});
});
</script>
{% endblock %}

{%block content%}
<div id='global'>
  <h2>{{v.operator}} ({{v.country}}) {{v.contract}}</h2>
<div id="report">
	<div id="icons">
		<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>

  <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>

{% if v.editorial %}
<div id="editorial" class='round-box'>
   <h3>{% trans "RespectMyNet note" %}</h3>
   {{v.editorial|safe}}
</div>
{% endif %}

<div id="description" class='round-box'>
    <h3>{%trans "Description" %}</h3>
    {%for c in v.comment_set.all%}
    <div class="description-node">
	  {%if c.attachment_set.all%}
	  <div class="attachs">
         <h4>{% trans "Attachments" %}</h4>
        <ul>
          {%for a in c.attachment_set.all%}
          <li><a href="{% url attach a.id %}">{{a.name}}</a></li>
          {%endfor%}
        </ul>
      </div>
      {%endif%}
      <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>
    {%endfor%}
</div>


  <h3>{%trans "This restriction affects me too" %}</h3>
  <div class="info-validate" style="display: inline-block;">
    <form method="get" id="{{ v.pk }}" class="confirm_form" >
        <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>
  {%endif%}
  {% if not key %}
  <div id="comments">
  <h3>{% trans "Comments" %}</h3>
  {% get_comment_list for v as cmt_list %}
  {% for comment in cmt_list %}
  <div class="comment">
     <p>{{ comment.user_name }} - {{ comment.submit_date }}</p>
     <p>{{ comment.comment|striptags|urlize|linebreaks }}</p>
  </div>
  {% endfor %}
  <div class="toggle button">{% trans "Add comment" %}</div>
  <div id="comment_form" style="display: none;">
    {% render_comment_form for v %}
  </div>
  {% else %}
  <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>
  {% endif %}
</div>
{%endblock%}