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

Har plassert bokhyllene på framsida (#14). Trodde de var der allerede, men tydeligvis ikke.

This commit is contained in:
Tiril Anette Langfeldt Rødland 2011-03-07 12:39:05 +00:00
parent 3969954144
commit 25215718ee
2 changed files with 12 additions and 5 deletions

View File

@ -82,7 +82,14 @@ 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):
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): def SearchView(request):
if 'searchterm' in request.GET: if 'searchterm' in request.GET:

View File

@ -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 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 {% for category in column %}{% if category.id == highlight_string %}class="highlight"{% endif %}{% endfor %}>
<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.id == highlight_string %}class="highlight"{% endif %}><a href="/kategori/{{ category.id }}">{{ category }}</a></td></tr>
{% endfor %} {% endfor %}
</table> </table>
</td> </td>