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

{% block content %}
5 6 7

{% include 'messages.html' %}

8
{% load cache %}
9
{% cache 15 landing request.user.username %}
10

11
{% load gravatar %}
12
<h2>Welcome Back {{ me.get_first_name_or_uname }}!</h2>
13 14
<legend></legend>

15 16 17 18
{% 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 %}

19
  {% if roomies|length == 1 %}
Daniel W Bond's avatar
Daniel W Bond committed
20
    <h3>Your Roommate in {{ me.room }}</h3>
21 22
    <legend></legend>
  {% else %}
Daniel W Bond's avatar
Daniel W Bond committed
23
  <h3>Your Roommates in <a href="{{ me.room.get_absolute_url }}">{{ me.room }}</a></h3>
24 25 26 27
  <legend></legend>
  {% endif %}
    <div class="row">
      {% for student in roomies %}
28 29 30 31 32
        <div class="col-md-3 text-center">
          <img class="img-circle img-responsive center center-block" src="{{ student.profile_image_url }}" alt="{{ student.get_first_name_or_uname }} profile picture"></img>
          <h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.get_full_name_or_uname }}</strong></a></h4>
          <h5><a href="{{ student.major.get_absolute_url }}"><em>{{ student.major }}</em></a></h5>
        </div>
33 34 35 36 37
      {% if forloop.counter|divisibleby:4 %}
      </div>
      <br />
      <div class="row">
      {% endif %}
Daniel W Bond's avatar
Daniel W Bond committed
38
      {% empty %}
39 40 41
        <div class="col-md-12">
          <h4>There are no other students registered in your room right now.</h4>
        </div>
42 43 44
      {% endfor %}
    </div>

Daniel W Bond's avatar
Daniel W Bond committed
45 46 47
{% load humanize %}

<h3>Your Floormates from <a href="{{ me.room.floor.get_absolute_url }}">{{ me.room.floor.building }} {{ me.room.floor.number|ordinal }}</a></h3>
48 49 50
    <legend></legend>
    <div class="row">
      {% for student in floories %}
Daniel W Bond's avatar
Daniel W Bond committed
51
      <div class="col-md-3 text-center">
52 53
        <img class="img-circle img-responsive center center-block" src="{{ student.profile_image_url }}" alt="{{ student.get_first_name_or_uname }} profile picture">
        <h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.get_full_name_or_uname }}</strong></a></h4>
Daniel W Bond's avatar
Daniel W Bond committed
54 55
        <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>
56
      </div>
57 58 59 60 61
      {% if forloop.counter|divisibleby:4 %}
        </div>
        <br />
        <div class="row">
      {% endif %}
Daniel W Bond's avatar
Daniel W Bond committed
62
      {% empty %}
63 64 65
        <div class="col-md-12">
          <h4>There are no other students registered on your floor right now.</h4>
        </div>
66 67 68
      {% endfor %}
    </div>

69
{% endif %}
70
{% endcache %}
71

72
{% cache 120 landing_majors request.user.username %}
73 74 75 76
{% 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 %}

Daniel W Bond's avatar
Daniel W Bond committed
77
    <h3>Other Students in <a href="{{ me.major.get_absolute_url }}">{{ me.major.name }}</a></h3>
78 79 80
    <legend></legend>
    <div class="row">
      {% for student in majormates %}
Daniel W Bond's avatar
Daniel W Bond committed
81
      <div class="col-md-3 text-center">
82 83
        <img class="img-circle img-responsive center center-block" src="{{ student.profile_image_url }}" alt="{{ student.get_first_name_or_uname }} profile picture">
        <h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.get_full_name_or_uname }}</strong></a></h4>
84
      </div>
85 86 87 88 89
      {% if forloop.counter|divisibleby:4 %}
        </div>
        <br />
        <div class="row">
      {% endif %}
Daniel W Bond's avatar
Daniel W Bond committed
90
      {% empty %}
91 92 93
        <div class="col-md-12">
          <h4>There are no other students registered in your major right now.</h4>
        </div>
94 95 96
      {% endfor %}
    </div>

97
{% endif %}
98

99
{% endcache %}
100
{% endblock %}