Commit 3731c86e authored by stef's avatar stef

[enh] index page and fixes

parent 1493b5e5
......@@ -129,6 +129,16 @@ def ajax(request, country=None, operator=None):
return HttpResponse(json.dumps(sorted(list(set([x.contract for x in Violation.objects.filter(country=country,activationid='',operator=operator)])))))
def index(request):
v_list = Violation.objects.filter(activationid='').order_by('id').reverse()[:3]
form = AddViolation()
return render_to_response(
'index.html',
{ 'form': form,
'violations': v_list },
context_instance=RequestContext(request))
def list_violations(request):
v_list = Violation.objects.filter(activationid='')
paginator = Paginator(v_list, 25)
......
body { border: 0; padding: 0; font-family: Verdana,Arial,Helvetica,sans-serif; }
img { border: 0; }
h1, h2, h3, h4, div, ul { padding: 0; margin: 0; }
h2 { margin: auto; width: 50%; padding 4em; }
li { list-style: none; }
.fieldWrapper { margin: 1em; width: 100%; }
.fieldWrapper label { width: 200px; display: inline-block; }
.help_text { font-size: 0.7em; left: 30px; width: 20%; position: absolute; }
.attachments { float: right; margin-top: 0.4em; display: block; clear: both; }
.attachments { float: right; margin-top: 0.4em; margin-bottom: 1em; display: block; clear: both; }
.report-node { margin: 1em; padding-bottom: 0.4em; border-bottom: 1px solid black; width: 500px;}
.report { margin: 1em; }
.atttachsg { margin: 1em; }
#addForm { margin: auto; width: 50%; padding 4em; }
#addForm { margin: auto; width: 50%; }
#add_attach { cursor: pointer; }
#show_optionals { text-decoration: underline; color: blue; cursor: pointer; clear: both; }
#optional { clear: both; }
......@@ -21,6 +20,15 @@ li { list-style: none; }
#report dd { display: inline; }
#auth { float: right; clear: both; }
#addForm.index { min-height: 700px; width: 300px; padding: 0; margin: 0; margin-right: 170px; float: left; }
#addForm .fieldWrapper label { width: 6em; display: inline-block; }
#addForm.index .help_text { font-size: 0.7em; left: 320px; width: 10%; position: absolute; }
.index #add_attach { cursor: pointer; position: absolute; left: 9em; }
#content { margin-right: 2em; margin-left: 2em; }
#content ol li { list-style: decimal; }
#latest3 { float: right; width: 12em; min-height:700px; margin-left: 1em; }
.confirm { display: inline; position: relative; }
.confirm:hover > div { display: block; }
.confirm_popup { display: none; position: absolute; right: 0; border: 2px solid #454545; padding: 10px; background: #F7F7F7; z-index: 20; }
......
tinyMCE.init({
mode : "textareas",
width : "600",
height : "200",
width : "180",
height : "600",
theme : "advanced",
theme_advanced_toolbar_align : "left",
theme_advanced_toolbar_location : "top",
......
This diff is collapsed.
Babel==0.9.6
BabelDjango==0.2.2
BeautifulSoup==3.2.0
Django==1.3
PIL==1.1.7
distribute==0.6.15
django-ajax-selects==1.1.4
django-registration==0.7
django-simple-captcha==0.3.0
django-tinymce==1.5.1a2
## FIXME: could not find svn URL in dependency_links for this package:
flup==1.0.3.dev-20110405
nltk==2.0b5
pysqlite==2.6.3
wsgiref==0.1.2
......@@ -29,8 +29,11 @@
</div>
<div id="menu" class="menu">
<a href="{%root_url%}/add/">{% trans "Report restriction" %}</a>
<a href="{%root_url%}/">{% trans "List reports" %}</a>
<a href="{%root_url%}/">{% trans "Home" %}</a>
<a href="{%root_url%}/list">{% trans "Infringements" %}</a>
<a href="{%root_url%}/about">{% trans "What's Net Neutrality" %}</a>
<a href="{%root_url%}/start">{% trans "Start Monitoring" %}</a>
<a href="{%root_url%}/contact/">{% trans "Contact" %}</a>
</div>
{% block content %}
......
{% extends "base.html" %}
{% load bt %}
{% load i18n %}
{% block styles %}
<link rel="stylesheet" type="text/css" media="all" href="{% media_url %}/css/jquery.autocomplete.css" />
{% endblock %}
{% block scripts %}
<script type="text/javascript" src="{%media_url%}/js/tinymce/tiny_mce.js"></script>
<script type="text/javascript" src="{%media_url%}/js/jquery.1.4.2.min.js"></script>
<script type="text/javascript" src="{%media_url%}/js/jquery.autocomplete.js"></script>
<script type="text/javascript" src="{%media_url%}/js/jquery.tablesorter.min.js"> </script>
<script type="text/javascript" src="{%media_url%}/js/form.js"></script>
<script type="text/javascript">
function focushandlers(ed) {
var s = ed.settings;
var realID = $('#'+ed.id+'_tbl');
tinymce.dom.Event.add(ed.getWin(), 'focus', function(e) {
if($(realID)) {
console.log(realID);
realID.parents('.fieldWrapper').find('.help_text').show();
}
});
tinymce.dom.Event.add(ed.getWin(), 'blur', function(e) {
if($(realID)) {
console.log(realID);
realID.parents('.fieldWrapper').find('.help_text').hide();
}
});
}
$(document).ready(function(){
init_form();
{% if not form.is_bound %}
$(".fieldWrapper").hide();
$("#id_country").parent().show();
$("#save_button").hide();
{% else %}
if($("#id_contractual").attr('checked')==false) {
$("#id_contract_excerpt").parent().hide();
}
{% endif %}
$("#sortedlist").tablesorter();
$('.confirm_form').submit(function() {
var self=this;
$.ajax({url: '/confirm/'+$(this).attr('id')+'/'+$(this).children('input:first').attr('value'), success: function(data) { $(self).html(data); }});
return false;
});
tinyMCE.init({
mode : "textareas",
width : "284",
height : "140",
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_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]",
});
});
</script>
{% endblock %}
{%block content%}
<div id='latest3'>
<h2>Latest Infringements</h2>
<ul>
{% for violation in violations %}
<li>
<a href="/view/{{violation.pk}}">{{ violation.operator }} ({{ violation.country }}) {{ violation.contract }}</a>
{{ violation.confirmations }} confirmations.<div class="confirm"><a>+1</a>
<div class="hidden confirm_popup">
<h3>Confirmation</h3>
<p>
<form method="get" class="confirm_form" id="{{ violation.pk }}">
E-mail: <input type="text" name="email" /><br />
//required<br />
<input type="hidden" value="{{ violation.pk }}" />
<input type="submit" value="confirm" />
</form>
</p>
</div>
</div>
</li>
{% endfor %}
</ul>
</div>
<div id='addForm' class='index'>
<h2>{% trans "Add New Violation" %}</h2>
<form name="addForm" enctype="multipart/form-data" action="{% root_url %}/add/" method="post">
{% for field in form %}
{% if field.label = 'Resource' %}<div id="show_optionals">{% trans "Provide optional details" %}</div><div id="optional">{%endif%}
<div class="fieldWrapper">
{{ field.errors }}
<div class="help_text">{{ field.help_text }}</div>
{{ field.label_tag }} {{ field }}
</div>
{% endfor %}
</div>
{% csrf_token %}
<input id="save_button" type="submit" value="{% trans "save" %}" />
</form>
</div>
<div id='content'>
<h2>How is this working?</h2>
<ol>
<li>People experience some kind of network neutrality violation such as blocking, filtering or throttling, they report their findings on our site.</li>
<li>we advertise the new violations to ellicit further confirmations and technical analysis by other customers of the same provider.</li>
<li>we assemble a complete dossier on the violation and submit it to the responsible National Regulatory Authority (NRA)</li>
<li>in 6 months from the start we submit a complete list to Commissioner Kroes.</li>
</ol>
</div>
{%endblock%}
......@@ -7,6 +7,7 @@ admin.autodiscover()
urlpatterns = patterns('',
(r'^$', bt.index),
(r'^list/$', bt.list_violations),
(r'^ajax/(?P<country>[^/]*)(/(?P<operator>[^/]*))?$', bt.ajax),
(r'^add/$', bt.add),
(r'^view/(?P<id>[0-9]*)$', bt.view),
......
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