landing.html 3.68 KB
Newer Older
1
{% extends 'layouts/base.html' %} {% block title %} SRCT Roomlist • Homepage {% endblock %} {% block content %}
2 3 4

{% include 'messages.html' %}

5 6 7 8 9
{% load cache %}
{% load gravatar %}
<h2>Welcome Back {{ request.user.first_name }}!</h2>
<legend></legend>

10 11 12 13
{% if not me.room %}
  <h3><em><a href="{% url 'updateStudent' request.user.username %}">Select your room</a>, and we'll show you the other students on your floor.</em></h3>
{% else %}

14 15
{% cache 300 roommates request.user.username %}
  {% if roomies|length == 1 %}
Daniel W Bond's avatar
Daniel W Bond committed
16
    <h3>Your Roommate in {{ me.room }}</h3>
17 18
    <legend></legend>
  {% else %}
Daniel W Bond's avatar
Daniel W Bond committed
19
  <h3>Your Roommates in <a href="{{ me.room.get_absolute_url }}">{{ me.room }}</a></h3>
20 21 22 23
  <legend></legend>
  {% endif %}
    <div class="row">
      {% for student in roomies %}
Daniel W Bond's avatar
Daniel W Bond committed
24
          <div class="col-md-3 text-center">
25
            <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>
26
            <h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.user.get_full_name }}</strong></a></h4>
Daniel W Bond's avatar
Daniel W Bond committed
27
            <h5><a href="{{ student.major.get_absolute_url }}"><em>{{ student.major }}</em></a></h5>
28
          </div>
29 30 31 32 33
      {% if forloop.counter|divisibleby:4 %}
      </div>
      <br />
      <div class="row">
      {% endif %}
Daniel W Bond's avatar
Daniel W Bond committed
34 35
      {% empty %}
        <h4>There are no other students registered in your room right now.</h4>
36 37 38 39
      {% endfor %}
    </div>
{% endcache %}

Daniel W Bond's avatar
Daniel W Bond committed
40 41
{% load humanize %}

42
{% cache 300 floormates request.user.username %}
Daniel W Bond's avatar
Daniel W Bond committed
43
<h3>Your Floormates from <a href="{{ me.room.floor.get_absolute_url }}">{{ me.room.floor.building }} {{ me.room.floor.number|ordinal }}</a></h3>
44 45 46
    <legend></legend>
    <div class="row">
      {% for student in floories %}
Daniel W Bond's avatar
Daniel W Bond committed
47
      <div class="col-md-3 text-center">
48
        <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>
49
        <h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.user.get_full_name }}</strong></a></h4>
Daniel W Bond's avatar
Daniel W Bond committed
50 51
        <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>
52
      </div>
53 54 55 56 57
      {% if forloop.counter|divisibleby:4 %}
        </div>
        <br />
        <div class="row">
      {% endif %}
Daniel W Bond's avatar
Daniel W Bond committed
58 59
      {% empty %}
        <h4>There are no other students registered on your floor right now.</h4>
60 61 62 63
      {% endfor %}
    </div>
{% endcache %}

64 65 66 67 68 69
{% endif %}

{% if not me.major %}
  <h3><em><a href="{% url 'updateStudent' request.user.username %}">Set your major</a>, and we'll show you some of the other students in your program.</em></h3>
{% else %}

70
{% cache 600 majormates request.user.username %}
Daniel W Bond's avatar
Daniel W Bond committed
71
    <h3>Other Students in <a href="{{ me.major.get_absolute_url }}">{{ me.major.name }}</a></h3>
72 73 74
    <legend></legend>
    <div class="row">
      {% for student in majormates %}
Daniel W Bond's avatar
Daniel W Bond committed
75
      <div class="col-md-3 text-center">
76
        <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>
77
        <h4><a href="{{ student.get_full_name }}"><strong>{{ student.user.get_full_name }}</strong></a></h4>
78
      </div>
79 80 81 82 83
      {% if forloop.counter|divisibleby:4 %}
        </div>
        <br />
        <div class="row">
      {% endif %}
Daniel W Bond's avatar
Daniel W Bond committed
84 85
      {% empty %}
        <h4>There are no other students registered in your major right now.</h4>
86 87 88 89
      {% endfor %}
    </div>
{% endcache %}

90
{% endif %}
91 92

{% endblock %}