Click through to book pages for no javascript

This commit is contained in:
Mouse Reeve 2020-04-01 14:04:59 -07:00
parent c85eba53db
commit 263b90599c
2 changed files with 4 additions and 3 deletions

View file

@ -1,4 +1,5 @@
function show_compose(element) { function show_compose(element, e) {
e.preventDefault();
var visible_compose_boxes = document.getElementsByClassName('visible'); var visible_compose_boxes = document.getElementsByClassName('visible');
for (var i = 0; i < visible_compose_boxes.length; i++) { for (var i = 0; i < visible_compose_boxes.length; i++) {
visible_compose_boxes[i].className = 'compose-suggestion'; visible_compose_boxes[i].className = 'compose-suggestion';

View file

@ -11,8 +11,8 @@
</h2> </h2>
<div class="covers-shelf {{ shelf.identifier }}"> <div class="covers-shelf {{ shelf.identifier }}">
{% for book in shelf.books %} {% for book in shelf.books %}
<div class="book-preview" onclick="show_compose(this)" id="book-{{ book.id }}"> <div class="book-preview" onclick="show_compose(this, event)" id="book-{{ book.id }}">
{% include 'snippets/book_cover.html' with book=book %} <a href="{{ book.absolute_id }}">{% include 'snippets/book_cover.html' with book=book %}</a>
{% include 'snippets/shelve_button.html' with book=book %} {% include 'snippets/shelve_button.html' with book=book %}
</div> </div>
{% endfor %} {% endfor %}