landing.html 3.71 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 13 14 15 16 17
<h2>Welcome
{% if not  me.is_noob %}
Back
{% else %}
{% endif %}
{{ me.get_first_name_or_uname }}!</h2>
18 19
<legend></legend>

20 21
{% if me.on_campus %}

22
{% if not me.room and me.on_campus %}
23
  <h3><em><a href="{% url 'update_student' request.user.username %}">Select your room</a>, and we'll show you the other students on your floor.</em></h3>
24 25
{% else %}

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

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

Daniel W Bond's avatar
Daniel W Bond committed
76
{% endif %}
77
{% endif %}
78
{% endcache %}
79

80

81
{% cache 120 landing_majors request.user.username %}
82
{% if not me.major.all %}
83
  <h3><em><a href="{% url 'update_student' request.user.username %}">Set your major</a>, and we'll show you some of the other students in your program.</em></h3>
84
{% else %}
85 86 87
  {% for major, students in majormates.items %}
    <h3>Other Students in <a href="{{ major.get_absolute_url }}">{{ major.name }}</a></h3>
    <hr />
88
    <div class="row">
89
      {% for student in students %}
Daniel W Bond's avatar
Daniel W Bond committed
90
      <div class="col-md-3 text-center">
91 92
        <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>
93
      </div>
94 95 96 97 98
      {% if forloop.counter|divisibleby:4 %}
        </div>
        <br />
        <div class="row">
      {% endif %}
Daniel W Bond's avatar
Daniel W Bond committed
99
      {% empty %}
100 101 102
        <div class="col-md-12">
          <h4>There are no other students registered in your major right now.</h4>
        </div>
103 104
      {% endfor %}
    </div>
105
  {% endfor %}
106
{% endif %}
107

108
{% endcache %}
109
{% endblock %}