landing.html 3.65 KB
Newer Older
1 2 3 4 5 6
{% 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>

7 8 9 10
{% 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 %}

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

Daniel W Bond's avatar
Daniel W Bond committed
37 38
{% load humanize %}

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

61 62 63 64 65 66
{% 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 %}

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

87
{% endif %}
88 89

{% endblock %}