search.html 3.12 KB
Newer Older
Jean Michel Rouly's avatar
Jean Michel Rouly committed
1
2
3
{% extends 'layouts/base.html' %}

{% block title %}
Daniel W Bond's avatar
Daniel W Bond committed
4
SRCT Bookshare • Search Listings
Jean Michel Rouly's avatar
Jean Michel Rouly committed
5
6
7
8
{% endblock %}

{% block content %}

9
10
11
<div class="page-header" id="banner">
  <div class="row">
    <div class="col-lg-12">
Daniel W Bond's avatar
Daniel W Bond committed
12
13
      <h1 class="text-center"><strong>SRCT</strong>&#8203;BOOKSHARE</h1>
      <p class="lead text-center"><strong>Search</strong></p>
14
15
16
17
    </div>
  </div>
</div>

18
19
20
21
22
23
24
<form class="form-horizontal" method="get" action=".">
  <div class="form-group">
    <label for "id_q" class="col-md-1 col-md-offset-4 control-label"><strong>Search</strong></label>
    <div class="col-md-2">
      {{ form.q }}
    </div>
    <button type="submut" class="btn btn-default"><i class="fa fa-search fa-fw fa-lg"></i></button>
Jean Michel Rouly's avatar
Jean Michel Rouly committed
25
  </div>
26
</form>
Jean Michel Rouly's avatar
Jean Michel Rouly committed
27

28
29
30
{% if query %}

<div class="row">
31
  <div class="col-md-12">
32

33
    {% if page.object_list %}
34
      <table class="table table-hover text-center">
35
        <thead>
36
          <td class="col-md-1"><h4><strong>ISBN</strong></h4></td>
37
          <td class="col-md-5"><h4><strong>Title</strong></h4></td>
38
          <td class="col-md-2"><h4><strong>Author</strong></h4></td>
39
          <td class="col-md-1"><h4><strong>Course</strong></h4></td>
40
          <td class="col-md-2"><h4><strong>Seller</strong></h4></td>
41
          <td class="col-md-1"><h4><strong>Price</strong></h4></td>
42
43
44
        </thead>
    {% endif %}

45
    {% for result in page.object_list %}
46
47
      <tr>
        <td class="text-center">
48
          <h5>{{ result.object.isbn }}</h5>
49
        </td>
Daniel W Bond's avatar
Daniel W Bond committed
50
        <td class="text-center">
51
          <a href="{{ result.object.get_absolute_url }}"><h5><strong>{{ result.object.title }}</strong></h5></a>
52
53
        </td>
        <td class="text-center">
54
          <h5>{{ result.object.author }}</h5>
55
        </td>
56
57
58
        <td class="text-center">
          <h5>{{ result.object.course_abbr }}</h5>
        </td>
59
60
61
62
63
64
65
        <td class="text-center">
          <h5>
            <a href="{{ result.object.seller.get_absolute_url }}">
            {{ result.object.seller.user.first_name }} {{ result.object.seller.user.last_name }}
            </a>
          </h5>
        </td>
66
        <td class="text-center">
67
          <h5>${{ result.object.price }}</h5>
68
69
        </td>
      </tr>
70
    {% empty %}
71
      <h4 class="text-center">No results found.</h4>
72
73
    {% endfor %}

74
75
76
77
    {% if page.object_list %}
      </table>
    {% endif %}

78
79
80
81
82
83
84
85
86
87
88
  </div>
</div>

<div class="row">
  <div class="col-lg-4 col-lg-offset-4">

    <ul class="pager">

      {% if page.has_previous %}
        <li class="previous">
          <a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">
89
            <h4>&larr; Previous</h4>
90
91
92
93
94
          </a>
        </li>
      {% else %}
        <li class="previous disabled">
          <a>
95
            <h4>&larr; Previous</h4>
96
97
98
99
100
101
102
          </a>
        </li>
      {% endif %}

      {% if page.has_next %}
        <li class="next">
          <a href="?q={{ query }}&amp;page={{ page.next_page_number }}">
103
            <h4>Next &rarr;</h4>
104
105
106
107
108
          </a>
        </li>
      {% else %}
        <li class="next disabled">
          <a>
109
            <h4>Next &rarr;</h4>
110
111
112
113
114
115
116
117
118
119
          </a>
        </li>
      {% endif %}

    </ul>

  </div>
</div>
{% endif %}

Jean Michel Rouly's avatar
Jean Michel Rouly committed
120
{% endblock %}