Projects/worblehat-old
Projects
/
worblehat-old
Archived
12
0
Fork 0

Hyllekart med visning av kategorier.

This commit is contained in:
Øyvind Bergland Leknes 2011-03-06 22:42:01 +00:00
parent b7e8c3eff7
commit c295132a75
3 changed files with 12 additions and 6 deletions

View File

@ -59,8 +59,13 @@ def PersonIndex(request):
def MapIndex(request): def MapIndex(request):
shelves = Placement.get_all_shelves() shelves = Placement.get_all_shelves()
shelf_lists = [(shelf, Placement.shelf_as_list_row_then_col(shelf)) for shelf in shelves] highlight_string = None
return render_to_response('map/index.html', {'shelf_lists': shelf_lists}) 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): def MapView(request,shelf_identifier):
if shelf_identifier not in Placement.get_all_shelves(): 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}) return render_to_response('category/view.html', {'category': category, 'book_list': book_list})
def IndexView(request): def IndexView(request):
shelves = Placement.get_all_shelves() return render_to_response('index.html', {'categories': Category.objects.all().order_by('name')})
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})
def SearchView(request): def SearchView(request):
if 'searchterm' in request.GET: if 'searchterm' in request.GET:

View File

@ -7,6 +7,9 @@
{% block content %} {% block content %}
<h2>{{ category }}</h2> <h2>{{ category }}</h2>
{% if book_list %}
<a href="/kart?vis={{ category.id }}">Vis i kart.</a></li>
{% endif %}
{% if book_list %} {% if book_list %}
<div class="key">Bøker:</div> <div class="key">Bøker:</div>

View File

@ -16,7 +16,7 @@ Hyllekart
<td> <td>
<table> <table>
{% for category in column %} {% 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 %} {% endfor %}
</table> </table>
</td> </td>