view.html 5.42 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
63
	<div id="icons">
		<span id="verified_tooltip" class="tooltip">{% trans "This case was verified by the management team" %}</span>
		<span id="confirmations_tooltip" class="tooltip">{%if v.confirmations == 0 %} {% trans "Nobody has yet confirmed the case. Feel free to do it" %} {%else%} {{v.confirmations}} {% trans "people confirmed this case" %} {%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
70
  {%if v.type%}<dt>{% trans "Type" %}</dt><dd>{{v.type}}</dd>{%endif%}
  {%if v.media%}<dt>{% trans "Media" %}</dt><dd>{{v.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>{{v.temporary}}</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
81
82
83
84
{% if v.editorial %}
<div id="editorial" class='round-box'>
   {{v.editorial}}
</div>
{% endif %}

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


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