Har bytta ut kategoriene på forsida (#12) med hyllekartet. Et fungerende hyllekart, siden det offisielle nå er noe brukket.
This commit is contained in:
parent
3109df62fb
commit
b7e8c3eff7
|
@ -59,16 +59,8 @@ def PersonIndex(request):
|
||||||
|
|
||||||
def MapIndex(request):
|
def MapIndex(request):
|
||||||
shelves = Placement.get_all_shelves()
|
shelves = Placement.get_all_shelves()
|
||||||
highlight_list = []
|
shelf_lists = [(shelf, Placement.shelf_as_list_row_then_col(shelf)) for shelf in shelves]
|
||||||
if 'highlight' in request.GET:
|
return render_to_response('map/index.html', {'shelf_lists': shelf_lists})
|
||||||
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():
|
||||||
|
@ -85,7 +77,9 @@ 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()
|
||||||
|
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:
|
||||||
|
|
|
@ -6,11 +6,27 @@ Heisann!!
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
Velkommen til PVVs bokdatabase, Worblehat.<br/>
|
Velkommen til PVVs bokdatabase, Worblehat.<br/>
|
||||||
Her kan du søke etter bøker til din hjertens lyst, eller gå direkte til <a href="/kart/">hyllekartet</a>.
|
Her kan du søke etter bøker til din hjertens lyst, eller gå til hyllene:
|
||||||
<h3>Kategorier:</h3>
|
<br/><br/>
|
||||||
<ul>
|
{% for shelf in shelf_lists %}
|
||||||
{% for category in categories %}
|
<span class="img">
|
||||||
<li><a href="/kategori/{{ category.id }}">{{ category }}</a></li>
|
<table border="1" class="shelf" >
|
||||||
|
<caption class="caption">Hylle {% if forloop.last %}B{% else %}A{% endif %}</caption>
|
||||||
|
{% for row in shelf.1 %}
|
||||||
|
<tr>
|
||||||
|
{% for column in row %}
|
||||||
|
<td>
|
||||||
|
<table>
|
||||||
|
{% for category in column %}
|
||||||
|
<tr><td><a href="/kategori/{{ category.id }}">{{ category }}</a></td></tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</table>
|
||||||
|
</span>
|
||||||
|
<!---<li><a href="/kart/{{ shelf_name }}">{{ shelf_name }}</a></li>---!>
|
||||||
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Reference in New Issue