view.html 5.83 KB
Newer Older
1
2
3
{% extends "base.html" %}
{% load bt %}
{% load i18n %}
4
{% load comments %}
5
6
7
{% block styles %}
{% endblock %}
{% block scripts %}
8
<script type="text/javascript" src="{%media_url%}/js/jquery.1.4.2.min.js"></script>
stef's avatar
stef committed
9
<script type="text/javascript" src="{%media_url%}/js/tinymce/tiny_mce.js"></script>
10
11
<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
  $('.confirm_form').submit(function() {
     var self=this;
41
42
43
44
45
46
47
     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
48
49
     return false;
     });
stef's avatar
stef committed
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
   tinyMCE.init({
               mode : "textareas",
               width : "400",
               height : "300",
               theme : "advanced",
               theme_advanced_toolbar_align : "left",
               theme_advanced_toolbar_location : "top",
               //theme_advanced_buttons1 : "bold,italic,underline,bullist,numlist,outdent,indent,blockquote,undo,",
               theme_advanced_buttons1 : "",
               theme_advanced_buttons2 : "",
               theme_advanced_buttons3 : "",
               plugins : "paste",
               paste_auto_cleanup_on_paste : true,
               paste_strip_class_attributes: 'all',
               paste_remove_styles: true,
               //init_instance_callback: focushandlers,
               valid_elements : "@[id|title|dir<ltr?rtl|lang|xml::lang],a[rel|rev|"
                                + "charset|hreflang|name|href|title],strong/b,em/i,"
                                + "strike,u,p,-ol,-ul,-li,br,-sub,-sup,-blockquote,"
                                + ",-code,-pre,address,-h1,-h2,-h3,-h4,-h5,"
                                + "-h6,hr[size|noshade],dd,dl,dt,cite,abbr,acronym,"
                                + "del[datetime|cite],ins[datetime|cite]",
             });
73
74
});
</script>
75
76
77
{% endblock %}

{%block content%}
stef's avatar
stef committed
78
<div id='global'>
stef's avatar
stef committed
79
  <h2>{{v.operator}} ({{v.country}}) {{v.contract}}</h2>
80
<div id="report">
stef's avatar
stef committed
81
  <dl>{%if v.resource_name%}<dt>{% trans "What resource is affected?" %}</dt><dd>{{v.resource_name}}</dd>{%endif%}
82
83
84
  {%if v.type%}<dt>{% trans "Type" %}</dt><dd>{{v.type}}</dd>{%endif%}
  {%if v.media%}<dt>{% trans "Media" %}</dt><dd>{{v.media}}</dd>{%endif%}
  {%if v.temporary%}<dt>{% trans "Temporary restriction" %}</dt><dd>{{v.temporary}}</dd>{%endif%}
stef's avatar
stef committed
85
  {%if v.loophole%}<dt>{% trans "Another offer provided by the same operator removes this restriction" %}</dt><dd>{% trans "yes" %}</dd>{%endif%}
86
87
88
89
90
91
  {%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>

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


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