landing.html 2.94 KB
Newer Older
1 2 3 4 5 6 7 8
{% extends 'layouts/base.html' %} {% block title %} SRCT Roomlist • Homepage {% endblock %} {% block content %}
{% load cache %}
{% load gravatar %}
<h2>Welcome Back {{ request.user.first_name }}!</h2>
<legend></legend>

{% cache 300 roommates request.user.username %}
  {% if roomies|length == 1 %}
Daniel W Bond's avatar
Daniel W Bond committed
9
    <h3>Your Roommate in {{ me.room }}</h3>
10 11
    <legend></legend>
  {% else %}
Daniel W Bond's avatar
Daniel W Bond committed
12
  <h3>Your Roommates in <a href="{{ me.room.get_absolute_url }}">{{ me.room }}</a></h3>
13 14 15 16 17 18 19
  <legend></legend>
  {% endif %}
    <div class="text-center">
    <div class="row">
      {% for student in roomies %}
          <div class="col-md-3">
            <a href="{{ student.get_absolute_url }}"><img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 100 %}" alt="{{ student.user.first_name }} Gravatar picture"></img></a>
Daniel W Bond's avatar
Daniel W Bond committed
20
            <h4><a href="{{ student.get_absolute_url }}">{{ student.user.get_full_name }}</a></h4>
Daniel W Bond's avatar
Daniel W Bond committed
21
            <h5><a href="{{ student.major.get_absolute_url }}"><em>{{ student.major }}</em></a></h5>
22 23 24 25 26 27 28 29
          </div>
      {% empty %}
        <h4>There are no other students registered in your room right now.</h4>
      {% endfor %}
    </div>
    </div>
{% endcache %}

Daniel W Bond's avatar
Daniel W Bond committed
30 31
{% load humanize %}

32
{% cache 300 floormates request.user.username %}
Daniel W Bond's avatar
Daniel W Bond committed
33
<h3>Your Floormates from <a href="{{ me.room.floor.get_absolute_url }}">{{ me.room.floor.building }} {{ me.room.floor.number|ordinal }}</a></h3>
34 35 36 37 38 39
    <legend></legend>
    <div class="text-center">
    <div class="row">
      {% for student in floories %}
      <div class="col-md-3">
        <a href="{{ student.get_absolute_url }}"><img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 100 %}" alt="{{ student.user.first_name }} Gravatar picture"></a>
Daniel W Bond's avatar
Daniel W Bond committed
40
        <h4><a href="{{ student.get_absolute_url }}">{{ student.user.get_full_name }}</a></h4>
Daniel W Bond's avatar
Daniel W Bond committed
41 42
        <h5><a href="{{ student.major.get_absolute_url }}"><em>{{ student.major }}</em></a></h5>
        <h5><a href="{{ student.room.get_absolute_url }}">{{ student.room }}</h5></a>
43 44 45 46 47 48 49 50 51
      </div>
      {% empty %}
        <h4>There are no other students registered on your floor right now.</h4>
      {% endfor %}
    </div>
    </div>
{% endcache %}

{% cache 600 majormates request.user.username %}
Daniel W Bond's avatar
Daniel W Bond committed
52
    <h3>Other Students in <a href="{{ me.major.get_absolute_url }}">{{ me.major.name }}</a></h3>
53 54 55 56 57 58
    <legend></legend>
    <div class="text-center">
    <div class="row">
      {% for student in majormates %}
      <div class="col-md-3">
        <a href="{{ student.get_absolute_url }}"><img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 100 %}" alt="{{ student.user.first_name }} Gravatar picture"></a>
Daniel W Bond's avatar
Daniel W Bond committed
59
        <h4><a href="{{ student.get_full_name }}">{{ student.user.get_full_name }}</a></h4>
60 61 62 63 64 65 66 67 68 69
      </div>
      {% empty %}
        <h4>There are no other students registered in your major right now.</h4>
      {% endfor %}
    </div>
    </div>
{% endcache %}


{% endblock %}