landing.html 3.73 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 21 22 23
  <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>
24
            <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
25
            <h5><a href="{{ student.major.get_absolute_url }}"><em>{{ student.major }}</em></a></h5>
26 27 28
          </div>
      {% empty %}
        <h4>There are no other students registered in your room right now.</h4>
29 30 31 32 33
      {% if forloop.counter|divisibleby:4 %}
      </div>
      <br />
      <div class="row">
      {% endif %}
34 35 36 37 38
      {% endfor %}
    </div>
    </div>
{% endcache %}

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

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

65 66 67 68 69 70
{% 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 %}

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

93
{% endif %}
94 95

{% endblock %}