landing.html 3.39 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 29 30 31 32 33
          </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
34 35
{% load humanize %}

36
{% cache 300 floormates request.user.username %}
Daniel W Bond's avatar
Daniel W Bond committed
37
<h3>Your Floormates from <a href="{{ me.room.floor.get_absolute_url }}">{{ me.room.floor.building }} {{ me.room.floor.number|ordinal }}</a></h3>
38 39 40 41 42 43
    <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>
44
        <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
45 46
        <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>
47 48 49 50 51 52 53 54
      </div>
      {% empty %}
        <h4>There are no other students registered on your floor right now.</h4>
      {% endfor %}
    </div>
    </div>
{% endcache %}

55 56 57 58 59 60
{% 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 %}

61
{% cache 600 majormates request.user.username %}
Daniel W Bond's avatar
Daniel W Bond committed
62
    <h3>Other Students in <a href="{{ me.major.get_absolute_url }}">{{ me.major.name }}</a></h3>
63 64 65 66 67 68
    <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>
69
        <h4><a href="{{ student.get_full_name }}"><strong>{{ student.user.get_full_name }}</strong></a></h4>
70 71 72 73 74 75 76 77
      </div>
      {% empty %}
        <h4>There are no other students registered in your major right now.</h4>
      {% endfor %}
    </div>
    </div>
{% endcache %}

78
{% endif %}
79 80

{% endblock %}