Commit 4dade8b4 authored by robin Tissot's avatar robin Tissot Committed by Robin
Browse files

Template side search form, more i18n, add page titles.

parent e8241acb
from representatives.models import Group
def search_form_options(request):
d = {}
# Note: Those queries needs to be eval in the template so that we can cache it efficiently
d['countries'] = Group.objects.filter(kind='country')
d['parties'] = Group.objects.filter(kind='group')
d['delegations'] = Group.objects.filter(kind='delegation')
d['committees'] = Group.objects.filter(kind='committee')
return d
......@@ -201,6 +201,7 @@ TEMPLATE_LOADERS = (
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
'django.template.context_processors.request',
'memopol.context_processors.search_form_options'
)
# Static files finders
......
......@@ -19,16 +19,9 @@ import api
admin.autodiscover()
urlpatterns = [
# Project-specific overrides
url(
r'^legislature/representative/(?P<group_kind>\w+)/(?P<chamber>.+)/' +
r'(?P<group>.+)/$',
RedirectGroupRepresentativeList.as_view(),
name='representative-list'
),
url(
r'^legislature/representative/(?P<group_kind>\w+)/(?P<group>.+)/$',
RedirectGroupRepresentativeList.as_view(),
RepresentativeList.as_view(),
name='representative-list'
),
url(
......@@ -98,7 +91,8 @@ urlpatterns = [
),
url(
r'^votes/dossier/(?P<pk>\d+)/$',
views.DossierDetail.as_view()
DossierDetail.as_view(),
name='dossier-detail'
),
url(r'^admin/', include(admin.site.urls)),
......
{% load i18n %}
<h1 class="text-center"><span class="glyphicon glyphicon-eye-open"></span><br/>Political memory</h1>
<p class="lead text-center">What is Memopol ?</p>
<p class="text-justify">Political Memory is a tool designed by La Quadrature du Net to help European citizens to reach members of European Parliament (MEPs) and track their voting records on issues related to fundamental freedoms online. </p>
<p class="lead text-center">{% trans "What is Memopol ?" %}</p>
<p class="text-justify">{% trans "Political Memory is a tool designed by La Quadrature du Net to help European citizens to reach members of European Parliament (MEPs) and track their voting records on issues related to fundamental freedoms online." %}</p>
<div class="container-fluid">
<div class="row">
<div class="pull-right">
<a class="btn btn-default">More on our blog</a>
<a href="http://www.memopol.org/" target="blank" class="btn btn-default">{% trans "More on our blog" %}</a>
</div>
</div>
</div>
{% load i18n %}
<form class="form-horizontal">
<div class="input-group">
<label class="sr-only" for="rechercher">Search</label>
<input type="text" class="form-control" placeholder="Search" id="rechercher">
<label class="sr-only" for="rechercher">{% trans "Search" %}</label>
<input type="text" class="form-control" placeholder="{% trans "Search" %}" id="rechercher">
<span class="input-group-btn">
<button class="btn btn-primary" type="button">
<span class="glyphicon glyphicon-search"></span>
......@@ -11,40 +13,43 @@
</form>
<button class="btn btn-default" type="button" data-toggle="collapse" data-target="#moresearch" aria-expanded="false" aria-controls="moresearch">
More search options
{% trans "More search options" %}
</button>
<div class="collapse" id="moresearch">
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#formMEP" aria-expanded="false" aria-controls="formMEP">
Find a MEP
{% trans "Find a MEP" %}
</button>
<div class="collapse" id="formMEP">
<form class="form-horizontal">
<div class="form-group">
<label class="col-sm-2" for="name">Name</label>
{# Note: could we not have only one form and get rid of this field ? #}
<label class="col-sm-2" for="name">{% trans "Name" %}</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="name" placeholder="Leave empty for all">
<input type="email" class="form-control" id="name" placeholder="{% trans "Leave empty for all" %}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3" for="country">Country</label>
<label class="col-sm-3" for="country">{% trans "Country" %}</label>
<div class="col-sm-9">
<select class="form-control" id="country">
<option>All</option>
<option>AT . Austria </option>
<option>{% trans "All" %}</option>
{% for country in countries %}
<option value="{{ country.id }}">{{ country.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3" for="party">Party</label>
<label class="col-sm-3" for="party">{% trans "Party" %}</label>
<div class="col-sm-9">
<select class="form-control" id="party">
<option>All</option>
<option>GUE/NGL . Confederal Group of the European United Left - Nordic Green Left </option>
<option>ECR . European Conservatives and Reformists Group </option>
<option>{% trans "All" %}</option>
{% for party in parties %}
<option value="{{ party.pk }}">{{ party.name }}</option>
{% endfor %}
</select>
</div>
</div>
......@@ -53,30 +58,35 @@
<label class="col-sm-3" for="delegation">Delegation</label>
<div class="col-sm-9">
<select class="form-control" id="delegation">
<option>All</option>
<option>Delegation for relations with Afghanistan </option>
<option>Delegation for relations with Australia and New Zealand </option>
<option>{% trans "All" %}</option>
{% for delegation in delegations %}
<option value="{{ delegation.pk }}">{{ delegation.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3" for="committee">Committee</label>
<div class="col-sm-9">
<select class="form-control" id="committee">
<option>All</option>
<option>AGRI . Committee on Agriculture and Rural Development </option>
<option>CONT . Committee on Budgetary Control </option>
<option>{% trans "All" %}</option>
{% for commitee in committees %}
<option value="{{ commitee.pk }}">{{ commitee.name }}</option>
{% endfor %}
</select>
</div>
</div>
<button type="submit" class="btn btn-default">Search</button>
<button type="submit" class="btn btn-default">{% trans "Search" %}</button>
</form>
</div>
{% comment %}
<!-- i don't know what is this list supposed to contain since we already have a 2 click to dossier detail btn -->
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#formDossiers" aria-expanded="false" aria-controls="formDossiers">
Explore the dossiers
{% trans "Explore the dossiers" %}
</button>
<div class="collapse" id="formDossiers">
......@@ -95,4 +105,6 @@
<button type="submit" class="btn btn-default">Search</button>
</form>
</div>
{% endcomment %}
</div>
<!DOCTYPE html>
{% load cache %}{% load i18n %}<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
......@@ -10,6 +10,7 @@
<!-- Set the viewport width to device width for mobile -->
<meta name="viewport" content="width=device-width" />
<title>{% block title %}Home - Political Memory{% endblock %}</title>
{% load compress %}
{% load staticfiles %}
{% compress css %}
......@@ -36,34 +37,28 @@
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 custom-nav">
{% block sidebar %}
{% include '_base_intro.html' %}
<hr/>
{% get_current_language as LANGUAGE_CODE %}
{% cache 3600 LANGUAGE_CODE %} {# 1 hour #}
{% include '_base_search.html' %}
{% endcache %}
<hr />
<a href="listMEP.html" class="btn btn-primary btn-block">Check out all MEPs</a>
<a href="listDossiers.html" class="btn btn-primary btn-block">Check out all Dossiers</a>
<a href="{% url "representative-list" %}" class="btn btn-primary btn-block">
{% trans "Check out all MEPs" %}</a>
<a href="{% url "dossier-list" %}" class="btn btn-primary btn-block">
{% trans "Check out all Dossiers" %}</a>
<br />
{% include '_base_position.html' %}
{% endblock %}
</div>
<div class="col-sm-9 col-sm-offset-3 {% block container-class %}{% endblock %}">
{% block content %}
<h1 class="text-center">Members of the European Parliement</h1>
<p class="lead text-center">{number} MEP from {country}, members of {party}, working in {delegation} and on {committee}.</p>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default active">
<input type="radio" name="view" id="cards" autocomplete="off" checked>
<span class="glyphicon glyphicon-th"></span>
</label>
<label class="btn btn-default">
<input type="radio" name="view" id="lists" autocomplete="off">
<span class="glyphicon glyphicon-list"></span>
</label>
</div>
<div class="text-danger">This template is empty !</div>
{% endblock %}
</div>
</div>
</div>
......
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{{ representative.full_name }}{% endblock %}
{% block content %}
<div class="row">
<div class="col-sm-3">
......
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Members of the European Parliement" %}{% endblock %}
{% block container-class %}custom-listMEP{% endblock %}
{% block content %}
<h1 class="text-center">Members of the European Parliement</h1>
<h1 class="text-center">{% trans "Members of the European Parliement" %}</h1>
<p class="lead text-center">{number} MEP from {country}, members of {party}, working in {delegation} and on {committee}.</p>
<div class="btn-group" data-toggle="buttons">
......
......@@ -2,6 +2,8 @@
{% load i18n %}
{% load humanize %}
{% block title %}{% trans "Dossier" %} {{ dossier.title }}{% endblock %}
{% block content %}
<h1 class="text-center">{% trans "Dossier" %} {{ dossier.title }}</h1>
<p class="lead text-center">{% trans "Last updated" %} {{ dossier.updated|naturalday }}</p>
......
......@@ -2,8 +2,10 @@
{% load i18n %}
{% load humanize %}
{% block title %}{% trans "Dosssiers" %}{% endblock %}
{% block content %}
<h1 class="text-center">Dossiers</h1>
<h1 class="text-center">{% trans "Dossiers" %}</h1>
<p class="lead text-center">
{% blocktrans count counter=paginator.count %}{{ counter }} dossier{% plural %}{{ counter }} dossier{% endblocktrans %}{% if search %}{% blocktrans %}on {{ search }}{% endblocktrans %}{% endif %}.
</p>
......
Supports Markdown
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