From: Radek Czajka Date: Fri, 8 Feb 2013 13:17:16 +0000 (+0100) Subject: add lesson footer X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/54431b5080c621c05714ccfc1accca816aeff2fc add lesson footer --- diff --git a/catalogue/models.py b/catalogue/models.py index ee0222c..f1c5377 100644 --- a/catalogue/models.py +++ b/catalogue/models.py @@ -173,6 +173,24 @@ class Lesson(models.Model): def get_syntetic(self): return self.section.syntetic_lesson(self.level) + def get_previous(self): + if self.section is None: return None + try: + return self.section.lesson_set.filter( + type=self.type, level=self.level, + order__lt=self.order).order_by('-order')[0] + except IndexError: + return None + + def get_next(self): + if self.section is None: return None + try: + return self.section.lesson_set.filter( + type=self.type, level=self.level, + order__gt=self.order).order_by('order')[0] + except IndexError: + return None + class Attachment(models.Model): slug = models.CharField(max_length=255) diff --git a/catalogue/static/catalogue/css/layout.css b/catalogue/static/catalogue/css/layout.css index 1836845..09ff5af 100644 --- a/catalogue/static/catalogue/css/layout.css +++ b/catalogue/static/catalogue/css/layout.css @@ -55,3 +55,17 @@ #main-bar { width: 40em; } + #main-bar .top-link { + float: right; } + +.lesson-footer { + clear: both; + border-top: 1px solid #777; + margin-top: 2em; + padding-top: 1em; } + .lesson-footer .section-info { + text-align: center; } + .lesson-footer .previous-lesson { + float: left; } + .lesson-footer .next-lesson { + float: right; } diff --git a/catalogue/static/catalogue/css/layout.scss b/catalogue/static/catalogue/css/layout.scss index 5596539..7bea63a 100755 --- a/catalogue/static/catalogue/css/layout.scss +++ b/catalogue/static/catalogue/css/layout.scss @@ -74,4 +74,21 @@ $new_black: #363a3e; } #main-bar { width: 640*$px; + + .top-link { + float:right; + } +} + +.lesson-footer { + clear: both; + border-top: 1px solid #777; + margin-top: 2em; + padding-top: 1em; + + .section-info { + text-align: center; + } + .previous-lesson {float: left;} + .next-lesson {float: right;} } diff --git a/catalogue/templates/catalogue/lesson_detail.html b/catalogue/templates/catalogue/lesson_detail.html index 233c271..8cf7bf4 100755 --- a/catalogue/templates/catalogue/lesson_detail.html +++ b/catalogue/templates/catalogue/lesson_detail.html @@ -112,6 +112,33 @@
{{ object.html_file.read|safe }} + + +wróć na górę +
{% endblock %}