diff --git a/schoolapps/aub/forms.py b/schoolapps/aub/forms.py index 9c19a43a09abfd4304d221c46cda733e1b7add36..440ab358f88668924ed919efed9e1899122506c5 100755 --- a/schoolapps/aub/forms.py +++ b/schoolapps/aub/forms.py @@ -23,10 +23,12 @@ class FilterAUBForm(forms.Form): class ApplyForAUBForm(forms.Form): from_date = forms.DateField(label='Datum', input_formats=['%d.%m.%Y']) - from_lesson = forms.ChoiceField(label='Stunde', choices=settings.LESSONS, required=False, widget=forms.Select(attrs = {'onchange' : 'set_time(this)'})) + from_lesson = forms.ChoiceField(label='Stunde', choices=settings.LESSONS, required=False, + widget=forms.Select(attrs={'onchange': 'setTime(this)'})) from_time = forms.TimeField(label='Zeit', input_formats=['%H:%M'], initial='8:00', ) to_date = forms.DateField(label='Datum', input_formats=['%d.%m.%Y']) - to_lesson = forms.ChoiceField(label='Stunde', choices=settings.LESSONS, required=False, widget=forms.Select(attrs = {'onchange' : 'set_time(this)'})) + to_lesson = forms.ChoiceField(label='Stunde', choices=settings.LESSONS, required=False, + widget=forms.Select(attrs={'onchange': 'setTime(this)'})) to_time = forms.TimeField(label='Zeit', input_formats=['%H:%M'], initial='15:35') description = forms.CharField(label='Bitte begründen Sie Ihren Antrag.') diff --git a/schoolapps/static/common/helper.js b/schoolapps/static/common/helper.js index e0802213c9f99c29a0f9f6b564f7a57eba7c6e00..c803c0a883c717b833060628326111e5bef26cb2 100644 --- a/schoolapps/static/common/helper.js +++ b/schoolapps/static/common/helper.js @@ -25,6 +25,33 @@ function getNowFormatted() { } +function setTime(lesson_field) { + // fill timefield based on lesson value + if (lesson_field.id === 'id_from_lesson') { + $('[id=id_from_time]').val(lesson_field.value); + } + else { + // calculate lessons end time + // string methods easier than date function muddle + var h = lesson_field.value.split(':')[0]; + var m = lesson_field.value.split(':')[1]; + if (m < 15) { + m = parseInt(m) + 45; + } + else { + m = parseInt(m) - 15; + h = parseInt(h) + 1; + } + m = m.toString() + h = h.toString() + if (m.length === 1) { + m = '0' + m + } + var newTime = h + ':' + m; + $('[id=id_to_time]').val(newTime); + } +} + $(document).ready(function () { // Initialize sidenav [MAT] $(".sidenav").sidenav(); @@ -60,6 +87,11 @@ $(document).ready(function () { doneText: 'OK' }); - //Initialize tooltip [MAT] + // Initialize tooltip [MAT] $('.tooltipped').tooltip(); + + // Initalize print button + $("#print").click(function () { + window.print(); + }); }); \ No newline at end of file diff --git a/schoolapps/static/common/style.css b/schoolapps/static/common/style.css index 9e28771820a373b2d2291a7b1b52a2585eb2267c..0cf34295b27980a09779490ae1fc0ddbfa608257 100755 --- a/schoolapps/static/common/style.css +++ b/schoolapps/static/common/style.css @@ -9,11 +9,11 @@ body { } .primary-color { - background-color: #da1f3d !important; + background-color: #da1f3d; } .primary-color-text { - color: #da1f3d !important; + color: #da1f3d; } /**********/ @@ -46,7 +46,7 @@ ul.sidenav.sidenav-fixed .brand-logo { margin: 0; } -ul.sidenav.sidenav-fixed li.logo img { +.logo img { width: 250px; } @@ -181,4 +181,67 @@ table.substitutions td, table.substitutions th { table.striped > tbody > tr:nth-child(odd) { background-color: rgba(208, 208, 208, 0.5); -} \ No newline at end of file +} + +/*+++++++*/ +/* Print */ +/*+++++++*/ +#print-header { + display: none; +} + +@media print { + body { + font-size: 15px; + } + + header, main, footer { + margin-left: 0; + } + + ul.sidenav { + display: none !important; + transform: translateX(-105%) !important; + } + + nav { + display: none; + } + + .sidenav-trigger { + display: none; + } + + #print-header { + display: block; + border-bottom: 1px solid; + margin-bottom: 0; + } + + #print-header .col.right-align { + padding: 15px; + } + + main, header { + padding: 0; + } + + footer, footer .footer-copyright, footer .container { + background-color: white !important; + color: black !important; + } + + footer a { + display: none; + } + + .footer-copyright, .footer-copyright .container { + padding: 0 !important; + margin: 0 !important; + } + + .no-print { + display: none; + } +} + diff --git a/schoolapps/templates/partials/header.html b/schoolapps/templates/partials/header.html index b020e0c1eaea1e81f8712ef4197d518d64d159ce..76b605c4c8a4aaf2e2650d277902dd517ad84f6a 100755 --- a/schoolapps/templates/partials/header.html +++ b/schoolapps/templates/partials/header.html @@ -20,82 +20,13 @@ <!-- django-material --> {% include 'material/includes/material_css.html' %} - <link rel="stylesheet" type="text/css" media="screen" href="{% static 'common/style.css' %}"> + <link rel="stylesheet" type="text/css" href="{% static 'common/style.css' %}"> <!----------------> <!-- JavaScript --> <!----------------> <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <script src="{% static 'materialize/dist/js/materialize.min.js' %}"></script> <script src="{% static 'common/helper.js' %}"></script> - <!--<script> - $(document).ready(function () { - // Initialize sidenav [MAT] - $(".sidenav").sidenav(); - - // Initialize datepicker [MAT] - $('.datepicker').datepicker({ - format: 'dd.mm.yyyy', - // Translate to German - i18n: { - months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], - monthsShort: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'], - weekdays: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'], - weekdaysShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], - weekdaysAbbrev: ['S', 'M', 'D', 'M', 'D', 'F', 'S'], - - // Buttons - today: 'Heute', - clear: 'Löschen', - done: 'OK', - }, - - // Set monday as first day of week - firstDay: 1, - //autoClose: true - }); - - // Initialize timepicker [MAT] - $('.timepicker').timepicker({ - twelveHour: false, - //autoClose: true, - cancelText: 'Abbrechen', - clearText: 'Löschen', - doneText: 'OK' - }); - - //Initialize tooltip [MAT] - $('.tooltipped').tooltip(); - }); - </script>--> - <script> - //set AUB-Form - function set_time(lesson_field) { - // fill timefield based on lesson value - if (lesson_field.id == 'id_from_lesson') { - $('[id=id_from_time]').val(lesson_field.value); - } - else { - // calculate lessons end time - // string methods easier than date function muddle - var h = lesson_field.value.split(':')[0]; - var m = lesson_field.value.split(':')[1]; - if (m < 15) { - m = parseInt(m) + 45; - } - else { - m = parseInt(m) - 15; - h = parseInt(h) + 1; - } - m = m.toString() - h = h.toString() - if (m.length == 1) { - m = '0' + m - } - var newTime = h + ':' + m; - $('[id=id_to_time]').val(newTime); - } - } - </script> <!-- django-material --> {% include 'material/includes/material_js.html' %} @@ -123,6 +54,14 @@ </div> </nav> + <div id="print-header" class="row"> + <div class="col s6 logo"><img src="{% static 'common/logo.png' %}"></div> + <div class="col s6 right-align"> + <strong>SchoolApps</strong><br> + Katharineum zu Lübeck + </div> + </div> + <!-- Main nav (sidenav) --> <ul id="slide-out" class="sidenav sidenav-fixed"> <li class="logo"> diff --git a/schoolapps/timetable/templates/timetable/plan.html b/schoolapps/timetable/templates/timetable/plan.html index 948997f8513a4b51ebc49d6a947985f10ac3b5e2..77af7c862f832a5706d8c00615182b9bd19c8d25 100755 --- a/schoolapps/timetable/templates/timetable/plan.html +++ b/schoolapps/timetable/templates/timetable/plan.html @@ -1,9 +1,18 @@ {% include 'partials/header.html' %} <main> - <h3> - Stundenplan <i>{{ el }}</i> - </h3> + <div class="row"> + <div class="col s12 m6 l8 xl9"> + <h3> + Stundenplan <i>{{ el }}</i> + </h3> + </div> + <div class="col s12 m6 l4 xl3 right align-right"> + <a class="waves-effect waves-teal btn-flat btn-flat-medium right" id="print"> + <i class="material-icons center">print</i> + </a> + </div> + </div> <div class="timetable-plan"> <div class="row"> <div class="col s2"> diff --git a/schoolapps/timetable/templates/timetable/substitution.html b/schoolapps/timetable/templates/timetable/substitution.html index 6099c0337841892091a00954865f209441100575..c33db779c4b70ae400df8c942607630b75470e76 100755 --- a/schoolapps/timetable/templates/timetable/substitution.html +++ b/schoolapps/timetable/templates/timetable/substitution.html @@ -42,11 +42,6 @@ $("#date-next").click(onDateNextClick); $("#date").change(onDateChanged); - // Print the site - $("#print").click(function () { - window.print(); - }); - update(); }) </script> @@ -54,7 +49,7 @@ <main> <h3>Vertretungen</h3> - <div class="row"> + <div class="row no-print"> <div class="col s12 m6 l4 xl3"> <div class="col s2"> <a class="waves-effect waves-teal btn-flat btn-flat-medium right" id="date-before"> @@ -125,7 +120,7 @@ <td class="hide-on-small-and-down"> {% if sub.badge %} - <span class="badge new green">{{ sub.badge }}</span> + <span class="badge new green darken-2">{{ sub.badge }}</span> {% endif %} </td>