From: Radek Czajka Date: Wed, 6 Feb 2013 15:20:23 +0000 (+0100) Subject: Add global packages, + various visual fixes X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/07096ee18c78a330205e0f0a656dee1378ceb8c2 Add global packages, + various visual fixes --- diff --git a/catalogue/management/commands/repackage.py b/catalogue/management/commands/repackage.py new file mode 100755 index 0000000..e6de171 --- /dev/null +++ b/catalogue/management/commands/repackage.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# This file is part of EduMed, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# +import os +from optparse import make_option +from django.conf import settings +from django.core.management.base import BaseCommand +from catalogue.models import Section +import zipfile + + +class Command(BaseCommand): + option_list = BaseCommand.option_list + ( + make_option('-q', '--quiet', action='store_false', dest='verbose', default=True, + help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), + ) + help = 'Rebuilds downloadable packages.' + + def build_package(self, zippath, student, verbose): + with open(zippath, 'w') as outf: + zipf = zipfile.ZipFile(outf, 'w', zipfile.ZIP_STORED) + + for si, section in enumerate(Section.objects.all()): + li = 1 + for lesson in section.lesson_set.all(): + if lesson.type == 'course': + prefix = "%d_%s/%02d_%s/" % ( + si, section.slug, + li, lesson.slug, + ) + li += 1 + elif lesson.type == 'synthetic': + prefix = "%d_%s/synteza_%s/" % ( + si, section.slug, lesson.slug) + else: + prefix = "%d_%s/%s/" % ( + si, section.slug, lesson.slug) + lesson.add_to_zip(zipf, student, prefix) + zipf.close() + + def handle(self, **options): + verbose = options.get('verbose') + + self.build_package( + os.path.join(settings.MEDIA_ROOT, settings.CATALOGUE_PACKAGE), + False, verbose) + self.build_package( + os.path.join(settings.MEDIA_ROOT, settings.CATALOGUE_PACKAGE_STUDENT), + True, verbose) diff --git a/catalogue/models.py b/catalogue/models.py index 46338c4..0c3a54c 100644 --- a/catalogue/models.py +++ b/catalogue/models.py @@ -148,17 +148,22 @@ class Lesson(models.Model): self.html_file.save("%s.html" % self.slug, File(open(html.get_filename()))) + def add_to_zip(self, zipf, student=False, prefix=''): + zipf.write(self.xml_file.path, + "%spliki-zrodlowe/%s.xml" % (prefix, self.slug)) + pdf = self.student_pdf if student else self.pdf + if pdf: + zipf.write(self.xml_file.path, + "%s%s%s.pdf" % (prefix, self.slug, "_student" if student else "")) + + def build_package(self, student=False): from StringIO import StringIO import zipfile from django.core.files.base import ContentFile buff = StringIO() zipf = zipfile.ZipFile(buff, 'w', zipfile.ZIP_STORED) - zipf.write(self.xml_file.path, "pliki-zrodlowe/%s.xml" % self.slug) - pdf = self.student_pdf if student else self.pdf - if pdf: - zipf.write(self.xml_file.path, - "%s%s.pdf" % (self.slug, "_student" if student else "")) + self.add_to_zip(zipf, student) zipf.close() fieldname = "student_package" if student else "package" getattr(self, fieldname).save( diff --git a/catalogue/static/catalogue/css/exercise.css b/catalogue/static/catalogue/css/exercise.css index b9c91e9..deb48d5 100644 --- a/catalogue/static/catalogue/css/exercise.css +++ b/catalogue/static/catalogue/css/exercise.css @@ -21,7 +21,7 @@ display: inline-block; border-radius: 0.5em; padding: 0.25em 0.5em; - margin: -0.25em -0.5em -1em 0.5em; + margin: -0.25em -0.5em -0.25em 0.5em; background: #ed7831; color: white; } .exercise .buttons { @@ -114,16 +114,14 @@ .przyporzadkuj .predicate { list-style: none; margin: 0; - padding: 0; - white-space: nowrap; } + padding: 0; } .przyporzadkuj .predicate > li { - white-space: normal; border-radius: 0.688em; padding: 0.5em 0.688em; display: inline-block; background-color: #5e6165; color: white; - width: 11.25em; + width: 11.75em; position: relative; vertical-align: top; } .przyporzadkuj .predicate > li .subjects { @@ -150,8 +148,6 @@ .przyporzadkuj .predicate > li .subjects .placeholder:after { content: "upuść tutaj"; text-style: italic; } - .przyporzadkuj .predicate .comment { - white-space: normal; } .przyporzadkuj .subject { list-style: none; margin: 0; diff --git a/catalogue/static/catalogue/css/exercise.scss b/catalogue/static/catalogue/css/exercise.scss index 6fe8c9a..6b00e20 100755 --- a/catalogue/static/catalogue/css/exercise.scss +++ b/catalogue/static/catalogue/css/exercise.scss @@ -72,7 +72,7 @@ $px: 0.0625em; display: inline-block; border-radius: 8*$px; padding: 4*$px 8*$px; - margin: -4*$px -8*$px -1em 8*$px; + margin: -4*$px -8*$px -.25em 8*$px; background: #ed7831; color: white; } @@ -166,15 +166,13 @@ $px: 0.0625em; } .predicate { @include list-plain; - white-space: nowrap; > li { - white-space: normal; @include bubble; display: inline-block; background-color: #5e6165; color: white; - width: 180*$px; + width: 188*$px; position: relative; vertical-align: top; @@ -206,7 +204,6 @@ $px: 0.0625em; } } .comment { - white-space: normal; } } .subject { diff --git a/catalogue/static/catalogue/css/layout.css b/catalogue/static/catalogue/css/layout.css index 0757538..1836845 100644 --- a/catalogue/static/catalogue/css/layout.css +++ b/catalogue/static/catalogue/css/layout.css @@ -20,10 +20,10 @@ text-transform: uppercase; } #sidebar .box-button { background-color: #ed7831; - border-radius: 0.938em; - padding: 1.063em 0.75em 1.063em 0.75em; } + border-radius: 0.938em; } #sidebar .box-button .dl-button { - color: white; } + color: white; + padding: 1.063em 0.75em 1.063em 0.75em; } #sidebar .dl-button { color: #363a3e; display: block; diff --git a/catalogue/static/catalogue/css/layout.scss b/catalogue/static/catalogue/css/layout.scss index 318c444..5596539 100755 --- a/catalogue/static/catalogue/css/layout.scss +++ b/catalogue/static/catalogue/css/layout.scss @@ -30,9 +30,9 @@ $new_black: #363a3e; .box-button { background-color: #ed7831; border-radius: 15*$px; - padding: 17*$px 12*$px 17*$px 12*$px; .dl-button { color: white; + padding: 17*$px 12*$px 17*$px 12*$px; } } .dl-button { diff --git a/catalogue/static/catalogue/css/section_list.css b/catalogue/static/catalogue/css/section_list.css index 1793d85..99046a0 100644 --- a/catalogue/static/catalogue/css/section_list.css +++ b/catalogue/static/catalogue/css/section_list.css @@ -13,8 +13,6 @@ text-transform: uppercase; margin: 0 0 1em 0; font-size: 1em; } - .section-type .section-lessons { - padding: 0 0 0 1em; } .section-type-synthetic { width: 16.25em; } diff --git a/catalogue/static/catalogue/css/section_list.scss b/catalogue/static/catalogue/css/section_list.scss index 141cba1..ecab3c8 100755 --- a/catalogue/static/catalogue/css/section_list.scss +++ b/catalogue/static/catalogue/css/section_list.scss @@ -19,10 +19,6 @@ $px: 0.0625em; margin: 0 0 1em 0; font-size: 1em; } - - .section-lessons { - padding: 0 0 0 1em; - } } .section-type-synthetic { width: 300*$px - 2 * 20*$px; diff --git a/catalogue/static/catalogue/js/edumed.js b/catalogue/static/catalogue/js/edumed.js index cc7b9e1..f11ac36 100644 --- a/catalogue/static/catalogue/js/edumed.js +++ b/catalogue/static/catalogue/js/edumed.js @@ -152,7 +152,7 @@ if (!$placeholder.hasClass('multiple')) { $placeholder.hide(); } - $added.append('x'); + $added.append('x
'); return $('.remove', $added).click(function(ev) { $added.prev(".placeholder:not(.multiple)").show(); if (!ismultiple) { diff --git a/catalogue/templates/catalogue/section_list.html b/catalogue/templates/catalogue/section_list.html index 33cf65a..0113684 100755 --- a/catalogue/templates/catalogue/section_list.html +++ b/catalogue/templates/catalogue/section_list.html @@ -14,8 +14,8 @@

Czas trwania: 45 minut

-
Pobierz wszystkie lekcje
-
Pobierz wszystkie lekcje w wersji dla ucznia
+
Pobierz wszystkie lekcje
+
Pobierz wszystkie lekcje w wersji dla ucznia

Zebrane z wszystkich działów