search.html 2.7 KB
Newer Older
Daniel W Bond's avatar
Daniel W Bond committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
{% extends 'layouts/base.html' %}

{% block title %}
SRCT Roomlist • Search Students
{% endblock %}

{% block content %}

<div class="page-header" id="banner">
  <div class="row">
    <div class="col-lg-12">
      <h1 class="text-center"><strong>SRCT</strong>&#8203;ROOMLIST</h1>
      <p class="lead text-center"><strong>Search</strong></p>
    </div>
  </div>
</div>

<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>Name</strong> or <strong>Username</strong></label>
    <div class="col-md-2">
      {{ form.q }}
    </div>
    <button type="submit" class="btn btn-default"><i class="fa fa-search fa-fw fa-lg"></i></button>
  </div>
</form>

{% if query %}

<div class="row">
  <div class="col-md-10 col-md-offset-1">

    {% if page.object_list %}
      <table class="table table-hover">
        <thead>
          <th class="col-md-2"><h3><small>Username</small></h3></th>
          <th class="col-md-6"><h3><small>Name</small></h3></th>
          <th class="col-md-4"><h3><small>Major</small></h3></th>
        </thead>
    {% endif %}

    {% for result in page.object_list %}
      <tr>
        <td>
          <h4>{{ result.object.user.username }}</h4>
        </td>
        <td>
48
          <a href="{{ result.object.get_absolute_url }}"><h4><strong>{{ result.object.user.get_full_name_or_uname }}</strong></h4></a>
Daniel W Bond's avatar
Daniel W Bond committed
49 50
        </td>
        <td>
51 52 53 54 55
          {% if result.object.major %}
            <a href="{{ result.object.major.get_absolute_url }}"><h4>{{ result.object.major }}</h4></a>
          {% else %}
            &nbsp;&mdash;
          {% endif %}
Daniel W Bond's avatar
Daniel W Bond committed
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
        </td>
      </tr>
    {% empty %}
      <h3 class="text-center">No results found.</h3>
    {% endfor %}

    {% if page.object_list %}
      </table>
    {% endif %}

  </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 }}">
            <h4>&larr; Previous</h4>
          </a>
        </li>
      {% else %}
        <li class="previous disabled">
          <a>
            <h4>&larr; Previous</h4>
          </a>
        </li>
      {% endif %}

      {% if page.has_next %}
        <li class="next">
          <a href="?q={{ query }}&amp;page={{ page.next_page_number }}">
            <h4>Next &rarr;</h4>
          </a>
        </li>
      {% else %}
        <li class="next disabled">
          <a>
            <h4>Next &rarr;</h4>
          </a>
        </li>
      {% endif %}

    </ul>

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

108 109 110 111
<br />
<legend></legend>
{% include 'disclaimer.html' %}

Daniel W Bond's avatar
Daniel W Bond committed
112
{% endblock %}