Add css dropdown to select alternative shelves.

This commit is contained in:
Adam Kelly 2020-04-08 18:04:45 +01:00
parent 5b7f29c45b
commit 1783330708
2 changed files with 62 additions and 2 deletions

View file

@ -716,3 +716,52 @@ th, td {
background-color: #FF1654;
text-align: center;
}
div.dropdown {
display: block;
white-space: nowrap;
background-color: #EEE;
border: 2px solid #247BA0;
border-radius: 0.3em;
color: #247BA0;
width: max-content;
}
.dropdown form {
display: inline;
}
button.dropdown-button {
display: inline;
border: none;
border-radius: 0;
background-color: inherit;
color: inherit;
}
.dropdown-content {
display: none;
position: absolute;
align: left;
border-radius: 3px;
border: 2px solid #247BA0;
}
.dropdown-content button {
text-align: left;
width: 100%;
border-radius: 0;
border: none;
}
.dropdown-content button:hover {
background-color: #ddd;
}
.dropdown-content button {
border-radius: 0;
}
.dropdown-arrow:hover .dropdown-content {
display: block;
}

View file

@ -2,12 +2,23 @@
{% if request.user.is_authenticated %}
{% if not pulldown %}
<div class="dropdown secondary">
<form name="shelve" action="/shelve/" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="{{ book.id }}"></input>
<input type="hidden" name="shelf" value="{% shelve_button_identifier book %}"></input>
<button class="secondary" type="submit">{% shelve_button_text book %}</button>
</form>
<button class="dropdown-button" type="submit" style="">{% shelve_button_text book %}</button></form><div class="dropdown-arrow" style="display: inline;"><button class="dropdown-button">&dArr;</button>
<div class="dropdown-content">
<form name="shelve" action="/shelve/" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="{{ book.id }}"></input>
{% for shelf in request.user.shelf_set.all %}
<button class="secondary" name="shelf" type="submit" value="{{ shelf.identifier }}">{{ shelf.name }}</button>
{% endfor %}
</form>
</div>
</div>
</div>
{% else %}