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

Ryddet litt i koden til MapIndex.

This commit is contained in:
Øyvind Bergland Leknes 2011-03-06 21:53:58 +00:00
parent ad6e4a570b
commit 385c9c2247
2 changed files with 13 additions and 5 deletions

View File

@ -59,8 +59,16 @@ 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_list = []
return render_to_response('map/index.html', {'shelf_lists': shelf_lists}) if 'highlight' in request.GET:
highlight_string = request.GET['highlight']
for category in Category.objects.filter(id=highlight_string):
highlight_list.append(category)
shelf_lists = [{'shelf_name': shelf,
'shelf_list': Placement.shelf_as_list_row_then_col(shelf)}
for shelf in shelves]
print highlight_list
return render_to_response('map/index.html', {'shelf_lists': shelf_lists, 'highlight': highlight_list})
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():

View File

@ -9,14 +9,14 @@ Hyllekart
{% for shelf in shelf_lists %} {% for shelf in shelf_lists %}
<span class="img"> <span class="img">
<table border="1" class="shelf" > <table border="1" class="shelf" >
<caption class="caption">Hylle {% if forloop.last %}B{% else %}A{% endif %}</caption> <caption class="caption">Hylle {{ shelf.shelf_name }}</caption>
{% for row in shelf.1 %} {% for row in shelf.shelf_list %}
<tr> <tr>
{% for column in row %} {% for column in row %}
<td> <td>
<table> <table>
{% for category in column %} {% for category in column %}
<tr><td><a href="/kategori/{{ category.id }}">{{ category }}</a></td></tr> <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>
{% endfor %} {% endfor %}
</table> </table>
</td> </td>