Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
roomlist
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SRCT
roomlist
Commits
87fe8fad
Commit
87fe8fad
authored
Nov 11, 2015
by
Daniel W Bond
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor template cleaning
parent
63ca4da3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
roomlist/settings/views.py
roomlist/settings/views.py
+8
-7
roomlist/templates/landing.html
roomlist/templates/landing.html
+10
-6
No files found.
roomlist/settings/views.py
View file @
87fe8fad
...
...
@@ -22,6 +22,7 @@ class LandingPage(LoginRequiredMixin, TemplateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
LandingPage
,
self
).
get_context_data
(
**
kwargs
)
me
=
Student
.
objects
.
get
(
user
=
self
.
request
.
user
)
context
[
'me'
]
=
me
# Create Dictionaries to store Students that meet criteria
context
[
"roomies"
]
=
Student
.
objects
.
filter
(
room
=
me
.
room
).
exclude
(
user__username
=
me
)
...
...
@@ -29,13 +30,13 @@ class LandingPage(LoginRequiredMixin, TemplateView):
context
[
"majormates"
]
=
Student
.
objects
.
filter
(
major
=
me
.
major
).
exclude
(
user__username
=
me
).
order_by
(
'?'
)[:
8
]
# Hack to Correctly Display Building plus Floor
floor
=
str
(
me
.
get_floor
())
if
floor
[
len
(
floor
)
-
1
:
len
(
floor
)]
==
"1"
:
context
[
"home"
]
=
"%s %s"
%
(
me
.
get_building
(),
'First'
)
elif
floor
[
len
(
floor
)
-
1
:
len
(
floor
)]
==
"2"
:
context
[
"home"
]
=
"%s %s"
%
(
me
.
get_building
(),
'Second'
)
else
:
context
[
"home"
]
=
"%s %s"
%
(
me
.
get_building
(),
'Third'
)
#
floor = str(me.get_floor())
#
if floor[len(floor)-1:len(floor)] == "1":
#
context["home"] = "%s %s" %(me.get_building(), 'First')
#
elif floor[len(floor)-1:len(floor)] == "2":
#
context["home"] = "%s %s" %(me.get_building(), 'Second')
#
else:
#
context["home"] = "%s %s" %(me.get_building(), 'Third')
return
context
...
...
roomlist/templates/landing.html
View file @
87fe8fad
...
...
@@ -6,10 +6,10 @@
{% cache 300 roommates request.user.username %}
{% if roomies|length == 1 %}
<h3>
Your Roommate in {{
request.user.student
.room }}
</h3>
<h3>
Your Roommate in {{
me
.room }}
</h3>
<legend></legend>
{% else %}
<h3>
Your Roommates in
{{ request.user.student.room }}
</h3>
<h3>
Your Roommates in
<a
href=
"{{ me.room.get_absolute_url }}"
>
{{ me.room }}
</a>
</h3>
<legend></legend>
{% endif %}
<div
class=
"text-center"
>
...
...
@@ -17,7 +17,8 @@
{% 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>
<h4>
{{ student.user.first_name }} {{ student.user.last_name }}
</h4>
<h4>
{{ student.user.get_full_name }}
</h4>
<h5><a
href=
"{{ student.major.get_absolute_url }}"
><em>
{{ student.major }}
</em></a></h5>
</div>
{% empty %}
<h4>
There are no other students registered in your room right now.
</h4>
...
...
@@ -26,8 +27,10 @@
</div>
{% endcache %}
{% load humanize %}
{% cache 300 floormates request.user.username %}
<h3>
Your Floormates from {{ home }}
</h3>
<h3>
Your Floormates from
<a
href=
"{{ me.room.floor.get_absolute_url }}"
>
{{ me.room.floor.building }} {{ me.room.floor.number|ordinal }}
</a>
</h3>
<legend></legend>
<div
class=
"text-center"
>
<div
class=
"row"
>
...
...
@@ -35,7 +38,8 @@
<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>
<h4>
{{ student.user.first_name }} {{ student.user.last_name }}
</h4>
<a
href=
"{{ student.room.get_absolute_url }}"
><h4>
{{ student.room }}
</h4></a>
<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>
</div>
{% empty %}
<h4>
There are no other students registered on your floor right now.
</h4>
...
...
@@ -45,7 +49,7 @@
{% endcache %}
{% cache 600 majormates request.user.username %}
<h3>
Other Students in
<a
href=
"{{
request.user.student.major.get_absolute_url }}"
>
{{ request.user.student.major
}}
</a></h3>
<h3>
Other Students in
<a
href=
"{{
me.major.get_absolute_url }}"
>
{{ me.major.name
}}
</a></h3>
<legend></legend>
<div
class=
"text-center"
>
<div
class=
"row"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment