From c295132a7512bf07fdf6b3c5901aa5db702b7afc Mon Sep 17 00:00:00 2001 From: oyvinlek Date: Sun, 6 Mar 2011 22:42:01 +0000 Subject: [PATCH] Hyllekart med visning av kategorier. --- python/web/library/views.py | 13 ++++++++----- python/web/templates/category/view.html | 3 +++ python/web/templates/map/index.html | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/python/web/library/views.py b/python/web/library/views.py index b824ed1..a223070 100644 --- a/python/web/library/views.py +++ b/python/web/library/views.py @@ -59,8 +59,13 @@ def PersonIndex(request): def MapIndex(request): shelves = Placement.get_all_shelves() - shelf_lists = [(shelf, Placement.shelf_as_list_row_then_col(shelf)) for shelf in shelves] - return render_to_response('map/index.html', {'shelf_lists': shelf_lists}) + highlight_string = None + if 'vis' in request.GET: + highlight_string = request.GET['vis'] + shelf_lists = [{'shelf_name': shelf, + 'shelf_list': Placement.shelf_as_list_row_then_col(shelf)} + for shelf in shelves] + return render_to_response('map/index.html', {'shelf_lists': shelf_lists, 'highlight_string': highlight_string}) def MapView(request,shelf_identifier): if shelf_identifier not in Placement.get_all_shelves(): @@ -77,9 +82,7 @@ def CategoryView(request,category_identifier): return render_to_response('category/view.html', {'category': category, 'book_list': book_list}) def IndexView(request): - shelves = Placement.get_all_shelves() - shelf_lists = [(shelf, Placement.shelf_as_list_row_then_col(shelf)) for shelf in shelves] - return render_to_response('index.html', {'categories': Category.objects.all().order_by('name'), 'shelf_lists': shelf_lists}) + return render_to_response('index.html', {'categories': Category.objects.all().order_by('name')}) def SearchView(request): if 'searchterm' in request.GET: diff --git a/python/web/templates/category/view.html b/python/web/templates/category/view.html index 61981c9..4b712c7 100644 --- a/python/web/templates/category/view.html +++ b/python/web/templates/category/view.html @@ -7,6 +7,9 @@ {% block content %}

{{ category }}

+{% if book_list %} +Vis i kart. +{% endif %} {% if book_list %}
Bøker:
diff --git a/python/web/templates/map/index.html b/python/web/templates/map/index.html index bdc2fcd..9721172 100644 --- a/python/web/templates/map/index.html +++ b/python/web/templates/map/index.html @@ -16,7 +16,7 @@ Hyllekart {% for category in column %} - + {% endfor %}
{% if category in highlight_list %}!!{% endif %}{{ category }}
{{ category }}