Commit cd208928 authored by Okhin's avatar Okhin

Fixing the tables and search lists

parent 5e702c47
......@@ -6,6 +6,7 @@ import json
register = Library()
@register.filter(name='jsonify')
def jsonify(object):
if isinstance(object, QuerySet):
return serialize('json', object)
......@@ -15,5 +16,3 @@ def jsonify(object):
return serialize('json', [x.object for x in object])
else:
return json.dumps(object)
register.filter('jsonify', jsonify)
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -17,11 +17,11 @@
{% endblock %}
<link rel="stylesheet" type="text/css" media="all" href="/static/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" media="all" href="/static/css/style.css" />
{% bootstrap_messages %}
{% block styles %}
{% endblock %}
</head>
<body>
{% bootstrap_messages %}
<div id="header">
<h1><a href="{% url 'homepage' %}">Respect My Net <span>{% trans "name and shame operators restricting access to the Internet" %}</span></a></h1>
<div id="user">
......@@ -140,7 +140,7 @@
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="/static/js/jquery.tablesorter.js"> </script>
<script type="text/javascript" src="/static/js/jquery.tablesorter.js"></script>
<script type="text/javascript" src="/static/js/jquery.tablesorter.widgets.js"></script>
<script type="text/javascript" src="/static/js/picnet.table.filter.min.js"></script>
<script type="text/javascript" src='/static/js/d3.min.js'></script>
<script type="text/javascript" src='/static/js/topojson.min.js'></script>
......
......@@ -39,7 +39,7 @@
$("#modal-list").append(
"<dt>" + obj.fields.resource + "</dt>" +
"<dd><p>" + obj.fields.editorial + "</p>" +
"<div class=\"confirm\"><a class=\"btn btn-default\">{% trans "Me Too" %}</a>" +
"<div class=\"confirm\"><a class=\"btn btn-default\">{% trans "Me too!" %}</a>" +
"<div class=\"info-validate float-confirm\">" +
"<form method=\"get\" action=\"\" id=\"i" + obj.pk + "\" class=\"confirm_form\">" +
"<div>" +
......@@ -112,18 +112,23 @@
{% for violation in violations %}
<tr>
<td><a href="{{ violation.get_absolute_url }}">{{ violation.operator }} ({{ violation.country|country }}) {{ violation.contract }}</a>
<div class="info-validate">
<form method="get" id="{{ violation.pk }}" class="confirm_form" >
<label>{% trans "In order to <strong>confirm</strong> this report, please enter your email address" %}</label>
<br/><input type="text" name="email" />
<input type="submit" value="{% trans "OK" %}" />
<input type="button" value="{% trans "Cancel" %}" class="cancel-button" />
<input type="hidden" value="{{ violation.pk }}" />
<div class="well collapse" id="info-{{ violation.pk }}">
<form method="post" action="/confirm/{{ violation.pk }}" id="{{ violation.pk }}">
<div class="form-group form-inline">
<label for"email-{{ violation.pk }}">{% trans "In order to <strong>confirm</strong> this report, please enter your email address" %}</label>
{% csrf_token %}
<input type="email" id="email-{{ violation.pk }}" class="form-control" name="email" placeholder="Email"/>
<input type="hidden" value="{{ violation.pk }}" />
<div class="btn-group" role="group" aria-label="confirm-deny">
<button class="btn btn-success">{% trans "OK" %}</ button>
<button data-toggle="collapse" data-target="#info-{{ violation.pk}}" aria-expanded="false" aria-controls="info-{{ volation.pk }}" type="button" class="btn btn-danger" >{% trans "Cancel" %}</button>
</div>
</div>
</form>
</div>
</td>
<td class='align-right'>{{ violation.confirmations }}</td>
<td class='align-right'><input type="button" class="confirm button" value="{% trans "Me too!" %}" />
<td class='align-right'><button type="button" class="btn btn-default" data-toggle="collapse" data-target="#info-{{ violation.pk}}" aria-expanded="false" aria-controls="info-{{ volation.pk }}">{% trans "Me too!" %}</button>
</td>
</tr>
<tr>
......
......@@ -14,51 +14,32 @@
<script type="text/javascript">
var data={% if countryweights %}{{countryweights|safe}}{%else%}[]{% endif %};
var country="{{country}}";
// Table sorter
$.tablesorter.addParser({
// set a unique id
id: 'stateparser',
is: function(s) {
// return false so this parser is not auto detected
return false;
},
format: function(s) {
// format your data for normalization
return s{% for s, translation in status %}.replace(/{{translation}}/,{{forloop.counter}}){% endfor %};
},
// set type, either numeric or text
type: 'numeric'
$("#sortedList").tablesorter({
theme: 'dropbox',
});
</script>
{% endblock %}
{% block content %}
<div id='global'>
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% trans "Reported Cases" %}
<div id="map"> </div>
<p>{% trans "This is a list of all reported cases of Net Neutrality violations by our users. Please note that we do not validate the accuracy of these reports before they are published on this list, but rather rely on confirmations and supporting evidence offered by users. If you are subjected to one of the listed restrictions, please confirm it. Cases that are not considered violations of Net Neutrality under our guidelines will be removed or not be validated." %}</p>
</div>
<div class="table-responsive" id="table">
<table class="table table-striped table-condensed" id='sortedlist'>
<table class="table table-striped table-condensed tablesorter" id='sortedlist'>
<thead>
<tr>
<th filter-type='ddl' class="col-sm-1">{% trans "Status" %}</th>
<th filter-type='ddl' class="col-sm-1">{% trans "country" %}</th>
<th filter-type='ddl' class="col-sm-1">{% trans "operator" %}</th>
<th filter-type='ddl' class="col-sm-2">{% trans "contract" %}</th>
<th filter-type='ddl' class="col-sm-2">{% trans "resource" %}</th>
<th filter-type='ddl' class="col-sm-1">{% trans "type" %}</th>
<th filter-type='ddl' class="col-sm-1">{% trans "fixed / wireless" %}</th>
<th filter='false' class="col-sm-1">{% trans "confirmations" %}</th>
<th filter='false' class="col-sm-1"></th>
<th>{% trans "Status" %}</th>
<th>{% trans "country" %}</th>
<th>{% trans "operator" %}</th>
<th>{% trans "contract" %}</th>
<th>{% trans "resource" %}</th>
<th>{% trans "type" %}</th>
<th>{% trans "fixed / wireless" %}</th>
<th>{% trans "confirmations" %}</th>
<th></th>
</tr>
</thead>
<tbody>
......@@ -73,17 +54,25 @@ $.tablesorter.addParser({
<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{{ violation.media|media }}</a></td>
<td>{{ violation.confirmations }}</td>
<td>
<div class="confirm"><a class="button">{% trans "Me too!" %}</a>
<div class="info-validate float-confirm">
<form method="get" action="" id="i{{ violation.pk }}" class="confirm_form" >
<div>
<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="{{ violation.pk }}" />
<input type="submit" value="{% trans "OK" %}" />
</div>
</form>
<input class="cancel-button" type="button" value="{% trans "Close" %}" />
<button role="button" class="btn btn-default" data-toggle="modal" data-target="#modal-{{ violation.pk }}">{% trans "Me too!" %}</button>
<div class="modal fade" id="modal-{{ violation.pk }}" tabindex="-1" role="dialog" aria-labelledby="modal-label-{{ violation.pk }}" data-backdrop="false">
<div class="modal-dialog">
<div class="modal-content">
<form method="post" class="inline-from" action="/confirm/{{ violation.pk }}" id="i{{ violation.pk }}">
<div class="modal-body">
<div class="form-group">
<label for="list-email-{{ violation.pk }}">{% trans "In order to <strong>confirm</strong> this report, please enter your email address" %}</label>
<input type="text" name="email" id="list-email-{{ violation.pk }}" placeholder="email" />
<input type="hidden" value="{{ violation.pk }}" />
{% csrf_token %}
</div>
<div class="button-box">
<button class="btn btn-success" type="submit">{% trans "OK" %}</button>
<button class="btn btn-danger" type="button" data-dismiss="modal">{% trans "Close" %}</button>
</div>
</div>
</form>
</div>
</div>
</div>
</td>
......
......@@ -14,32 +14,14 @@
<script type="text/javascript">
var data={% if countryweights %}{{countryweights|safe}}{%else%}[]{% endif %};
var country="{{country}}";
$.tablesorter.addParser({
// set a unique id
id: 'stateparser',
is: function(s) {
// return false so this parser is not auto detected
return false;
},
format: function(s) {
// format your data for normalization
return s{% for s, translation in status %}.replace(/{{translation}}/,{{forloop.counter}}){% endfor %};
},
// set type, either numeric or text
type: 'numeric'
$("#sortedList").tablesorter({
theme: 'dropbox',
});
</script>
{% endblock %}
{% block content %}
<div id="global">
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% trans "Search through cases" %}
<div id="map"> </div>
<form method="get" action=".">
......@@ -58,51 +40,60 @@ $.tablesorter.addParser({
</ul>
</div>
<table class="listing tablesorter zebra-striped" id='sortedlist'>
<thead>
<tr>
<th filter-type='ddl'>{% trans "Status" %}</th>
<th filter-type='ddl'>{% trans "country" %}</th>
<th filter-type='ddl'>{% trans "operator" %}</th>
<th filter-type='ddl'>{% trans "contract" %}</th>
<th filter-type='ddl'>{% trans "resource" %}</th>
<th filter-type='ddl'>{% trans "type" %}</th>
<th filter-type='ddl'>{% trans "fixed / wireless" %}</th>
<th filter='false'>{% trans "confirmations" %}</th>
<th filter='false'></th>
</tr>
</thead>
<tbody>
{% for result in object_list %}
<tr class="{%if result.object.state%}{{result.object.state}}{%else%}new{%endif%}-status">
<td><a class="cell-link" href="{{ result.object.get_absolute_url }}">{%if result.object.state%}{{result.object.state|status}}{%else%}{% trans "New" %}{%endif%}</a></td>
<td><a class="cell-link" href="{{ result.object.get_absolute_url }}">{{ result.object.country|country }}</a></td>
<td><a class="cell-link" href="{{ result.object.get_absolute_url }}">{{ result.object.operator }}</a></td>
<td><a class="cell-link" href="{{ result.object.get_absolute_url }}">{{ result.object.contract }}</a></td>
<td><a class="cell-link" href="{{ result.object.get_absolute_url }}">{{ result.object.resource_name }}</a></td>
<td><a class="cell-link" href="{{ result.object.get_absolute_url }}">{{ result.object.type|type }}</a></td>
<td><a class="cell-link" href="{{ result.object.get_absolute_url }}">{{ result.object.media|media }}</a></td>
<td>{{ result.object.confirmations }}</td>
<td>
<div class="confirm"><a class="button">{% trans "Me too!" %}</a>
<div class="info-validate float-confirm">
<form method="get" action="" id="i{{ violation.pk }}" class="confirm_form" >
<div>
<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="{{ violation.pk }}" />
<input type="submit" value="{% trans "OK" %}" />
<div class="table-responsive" id="table">
<table class="table table-striped table-condensed tablesorter" id='sortedlist'>
<thead>
<tr>
<th>{% trans "Status" %}</th>
<th>{% trans "country" %}</th>
<th>{% trans "operator" %}</th>
<th>{% trans "contract" %}</th>
<th>{% trans "resource" %}</th>
<th>{% trans "type" %}</th>
<th>{% trans "fixed / wireless" %}</th>
<th>{% trans "confirmations" %}</th>
<th></th>
</tr>
</thead>
</thead>
<tbody>
{% for violation in object_list %}
<tr class="{%if violation.state%}{{violation.state}}{%else%}new{%endif%}-status">
<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{%if violation.state%}{{violation.state|status}}{%else%}{% trans "New" %}{%endif%}</a></td>
<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{{ violation.country|country }}</a></td>
<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{{ violation.operator }}</a></td>
<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{{ violation.contract }}</a></td>
<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{{ violation.resource_name }}</a></td>
<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{{ violation.type|type }}</a></td>
<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{{ violation.media|media }}</a></td>
<td>{{ violation.confirmations }}</td>
<td>
<button role="button" class="btn btn-default" data-toggle="modal" data-target="#modal-{{ violation.pk }}">{% trans "Me too!" %}</button>
<div class="modal fade" id="modal-{{ violation.pk }}" tabindex="-1" role="dialog" aria-labelledby="modal-label-{{ violation.pk }}" data-backdrop="false">
<div class="modal-dialog">
<div class="modal-content">
<form method="post" class="inline-from" action="/confirm/{{ violation.pk }}" id="i{{ violation.pk }}">
<div class="modal-body">
<div class="form-group">
<label for="list-email-{{ violation.pk }}">{% trans "In order to <strong>confirm</strong> this report, please enter your email address" %}</label>
<input type="text" name="email" id="list-email-{{ violation.pk }}" placeholder="email" />
<input type="hidden" value="{{ violation.pk }}" />
{% csrf_token %}
</div>
<div class="button-box">
<button class="btn btn-success" type="submit">{% trans "OK" %}</button>
<button class="btn btn-danger" type="button" data-dismiss="modal">{% trans "Close" %}</button>
</div>
</div>
</form>
</div>
</form>
<input class="cancel-button" type="button" value="{% trans "Close" %}" />
</div>
</div>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment