landing.html 3.67 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
{% if me.on_campus %}

17 18 19 20
{% 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 %}

21
  {% if roomies|length == 1 %}
Daniel W Bond's avatar
Daniel W Bond committed
22
    <h3>Your Roommate in {{ me.room }}</h3>
23 24
    <legend></legend>
  {% else %}
Daniel W Bond's avatar
Daniel W Bond committed
25
  <h3>Your Roommates in <a href="{{ me.room.get_absolute_url }}">{{ me.room }}</a></h3>
26 27 28 29
  <legend></legend>
  {% endif %}
    <div class="row">
      {% for student in roomies %}
30 31 32 33 34
        <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>
35 36 37 38 39
      {% if forloop.counter|divisibleby:4 %}
      </div>
      <br />
      <div class="row">
      {% endif %}
Daniel W Bond's avatar
Daniel W Bond committed
40
      {% empty %}
41 42 43
        <div class="col-md-12">
          <h4>There are no other students registered in your room right now.</h4>
        </div>
44 45 46
      {% endfor %}
    </div>

Daniel W Bond's avatar
Daniel W Bond committed
47 48 49
{% 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>
50 51 52
    <legend></legend>
    <div class="row">
      {% for student in floories %}
Daniel W Bond's avatar
Daniel W Bond committed
53
      <div class="col-md-3 text-center">
54 55
        <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
56 57
        <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>
58
      </div>
59 60 61 62 63
      {% if forloop.counter|divisibleby:4 %}
        </div>
        <br />
        <div class="row">
      {% endif %}
Daniel W Bond's avatar
Daniel W Bond committed
64
      {% empty %}
65 66 67
        <div class="col-md-12">
          <h4>There are no other students registered on your floor right now.</h4>
        </div>
68 69 70
      {% endfor %}
    </div>

71
{% endif %}
72
{% endcache %}
73

74 75
{% endif %}

76
{% cache 120 landing_majors request.user.username %}
77 78 79 80
{% 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
81
    <h3>Other Students in <a href="{{ me.major.get_absolute_url }}">{{ me.major.name }}</a></h3>
82 83 84
    <legend></legend>
    <div class="row">
      {% for student in majormates %}
Daniel W Bond's avatar
Daniel W Bond committed
85
      <div class="col-md-3 text-center">
86 87
        <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>
88
      </div>
89 90 91 92 93
      {% if forloop.counter|divisibleby:4 %}
        </div>
        <br />
        <div class="row">
      {% endif %}
Daniel W Bond's avatar
Daniel W Bond committed
94
      {% empty %}
95 96 97
        <div class="col-md-12">
          <h4>There are no other students registered in your major right now.</h4>
        </div>
98 99 100
      {% endfor %}
    </div>

101
{% endif %}
102

103
{% endcache %}
104
{% endblock %}