From 25215718ee4eacdba20e2426260e64f277040e23 Mon Sep 17 00:00:00 2001 From: tirilane Date: Mon, 7 Mar 2011 12:39:05 +0000 Subject: [PATCH] =?UTF-8?q?Har=20plassert=20bokhyllene=20p=C3=A5=20framsid?= =?UTF-8?q?a=20(#14).=20Trodde=20de=20var=20der=20allerede,=20men=20tydeli?= =?UTF-8?q?gvis=20ikke.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/web/library/views.py | 9 ++++++++- python/web/templates/index.html | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/python/web/library/views.py b/python/web/library/views.py index a223070..9aa50df 100644 --- a/python/web/library/views.py +++ b/python/web/library/views.py @@ -82,7 +82,14 @@ def CategoryView(request,category_identifier): return render_to_response('category/view.html', {'category': category, 'book_list': book_list}) def IndexView(request): - return render_to_response('index.html', {'categories': Category.objects.all().order_by('name')}) + shelves = Placement.get_all_shelves() + 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('index.html', {'shelf_lists': shelf_lists, 'highlight_string': highlight_string}) def SearchView(request): if 'searchterm' in request.GET: diff --git a/python/web/templates/index.html b/python/web/templates/index.html index 4296474..9b24b6f 100644 --- a/python/web/templates/index.html +++ b/python/web/templates/index.html @@ -11,14 +11,14 @@ Her kan du søke etter bøker til din hjertens lyst, eller gå til hyllene: {% for shelf in shelf_lists %} - - {% for row in shelf.1 %} + + {% for row in shelf.shelf_list %} {% for column in row %} -
Hylle {% if forloop.last %}B{% else %}A{% endif %}Hylle {{ shelf.shelf_name }}
+ {% for category in column %} - + {% endfor %}
{{ category }}
{{ category }}