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 }}