Hyllekart med visning av kategorier.
This commit is contained in:
parent
b7e8c3eff7
commit
c295132a75
|
@ -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:
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
{% block content %}
|
||||
|
||||
<h2>{{ category }}</h2>
|
||||
{% if book_list %}
|
||||
<a href="/kart?vis={{ category.id }}">Vis i kart.</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% if book_list %}
|
||||
<div class="key">Bøker:</div>
|
||||
|
|
|
@ -16,7 +16,7 @@ Hyllekart
|
|||
<td>
|
||||
<table>
|
||||
{% for category in column %}
|
||||
<tr><td {% if category in highlight_list %}class="highlight"{% endif %}>{% if category in highlight_list %}!!{% endif %}<a href="/kategori/{{ category.id }}">{{ category }}</a></td></tr>
|
||||
<tr><td {% if category.id == highlight_string %}class="highlight"{% endif %}><a href="/kategori/{{ category.id }}">{{ category }}</a></td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</td>
|
||||
|
|
Reference in New Issue