search.html 1.57 KB
Newer Older
fred's avatar
fred committed
1 2 3 4 5 6 7 8
{% extends "base.html" %}
{% load i18n %}

{% block appbar %}
<h2>Nonstop</h2>
{% endblock %}

{% block content %}
9 10 11 12
<form id="track-search">
  {{ form.as_p }}
  <button>{% trans "Search" %}</button>
</form>
fred's avatar
fred committed
13 14
<hr>

15 16
{% if tracks %}
<table>
fred's avatar
fred committed
17
  {% for track in tracks %}
18 19 20
  <tr><td class="track"><a href="{% url 'track-view' pk=track.id %}">{{track.title}}</a></td>
      <td class="artist">{{track.artist.name}}</td>
      <td class="zone">{% for zone in track.nonstop_zones.all %}{{ zone.title }}{% if not forloop.last %}, {% endif %}{% endfor %}</td>
fred's avatar
fred committed
21
      <td class="since">{% if track.added_to_nonstop_timestamp %}(since {{track.added_to_nonstop_timestamp|date:"SHORT_DATE_FORMAT" }}){% endif %}</td>
22
  </tr>
fred's avatar
fred committed
23
  {% endfor %}
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
</table>

<div class="pagination">
    <span class="step-links">
        {% if tracks.has_previous %}
            <a href="?{{ qs }}&page={{ tracks.previous_page_number }}"></a>
        {% endif %}

        <span class="current">
            {{ tracks.number }} / {{ tracks.paginator.num_pages }}
        </span>

        {% if tracks.has_next %}
            <a href="?{{ qs }}&page={{ tracks.next_page_number }}"></a>
        {% endif %}
    </span>
</div>
fred's avatar
fred committed
41 42
{% endif %}

43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
<style>
table {
        max-width: 100%;
        min-width: 50em;
}
td {
        padding: 0.4ex 1ex;
}
td.track {
        min-width: 30em;
}
td.artist {
        min-width: 20em;
}
td.zone {
        min-width: 10em;
}
td.since {
        min-width: 10em;
}
tr:nth-child(even) {
  background: #f2f2f2;
}

.step-links a {
        padding: 1ex;
}

div.pagination {
        margin-top: 1em;
}
</style>

fred's avatar
fred committed
76
{% endblock %}