maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Maposmatic-dev] [PATCH 2/2] Remove pagination by letter


From: Maxime Hadjinlian
Subject: [Maposmatic-dev] [PATCH 2/2] Remove pagination by letter
Date: Mon, 21 Jun 2010 17:35:41 +0200

As discussed with the previous patch, the pagination by
letter is removed. It was too difficult to maintain with
non latin alphabet and it is now useless with the search being paginated.

Signed-off-by: Maxime Hadjinlian <address@hidden>
---
 www/maposmatic/helpers.py              |    9 ---------
 www/maposmatic/views.py                |   29 ++---------------------------
 www/media/style.css                    |    9 ---------
 www/templates/maposmatic/all_maps.html |    4 ----
 www/urls.py                            |    2 --
 5 files changed, 2 insertions(+), 51 deletions(-)

diff --git a/www/maposmatic/helpers.py b/www/maposmatic/helpers.py
index 45b96d4..9863401 100644
--- a/www/maposmatic/helpers.py
+++ b/www/maposmatic/helpers.py
@@ -146,15 +146,6 @@ def rendering_already_exists(job):
                                             job.lat_bottom_right,
                                             job.lon_bottom_right)
 
-def get_letters():
-    """Returns the list of map first-letter selectors. For now, it only returns
-    the ASCII letters of the latin alphabet. This should be improved for
-    different languages!"""
-
-    # Should we improve this to differenciate letters that have maps from those
-    # who don't?
-    return [chr(i) for i in xrange(ord('A'), ord('Z')+1)]
-
 def get_pages_list(page, paginator):
     """Returns a list of number.
     It contains the id of the pages to display for a page given."""
diff --git a/www/maposmatic/views.py b/www/maposmatic/views.py
index 4e899df..a0e4840 100644
--- a/www/maposmatic/views.py
+++ b/www/maposmatic/views.py
@@ -172,36 +172,11 @@ def all_maps(request):
         maps = paginator.page(paginator.num_pages)
 
     return render_to_response('maposmatic/all_maps.html',
-                              { 'maps': maps, 'letters': helpers.get_letters(),
-                                'form': form, 'is_search': form.is_valid(),
+                              { 'maps': maps, 'form': form,
+                                'is_search': form.is_valid(),
                                 'pages': helpers.get_pages_list(maps, 
paginator) },
                               
context_instance=MapOSMaticRequestContext(request))
 
-def all_maps_by_letter(request, letter):
-    """Displays all maps for the given first-letter."""
-
-    letter = letter[:1].upper()
-    map_list = (models.MapRenderingJob.objects.filter(status=2)
-                .filter(resultmsg="ok")
-                .filter(maptitle__startswith=letter)
-                .order_by('maptitle'))
-    paginator = Paginator(map_list, www.settings.ITEMS_PER_PAGE)
-
-    try:
-        page = int(request.GET.get('page', '1'))
-    except ValueError:
-        page = 1
-
-    try:
-        maps = paginator.page(page)
-    except (EmptyPage, InvalidPage):
-        maps = paginator.page(paginator.num_pages)
-    return render_to_response('maposmatic/all_maps.html',
-                              { 'maps': maps, 'letters': helpers.get_letters(),
-                                'current_letter': letter,
-                                'form': forms.MapSearchForm() },
-                              
context_instance=MapOSMaticRequestContext(request))
-
 def query_nominatim(request, format, squery):
     """Nominatim query gateway."""
 
diff --git a/www/media/style.css b/www/media/style.css
index 794f6ce..af1f766 100644
--- a/www/media/style.css
+++ b/www/media/style.css
@@ -317,15 +317,6 @@ div.pagination {
   text-align: center;
 }
 
-p#letterpagination {
-  text-align: center;
-}
-
-a.selectedletter {
-  font-weight: bold;
-}
-
-
 /* Map form */
 #mapform {
   width: 100%;
diff --git a/www/templates/maposmatic/all_maps.html 
b/www/templates/maposmatic/all_maps.html
index f713511..18bd6d8 100644
--- a/www/templates/maposmatic/all_maps.html
+++ b/www/templates/maposmatic/all_maps.html
@@ -36,10 +36,6 @@
 
 <h1><a href="{% url maps %}">{% trans "Maps" %}</a> <a 
href="/feeds/maps/"><img src="/smedia/feed.png" class="feedicon" title="{% 
trans "MapOSMatic maps feed" %}" /></h1>
 
-<p id="letterpagination" style="margin-bottom: 2em;">
-  <a href="{% url maps %}"{% if not current_letter %} class="selectedletter"{% 
endif %}>{% trans "All" %}</a> - {% for l in letters %}<a href="{% url 
maps-by-letter l %}"{% ifequal l current_letter %} class="selectedletter"{% 
endifequal %}>{{ l }}</a>{% if not forloop.last %} - {% endif %}{% endfor %}
-</p>
-
 {% with maps as data %}{% with form.cleaned_data.query as query %}{% include 
"maposmatic/paginator.html" %}{% endwith %}{% endwith %}
 
 {% comment %}For Django 1.0.x compatibility. With Django >= 1.1 we should use 
the empty tag.{% endcomment %}
diff --git a/www/urls.py b/www/urls.py
index 4dadb98..f1a6a70 100644
--- a/www/urls.py
+++ b/www/urls.py
@@ -47,8 +47,6 @@ urlpatterns = patterns('',
     url(r'^jobs/$', maposmatic.views.all_jobs,
         name='jobs'),
 
-    url(r'^maps/(?P<letter>[A-Z])$', maposmatic.views.all_maps_by_letter,
-        name='maps-by-letter'),
     url(r'^maps/$', maposmatic.views.all_maps,
         name='maps'),
 
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]