diff --git a/.gitignore b/.gitignore index d4282223c22241df28366753b11bca4059fb7ee5..912a488a50d58f86f96c64d5333ac92bf915aa33 100755 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,6 @@ secure* *.log class.pdf class.tex -.idea/ -media/ +.idea +media node_modules \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index aa4cee9594287760f8847f3624bd402c67a31e4e..ba7b70587080ac2d496eba641ea6d25fda1ac287 100755 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> - <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (school-apps)" project-jdk-type="Python SDK" /> + <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (SchoolApps)" project-jdk-type="Python SDK" /> <component name="PyCharmProfessionalAdvertiser"> <option name="shown" value="true" /> </component> diff --git a/.idea/school-apps.iml b/.idea/school-apps.iml index e490d464724df20945b1bac315d0025acdc9ad21..92aaf5da99a787684be08744cf91a1b60503b225 100755 --- a/.idea/school-apps.iml +++ b/.idea/school-apps.iml @@ -17,7 +17,7 @@ <sourceFolder url="file://$MODULE_DIR$/schoolapps" isTestSource="false" /> <excludeFolder url="file://$MODULE_DIR$/venv" /> </content> - <orderEntry type="jdk" jdkName="Python 3.6 (school-apps)" jdkType="Python SDK" /> + <orderEntry type="jdk" jdkName="Python 3.7 (SchoolApps)" jdkType="Python SDK" /> <orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="library" name="jquery-3.2.1" level="application" /> <orderEntry type="library" name="react.production" level="application" /> diff --git a/schoolapps/schoolapps/settings.py b/schoolapps/schoolapps/settings.py index ad35c61ec61ad2d30eed55f79f8a87916b74f21b..6340eb61f90ce20f70c2c4cf4bb651d8dcdecae2 100755 --- a/schoolapps/schoolapps/settings.py +++ b/schoolapps/schoolapps/settings.py @@ -55,7 +55,6 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'material', 'django_react_templatetags', - #'django_user_agents', ] MIDDLEWARE = [ @@ -67,7 +66,6 @@ MIDDLEWARE = [ 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django_pdb.middleware.PdbMiddleware', - #'django_user_agents.middleware.UserAgentMiddleware', ] ROOT_URLCONF = 'schoolapps.urls' @@ -169,7 +167,7 @@ TIMETABLE_HEIGHT = 10 LESSONS = [('8:00', '1.'), ('8:45', '2.'), ('9:45', '3.'), ('10:35', '4.'), ('11:35', '5.'), ('12:25', '6.'), ('13:15', '7.'), ('14:05', '8.'), ('14:50', '9.')] SHORT_WEEK_DAYS = ["Mo", "Di", "Mi", "Do", "Fr"] -LONG_WEEK_DAYS = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag"] +LONG_WEEK_DAYS = [("Montag", 0), ("Dienstag", 1), ("Mittwoch", 2), ("Donnerstag", 3), ("Freitag", 4)] ######## # LDAP # diff --git a/schoolapps/static/common/style.css b/schoolapps/static/common/style.css index 8d0691cf52315f3165236910d2faabdeafdfa2b3..48cd5db5fcc2e823fede6a507d790acbe536693e 100755 --- a/schoolapps/static/common/style.css +++ b/schoolapps/static/common/style.css @@ -160,6 +160,26 @@ span.badge.new { width: 100%; } +.timetable-mobile-title-card{ + margin-top: 50px; + margin-bottom: .60rem; +} + +.timetable-mobile-title-card:first-child{ + margin-top: -10px; + margin-bottom: .60rem; +} + +.timetable-mobile-title-card .card-content{ + padding: 10px; + text-align: center; + width: 100%; +} + +.timetable-mobile-title-card .card-content .card-title{ + font-weight: bold; +} + table.substitutions td, table.substitutions th { padding: 10px 5px; } diff --git a/schoolapps/timetable/templates/timetable/datepicker.html b/schoolapps/timetable/templates/timetable/datepicker.html index b30a0aa957a3117311f028523101304a47b628a5..6b0de3402955a89636893e7a0a7d5bcf90175d70 100644 --- a/schoolapps/timetable/templates/timetable/datepicker.html +++ b/schoolapps/timetable/templates/timetable/datepicker.html @@ -57,7 +57,7 @@ </script> -<div class="col s2"> +<div class="col s2" style="display: initial;"> <a class="waves-effect waves-teal btn-flat btn-flat-medium left" id="date-before"> <i class="material-icons center">navigate_before</i> </a> diff --git a/schoolapps/timetable/templates/timetable/lesson.html b/schoolapps/timetable/templates/timetable/lesson.html index aa4f59a8f1ecb4a69777e486d80a1b40caeba5b1..1eda3c99c009aa43eaeba34f58de7ea0f1bdcd17 100644 --- a/schoolapps/timetable/templates/timetable/lesson.html +++ b/schoolapps/timetable/templates/timetable/lesson.html @@ -25,10 +25,12 @@ {# Class or room > Display teacher #} {% if type == 2 or type == 1 %} + {% if element_container.element.teacher %} <span data-position="bottom" class="tooltipped" data-tooltip="{{ element_container.element.teacher }}"><a href="{% url "timetable_smart_plan" "teacher" element_container.element.teacher.id %}">{{ element_container.element.teacher.shortcode }}</a></span> <br> + {% endif %} {% endif %} {# Badge #} @@ -81,12 +83,14 @@ {# Class or room > Display teacher #} {% if type == 2 or type == 1 %} + {% if element_container.element.teacher %} <span data-position="bottom" class="tooltipped" data-tooltip="{{ element_container.element.teacher }}"> <a href="{% url "timetable_smart_plan" "teacher" element_container.element.teacher.id %}"> {{ element_container.element.teacher.shortcode }} </a> </span> + {% endif %} {% endif %} {# Display subject #} diff --git a/schoolapps/timetable/templates/timetable/plan.html b/schoolapps/timetable/templates/timetable/plan.html index 9d4073da513ab2ae604c3afcd825443037834519..f5e6d8e2cb053c514f01ce00d20ff2892437356a 100755 --- a/schoolapps/timetable/templates/timetable/plan.html +++ b/schoolapps/timetable/templates/timetable/plan.html @@ -118,7 +118,8 @@ </a> {% endif %} </div> - <div class="timetable-plan"> + {# show full timetable on tablets, laptops and pcs #} + <div class="timetable-plan hide-on-small-and-down"> {# Week days #} <div class="row"> @@ -143,7 +144,7 @@ <div class="card timetable-title-card"> <div class="card-content"> <span class="card-title"> - {{ long_week_day }} + {{ long_week_day.0 }} </span> </div> </div> @@ -181,6 +182,48 @@ </div> {% endfor %} </div> + {# show 5 seperate ones on mobiles #} + <div class="timetable-plan hide-on-med-and-up"> + {% for long_week_day in long_week_days %} + <div class="card timetable-mobile-title-card"> + <div class="card-content"> + <span class="card-title"> + {{ long_week_day.0 }} + </span> + </div> + </div> + {% 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 == long_week_day.1 %} + <div class="col s8"> + {# A lesson #} + {% include "timetable/lesson.html" %} + </div> + {% endif %} + {% endfor %} + </div> + {% endfor %} + {% endfor %} + </div> </main> {% include 'partials/footer.html' %} diff --git a/schoolapps/timetable/views.py b/schoolapps/timetable/views.py index 57c4c0923bb2ca2b3abed0fef7d6bb0ba3265760..8166392f0774000950b6ea594a8d05f58036b53e 100755 --- a/schoolapps/timetable/views.py +++ b/schoolapps/timetable/views.py @@ -166,7 +166,6 @@ def my_plan(request, year=None, day=None, month=None): "el": el, "times": parse_lesson_times(), "week_day": date.isoweekday() - 1, - "week_days": WEEK_DAYS, "date": date, "date_js": int(date.timestamp()) * 1000, "display_date_only": True