Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Chronos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Chronos
Commits
5340c290
Verified
Commit
5340c290
authored
5 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Include template my_timetable.html and finish view for it
parent
3b04fcaf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!31
Biscuit merge. Closes #53.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/chronos/templates/chronos/my_timetable.html
+49
-65
49 additions, 65 deletions
aleksis/apps/chronos/templates/chronos/my_timetable.html
aleksis/apps/chronos/views.py
+36
-0
36 additions, 0 deletions
aleksis/apps/chronos/views.py
with
85 additions
and
65 deletions
aleksis/apps/chronos/templates/chronos/my_timetable.html
+
49
−
65
View file @
5340c290
{% extends 'core/base.html' %}
{% load i18n %}
{% load i18n static %}
{% block extra_head %}
<link
rel=
"stylesheet"
href=
"{% static 'css/chronos/timetable.css' %}"
>
{% endblock %}
{% block content %}
<div
class=
"row nomargin"
>
<div
class=
"col m12 s12 l6"
>
<h4>
{% trans "My plan" %}
<i>
{{ el }}
</i>
<span
class=
"badge new primary-color "
>
{% trans "SMART PLAN" %}
</span>
</h4>
<a
class=
"btn-flat waves-effect waves-light"
href=
"{% url "
timetable_smart_plan
"
raw_type
id
%}"
>
{% trans "Show week timetable" %}
</a>
</div>
<div
class=
"row nomargin"
>
<div
class=
"col m12 s12 l6"
>
<h4>
{% trans "My timetable" %}
<i>
{{ el }}
</i>
<span
class=
"badge new primary-color "
>
{% trans "SMART PLAN" %}
</span>
</h4>
<a
class=
"btn-flat waves-effect waves-light"
href=
"{% url "
timetable
"
super.type
super.el.pk
%}"
>
{% trans "Show week timetable for" %} {{ super.el.short_name }}
</a>
</div>
</div>
<div
class=
"row nomargin"
>
<div
class=
"col m12 s12 l6"
>
{% include "timetable/hintsinplan.html" %}
</div>
<div
class=
"row nomargin"
>
<div
class=
"col m12 s12 l6"
>
{# {% include "timetable/hintsinplan.html" %}#}
</div>
</div>
<script
type=
"text/javascript"
>
{
#
TODO
Use
django
-
js
-
reverse
#
}
var
dest
=
"
/timetable/my/
"
;
</script>
<script
type=
"text/javascript"
>
var
dest
=
Urls
.
myTimetable
();
</script>
<div
class=
"row"
>
<div
class=
"timetable-plan col s12 m12 l6"
>
<div
class=
"row"
>
<div
class=
"timetable-plan col s12 m12 l6"
>
{# Date #}
{# Date #}
<div
class=
"row"
>
<div
class=
"col s12"
>
<div
class=
"card timetable-title-card"
>
<div
class=
"card-content"
>
<div
class=
"row"
>
<div
class=
"col s12"
>
<div
class=
"card timetable-title-card"
>
<div
class=
"card-content"
>
<span
class=
"card-title"
>
{% include "
timetable
/datepicker.html" %}
{% if holiday %}
<span
class=
"badge new blue center-align holiday-badge"
>
{{ holiday.0 }}
</span>
{% endif %}
{% include "
chronos/partials
/datepicker.html"
with display_date_only=1
%}
{#
{% if holiday %}
#}
{#
<span
class=
"badge new blue center-align holiday-badge"
>
{{ holiday.0 }}
</span>
#}
{#
{% endif %}
#}
</span>
</div>
</div>
</div>
</div>
{# Lessons #}
{% for row, time in plan %}
<div
class=
"row"
>
<div
class=
"col s4"
>
<div
class=
"card timetable-title-card"
>
<div
class=
"card-content"
>
{# Lesson number #}
<span
class=
"card-title left"
>
{{ time.number_format }}
</span>
{# Time dimension of lesson #}
<div
class=
"right timetable-time grey-text text-darken-2"
>
<span>
{{ time.start|date:"H:i" }}
</span><br>
<span>
{{ time.end|date:"H:i" }}
</span>
</div>
</div>
</div>
</div>
{% for col in row %}
{% if forloop.counter0 == week_day %}
<div
class=
"col s8"
>
{# A lesson #}
{% include "timetable/lesson.html" %}
</div>
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
</div>
</div>
{# Lessons #}
{% for period, lessons in lesson_periods.items %}
<div
class=
"row"
>
<div
class=
"col s4"
>
{% include "chronos/partials/period_time.html" with period=period periods=periods %}
</div>
<div
class=
"col s8"
>
{# A lesson #}
{% include "chronos/partials/lesson.html" with lessons=lessons %}
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}
This diff is collapsed.
Click to expand it.
aleksis/apps/chronos/views.py
+
36
−
0
View file @
5340c290
...
...
@@ -50,6 +50,42 @@ def my_timetable(
else
:
wanted_day
=
get_next_relevant_day
(
timezone
.
now
().
date
(),
datetime
.
now
().
time
())
if
request
.
user
.
person
:
person
=
request
.
user
.
person
if
person
.
primary_group
:
# Student
type_
=
"
group
"
super_el
=
person
.
primary_group
lesson_periods_person
=
person
.
lesson_periods_as_participant
elif
person
.
is_teacher
():
# Teacher
type_
=
"
teacher
"
super_el
=
person
lesson_periods_person
=
person
.
lesson_periods_as_teacher
else
:
# If no student or teacher, redirect to all timetables
return
redirect
(
"
all_timetables
"
)
lesson_periods
=
lesson_periods_person
.
on_day
(
wanted_day
)
# Build dictionary with lessons
per_period
=
{}
for
lesson_period
in
lesson_periods
:
if
lesson_period
.
period
.
period
in
per_period
:
per_period
[
lesson_period
.
period
.
period
].
append
(
lesson_period
)
else
:
per_period
[
lesson_period
.
period
.
period
]
=
[
lesson_period
]
context
[
"
lesson_periods
"
]
=
OrderedDict
(
sorted
(
per_period
.
items
()))
context
[
"
super
"
]
=
{
"
type
"
:
type_
,
"
el
"
:
super_el
}
context
[
"
type
"
]
=
type_
context
[
"
day
"
]
=
wanted_day
context
[
"
periods
"
]
=
TimePeriod
.
get_times_dict
()
return
render
(
request
,
"
chronos/my_timetable.html
"
,
context
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment