search.html 3.04 KB
Newer Older
Daniel W Bond's avatar
Daniel W Bond committed
1 2 3 4 5 6 7 8 9 10
{% extends 'layouts/base.html' %}

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

{% block content %}

<div class="page-header" id="banner">
  <div class="row">
11 12
    <div class="col-md-12 text-center">
      <h1><strong>Search Students</strong></h1>
Daniel W Bond's avatar
Daniel W Bond committed
13 14 15 16 17 18
    </div>
  </div>
</div>

<form class="form-horizontal" method="get" action=".">
  <div class="form-group"> 
19
    <label for="{{ form.q.id_for_label }}" class="col-lg-1 col-lg-offset-2 col-md-2 col-md-offset-1 col-sm-2 col-xs-12">
Daniel W Bond's avatar
Daniel W Bond committed
20 21
      <strong>Name</strong> or <strong>Username</strong>
    </label>
22
    <div class="col-lg-6 col-md-6 col-sm-9 col-xs-10">
Daniel W Bond's avatar
Daniel W Bond committed
23 24
      {{ form.q }}
    </div>
25
  <button type="submit" class="btn btn-default"><i class="fa fa-search fa-fw fa-lg"></i></button>
Daniel W Bond's avatar
Daniel W Bond committed
26 27 28 29
  </div>
</form>

{% if query %}
30
<hr />
Daniel W Bond's avatar
Daniel W Bond committed
31 32

<div class="row">
33
  <div class="col-md-12">
Daniel W Bond's avatar
Daniel W Bond committed
34 35 36 37

    {% if page.object_list %}
      <table class="table table-hover">
        <thead>
38 39 40 41
          <th class="col-sm-2 hidden-xs"><h3><small>Username</small></h3></th>
          <th class="col-sm-5 col-xs-6"><h3><small>Name</small></h3></th>
          <th class="col-sm-4 col-xs-6"><h3><small>Major</small></h3></th>
          <th class="col-sm-1 hidden-xs"><h3><small>Year</small></h3></th>
Daniel W Bond's avatar
Daniel W Bond committed
42 43 44 45
        </thead>
    {% endif %}

    {% for result in page.object_list %}
46 47
      {% with result.object as student %}
      {% if not student in request.user.student.blocked_kids.all %}
Daniel W Bond's avatar
Daniel W Bond committed
48
      <tr>
49
        <td class="hidden-xs">
50
          <h4>{{ student.user.username }}</h4>
Daniel W Bond's avatar
Daniel W Bond committed
51 52
        </td>
        <td>
53 54 55
          <a href="{{ student.get_absolute_url }}">
           <h4><strong>{{ student.get_full_name_or_uname }}</strong></h4>
          </a>
Daniel W Bond's avatar
Daniel W Bond committed
56 57
        </td>
        <td>
58
            <h4>{% include 'double_major.html' %}</h4>
Daniel W Bond's avatar
Daniel W Bond committed
59
        </td>
60
        {% load accounts_extras %}
61
        <td class="hidden-xs">
62 63
          {% if student.graduating_year %}
            <h4>{{ student.graduating_year|bc }}</h4>
64 65 66 67
          {% else %}
            &nbsp;&mdash;
          {% endif %}
        </td>
Daniel W Bond's avatar
Daniel W Bond committed
68
      </tr>
69
      {% endif %}
70
      {% endwith %}
Daniel W Bond's avatar
Daniel W Bond committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
    {% 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 }}">
90
            <h5>&larr; Previous</h5>
Daniel W Bond's avatar
Daniel W Bond committed
91 92 93 94 95
          </a>
        </li>
      {% else %}
        <li class="previous disabled">
          <a>
96
            <h5>&larr; Previous</h5>
Daniel W Bond's avatar
Daniel W Bond committed
97 98 99 100 101 102 103
          </a>
        </li>
      {% endif %}

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

    </ul>

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

121
<hr />
122 123
{% include 'disclaimer.html' %}

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