From: Radek Czajka
Date: Thu, 14 Feb 2013 14:15:10 +0000 (+0100)
Subject: add editable chunk
X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/1a798a8611063ff9abc2b8cd9104e45580f7bffd?ds=sidebyside;hp=4949e1da2861107d61900f930d82cac11e92db98
add editable chunk
---
diff --git a/catalogue/templates/catalogue/lesson/appendix/lesson_detail.html b/catalogue/templates/catalogue/lesson/appendix/lesson_detail.html
new file mode 100755
index 0000000..b4bbc94
--- /dev/null
+++ b/catalogue/templates/catalogue/lesson/appendix/lesson_detail.html
@@ -0,0 +1,19 @@
+{% extends "catalogue/lesson/lesson_detail.html" %}
+{% load url from future %}
+
+{% block sidebar-top %}
+
+
+ Zebrane dla wszystkich tematów
+
+ To jest materiaŠwspólny dla wszystkich lekcji
+ edukacji medialnej{% if object.level.slug = "liceum" %}
+ (na poziomie zaawansowanym)
+ {% endif %}.
+ Zobacz też
+ peÅny kurs
+ z podziaÅem na poszczególne tematy.
+
+
+
+{% endblock %}
diff --git a/catalogue/templates/catalogue/lesson/course/lesson_detail.html b/catalogue/templates/catalogue/lesson/course/lesson_detail.html
new file mode 100755
index 0000000..cc22b39
--- /dev/null
+++ b/catalogue/templates/catalogue/lesson/course/lesson_detail.html
@@ -0,0 +1,23 @@
+{% extends "catalogue/lesson/lesson_detail.html" %}
+{% load url from future %}
+
+{% block sidebar-top %}
+
+
+ Realizacja i czas lekcji
+ Ta lekcja jest czÄÅciÄ
tematu
+ {{ object.section }}{% if object.level.slug = "liceum" %}
+ (na poziomie zaawansowanym)
+ {% endif %}.
+ {% with object.get_syntetic as synth %}
+ {% if synth %}
+ DostÄpna jest również
+ lekcja syntetyczna
+ dla tego tematu.
+ {% endif %}
+ {% endwith %}
+
+ Czas trwania: 45 minut.
+
+
+{% endblock %}
diff --git a/catalogue/templates/catalogue/lesson/lesson_detail.html b/catalogue/templates/catalogue/lesson/lesson_detail.html
new file mode 100755
index 0000000..8eec0da
--- /dev/null
+++ b/catalogue/templates/catalogue/lesson/lesson_detail.html
@@ -0,0 +1,108 @@
+{% extends "base.html" %}
+{% load url from future %}
+{% load lesson_link lesson_nav person_list from catalogue_tags %}
+{% load competence curriculum url_for_level from curriculum_tags %}
+
+
+{% block title %}{{ object }}{% endblock %}
+
+{% block body %}
+
+
+
+
+
+{{ object.html_file.read|safe }}
+
+
+
wrÃ³Ä na górÄ
+
+
+
+{% endblock %}
diff --git a/catalogue/templates/catalogue/lesson/synthetic/lesson_detail.html b/catalogue/templates/catalogue/lesson/synthetic/lesson_detail.html
new file mode 100755
index 0000000..8fb28c0
--- /dev/null
+++ b/catalogue/templates/catalogue/lesson/synthetic/lesson_detail.html
@@ -0,0 +1,19 @@
+{% extends "catalogue/lesson/lesson_detail.html" %}
+{% load url from future %}
+
+{% block sidebar-top %}
+
+
+ Realizacja i czas lekcji
+ Ta lekcja jest syntezÄ
tematu
+ {{ object.section }}{% if object.level.slug = "liceum" %}
+ (na poziomie zaawansowanym)
+ {% endif %}.
+ DostÄpny jest również
+ peÅny kurs
+ tego tematu.
+
+ Czas trwania: 45 minut.
+
+
+{% endblock %}
diff --git a/catalogue/templates/catalogue/lesson_detail.html b/catalogue/templates/catalogue/lesson_detail.html
deleted file mode 100755
index ef20d0e..0000000
--- a/catalogue/templates/catalogue/lesson_detail.html
+++ /dev/null
@@ -1,144 +0,0 @@
-{% extends "base.html" %}
-{% load url from future %}
-{% load lesson_link lesson_nav person_list from catalogue_tags %}
-{% load competence curriculum url_for_level from curriculum_tags %}
-
-
-{% block title %}{{ object }}{% endblock %}
-
-{% block body %}
-
-
-
-
-
-{{ object.html_file.read|safe }}
-
-
-
wrÃ³Ä na górÄ
-
-
-
-{% endblock %}
diff --git a/catalogue/templates/catalogue/section_list.html b/catalogue/templates/catalogue/section_list.html
index e5ee91e..25a093b 100755
--- a/catalogue/templates/catalogue/section_list.html
+++ b/catalogue/templates/catalogue/section_list.html
@@ -18,7 +18,7 @@
- Zebrane z wszystkich dziaÅów
+ Zebrane dla wszystkich tematów
{% for lesson in appendix %}
- {{ lesson }}
diff --git a/catalogue/urls.py b/catalogue/urls.py
index 3b40c3a..61e9e9a 100755
--- a/catalogue/urls.py
+++ b/catalogue/urls.py
@@ -1,13 +1,11 @@
from django.conf.urls import patterns, include, url
-from django.views.generic import DetailView, ListView
-from .models import Section, Lesson
-from .views import SectionView
+from .views import SectionView, LessonView
urlpatterns = patterns('',
url(r'^$',
SectionView.as_view(),
name="catalogue_lessons"),
url(r'^(?P[^/]+)/$',
- DetailView.as_view(model=Lesson),
+ LessonView.as_view(),
name="catalogue_lesson"),
)
diff --git a/catalogue/views.py b/catalogue/views.py
index 7108b2b..273bfa3 100644
--- a/catalogue/views.py
+++ b/catalogue/views.py
@@ -3,6 +3,7 @@ from django.conf import settings
from django.views.generic import DetailView, ListView
from .models import Lesson, Section
+
class SectionView(ListView):
model = Section
@@ -12,3 +13,14 @@ class SectionView(ListView):
context['package_url'] = os.path.join(settings.MEDIA_URL, settings.CATALOGUE_PACKAGE)
context['package_student_url'] = os.path.join(settings.MEDIA_URL, settings.CATALOGUE_PACKAGE_STUDENT)
return context
+
+
+class LessonView(DetailView):
+ model = Lesson
+
+ def get_template_names(self):
+ return [
+ 'catalogue/lesson/%s/lesson_detail.html' % self.object.type,
+ 'catalogue/lesson/lesson_detail.html',
+ ]
+
diff --git a/chunks/__init__.py b/chunks/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/chunks/admin.py b/chunks/admin.py
new file mode 100644
index 0000000..614e4e8
--- /dev/null
+++ b/chunks/admin.py
@@ -0,0 +1,17 @@
+from django.contrib import admin
+
+from chunks.models import Chunk, Attachment
+
+
+class ChunkAdmin(admin.ModelAdmin):
+ list_display = ('key', 'description',)
+ search_fields = ('key', 'content',)
+
+admin.site.register(Chunk, ChunkAdmin)
+
+
+class AttachmentAdmin(admin.ModelAdmin):
+ list_display = ('key',)
+ search_fields = ('key',)
+
+admin.site.register(Attachment, AttachmentAdmin)
\ No newline at end of file
diff --git a/chunks/fixtures/chunks.json b/chunks/fixtures/chunks.json
new file mode 100644
index 0000000..0d26270
--- /dev/null
+++ b/chunks/fixtures/chunks.json
@@ -0,0 +1,41 @@
+[
+ {
+ "pk": "document-list",
+ "model": "chunks.chunk",
+ "fields": {
+ "content": " Zasoby szkolnej biblioteki internetowej Wolne Lektury oraz jej funkcjonalno\u015bci wykorzystywane s\u0105 przez nauczycieli i nauczycielki podczas pracy w szkole. Poni\u017cej znajduj\u0105 si\u0119 materia\u0142y edukacyjne \u2013 scenariusze lekcji, tematy wypracowa\u0144 i inne \u2013 stworzone przez pedagog\u00f3w, kt\u00f3rzy w swojej codziennej pracy w szkole wykorzystuj\u0105 przygotowane przez nas narz\u0119dzia i opracowane merytorycznie teksty.
\r\n\r\n\r\n- Scenariusze lekcji\r\n\r\n \r\n
\r\n\r\n- Przyk\u0142ady zada\u0144 do opracowania przez zespo\u0142y uczni\u00f3w Pobierz dokument
\r\n- Tematy wypracowa\u0144 Pobierz dokument
\r\n- Repetytorium maturalne. Pobierz prezentacj\u0119
\r\n\r\n
\r\n
\r\n\r\nZach\u0119camy wszystkich nauczycieli i wszystkie nauczycielki do tworzenia materia\u0142\u00f3w edukacyjnych i publikowania ich na naszej stronie! Warto zapozna\u0107 si\u0119 z instrukcj\u0105 dotycz\u0105c\u0105 pisania scenariuszy lekcji i schematem przyk\u0142adowego scenariusza lekcji, a gotowe materia\u0142y przes\u0142a\u0107 na adres fundacja@nowoczesnapolska.org.pl.
",
+ "description": ""
+ }
+ },
+ {
+ "pk": "footer-map",
+ "model": "chunks.chunk",
+ "fields": {
+ "content": "",
+ "description": ""
+ }
+ },
+ {
+ "pk": "site-description",
+ "model": "chunks.chunk",
+ "fields": {
+ "content": "",
+ "description": ""
+ }
+ },
+ {
+ "pk": "top-message",
+ "model": "chunks.chunk",
+ "fields": {
+ "content": "",
+ "description": ""
+ }
+ },
+ {
+ "pk": "footer-img",
+ "model": "chunks.attachment",
+ "fields": {
+ "attachment": "chunks/attachment/footer.png"
+ }
+ }
+]
diff --git a/chunks/locale/de/LC_MESSAGES/django.mo b/chunks/locale/de/LC_MESSAGES/django.mo
new file mode 100644
index 0000000..be5f8ae
Binary files /dev/null and b/chunks/locale/de/LC_MESSAGES/django.mo differ
diff --git a/chunks/locale/de/LC_MESSAGES/django.po b/chunks/locale/de/LC_MESSAGES/django.po
new file mode 100644
index 0000000..7fbf84e
--- /dev/null
+++ b/chunks/locale/de/LC_MESSAGES/django.po
@@ -0,0 +1,74 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-07-19 11:39+0200\n"
+"PO-Revision-Date: 2012-04-11 22:56+0100\n"
+"Last-Translator: Kamil \n"
+"Language-Team: \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: models.py:11 models.py:33
+msgid "key"
+msgstr "Schlüssel"
+
+#: models.py:11
+msgid "A unique name for this chunk of content"
+msgstr "Die einzigartige Bezeichnung für dieses Chunk von Inhalten"
+
+#: models.py:12
+msgid "description"
+msgstr "Beschreibung"
+
+#: models.py:13
+msgid "content"
+msgstr "Inhalt"
+
+#: models.py:17
+msgid "chunk"
+msgstr "Chunk"
+
+#: models.py:18
+msgid "chunks"
+msgstr "Chunks"
+
+#: models.py:33
+msgid "A unique name for this attachment"
+msgstr "Die einzigartige Bezeichnung für diese Beilage"
+
+#: models.py:38
+msgid "attachment"
+msgstr "Beilage"
+
+#: models.py:38
+msgid "attachments"
+msgstr "Beilagen"
+
+#~ msgid "title"
+#~ msgstr "Titel"
+
+#~ msgid "slug"
+#~ msgstr "Slug"
+
+#~ msgid "file"
+#~ msgstr "Datei"
+
+#~ msgid "author"
+#~ msgstr "Autor"
+
+#~ msgid "slideshare ID"
+#~ msgstr "Dia-ID"
+
+#~ msgid "HTML"
+#~ msgstr "HTML"
+
+#~ msgid "document"
+#~ msgstr "Dokument"
diff --git a/chunks/locale/en/LC_MESSAGES/django.mo b/chunks/locale/en/LC_MESSAGES/django.mo
new file mode 100644
index 0000000..a81e430
Binary files /dev/null and b/chunks/locale/en/LC_MESSAGES/django.mo differ
diff --git a/chunks/locale/en/LC_MESSAGES/django.po b/chunks/locale/en/LC_MESSAGES/django.po
new file mode 100644
index 0000000..e81d48a
--- /dev/null
+++ b/chunks/locale/en/LC_MESSAGES/django.po
@@ -0,0 +1,53 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-07-19 11:39+0200\n"
+"PO-Revision-Date: 2012-03-04 20:05+0100\n"
+"Last-Translator: xxx \n"
+"Language-Team: LANGUAGE \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: models.py:11 models.py:33
+msgid "key"
+msgstr "key"
+
+#: models.py:11
+msgid "A unique name for this chunk of content"
+msgstr "A unique name for this piece of content"
+
+#: models.py:12
+msgid "description"
+msgstr "description"
+
+#: models.py:13
+msgid "content"
+msgstr "content"
+
+#: models.py:17
+msgid "chunk"
+msgstr "piece"
+
+#: models.py:18
+msgid "chunks"
+msgstr "pieces"
+
+#: models.py:33
+msgid "A unique name for this attachment"
+msgstr "A unique name for this attachment"
+
+#: models.py:38
+msgid "attachment"
+msgstr "attachment"
+
+#: models.py:38
+msgid "attachments"
+msgstr "attachments"
diff --git a/chunks/locale/es/LC_MESSAGES/django.mo b/chunks/locale/es/LC_MESSAGES/django.mo
new file mode 100644
index 0000000..83f03fb
Binary files /dev/null and b/chunks/locale/es/LC_MESSAGES/django.mo differ
diff --git a/chunks/locale/es/LC_MESSAGES/django.po b/chunks/locale/es/LC_MESSAGES/django.po
new file mode 100644
index 0000000..4130ea1
--- /dev/null
+++ b/chunks/locale/es/LC_MESSAGES/django.po
@@ -0,0 +1,53 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-07-19 11:39+0200\n"
+"PO-Revision-Date: 2012-02-18 13:02+0100\n"
+"Last-Translator: Anna Jopp \n"
+"Language-Team: LANGUAGE \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: models.py:11 models.py:33
+msgid "key"
+msgstr "clave"
+
+#: models.py:11
+msgid "A unique name for this chunk of content"
+msgstr "El nombre único para este elemento del contenido"
+
+#: models.py:12
+msgid "description"
+msgstr "descripción"
+
+#: models.py:13
+msgid "content"
+msgstr "contenido"
+
+#: models.py:17
+msgid "chunk"
+msgstr "elemento"
+
+#: models.py:18
+msgid "chunks"
+msgstr "elementos"
+
+#: models.py:33
+msgid "A unique name for this attachment"
+msgstr "El nombre único para este archivo adjunto"
+
+#: models.py:38
+msgid "attachment"
+msgstr "archivo adjunto"
+
+#: models.py:38
+msgid "attachments"
+msgstr "archivos adjuntos"
diff --git a/chunks/locale/fr/LC_MESSAGES/django.mo b/chunks/locale/fr/LC_MESSAGES/django.mo
new file mode 100644
index 0000000..1ef6af2
Binary files /dev/null and b/chunks/locale/fr/LC_MESSAGES/django.mo differ
diff --git a/chunks/locale/fr/LC_MESSAGES/django.po b/chunks/locale/fr/LC_MESSAGES/django.po
new file mode 100644
index 0000000..150a92c
--- /dev/null
+++ b/chunks/locale/fr/LC_MESSAGES/django.po
@@ -0,0 +1,53 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-07-19 11:39+0200\n"
+"PO-Revision-Date: 2012-02-22 20:52+0100\n"
+"Last-Translator: Ela Janota \n"
+"Language-Team: LANGUAGE \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: models.py:11 models.py:33
+msgid "key"
+msgstr "clé"
+
+#: models.py:11
+msgid "A unique name for this chunk of content"
+msgstr "Un nom unique pour ce fragment du contenu"
+
+#: models.py:12
+msgid "description"
+msgstr "description"
+
+#: models.py:13
+msgid "content"
+msgstr "contenu"
+
+#: models.py:17
+msgid "chunk"
+msgstr "fragment"
+
+#: models.py:18
+msgid "chunks"
+msgstr "fragments"
+
+#: models.py:33
+msgid "A unique name for this attachment"
+msgstr "Un nom unique pour cette pièce jointe"
+
+#: models.py:38
+msgid "attachment"
+msgstr "pièce jointe"
+
+#: models.py:38
+msgid "attachments"
+msgstr "pièces jointes"
diff --git a/chunks/locale/it/LC_MESSAGES/django.mo b/chunks/locale/it/LC_MESSAGES/django.mo
new file mode 100644
index 0000000..a07410f
Binary files /dev/null and b/chunks/locale/it/LC_MESSAGES/django.mo differ
diff --git a/chunks/locale/it/LC_MESSAGES/django.po b/chunks/locale/it/LC_MESSAGES/django.po
new file mode 100644
index 0000000..4598d53
--- /dev/null
+++ b/chunks/locale/it/LC_MESSAGES/django.po
@@ -0,0 +1,54 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-07-19 11:39+0200\n"
+"PO-Revision-Date: 2012-02-21 16:52+0100\n"
+"Last-Translator: xxx\n"
+"Language-Team: LANGUAGE \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+
+#: models.py:11 models.py:33
+msgid "key"
+msgstr "Chiave"
+
+#: models.py:11
+msgid "A unique name for this chunk of content"
+msgstr "un nome unico per questo allegato"
+
+#: models.py:12
+msgid "description"
+msgstr "descrizione"
+
+#: models.py:13
+msgid "content"
+msgstr "contenuto"
+
+#: models.py:17
+msgid "chunk"
+msgstr "blocco"
+
+#: models.py:18
+msgid "chunks"
+msgstr "blocchi"
+
+#: models.py:33
+msgid "A unique name for this attachment"
+msgstr "Un nome unico per questo allegato"
+
+#: models.py:38
+msgid "attachment"
+msgstr "allegato"
+
+#: models.py:38
+msgid "attachments"
+msgstr "allegati"
diff --git a/chunks/locale/jp/LC_MESSAGES/django.mo b/chunks/locale/jp/LC_MESSAGES/django.mo
new file mode 100644
index 0000000..ad2faa7
Binary files /dev/null and b/chunks/locale/jp/LC_MESSAGES/django.mo differ
diff --git a/chunks/locale/jp/LC_MESSAGES/django.po b/chunks/locale/jp/LC_MESSAGES/django.po
new file mode 100644
index 0000000..dcc303c
--- /dev/null
+++ b/chunks/locale/jp/LC_MESSAGES/django.po
@@ -0,0 +1,54 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-07-19 11:39+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: models.py:11 models.py:33
+msgid "key"
+msgstr ""
+
+#: models.py:11
+msgid "A unique name for this chunk of content"
+msgstr ""
+
+#: models.py:12
+msgid "description"
+msgstr ""
+
+#: models.py:13
+msgid "content"
+msgstr ""
+
+#: models.py:17
+msgid "chunk"
+msgstr ""
+
+#: models.py:18
+msgid "chunks"
+msgstr ""
+
+#: models.py:33
+msgid "A unique name for this attachment"
+msgstr ""
+
+#: models.py:38
+msgid "attachment"
+msgstr ""
+
+#: models.py:38
+msgid "attachments"
+msgstr ""
diff --git a/chunks/locale/lt/LC_MESSAGES/django.mo b/chunks/locale/lt/LC_MESSAGES/django.mo
new file mode 100644
index 0000000..6131fd5
Binary files /dev/null and b/chunks/locale/lt/LC_MESSAGES/django.mo differ
diff --git a/chunks/locale/lt/LC_MESSAGES/django.po b/chunks/locale/lt/LC_MESSAGES/django.po
new file mode 100644
index 0000000..a78804a
--- /dev/null
+++ b/chunks/locale/lt/LC_MESSAGES/django.po
@@ -0,0 +1,54 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-07-19 11:39+0200\n"
+"PO-Revision-Date: 2012-03-01 16:13+0100\n"
+"Last-Translator: Aneta\n"
+"Language-Team: LANGUAGE \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Translated-Using: django-rosetta 0.5.3\n"
+
+#: models.py:11 models.py:33
+msgid "key"
+msgstr "raktas"
+
+#: models.py:11
+msgid "A unique name for this chunk of content"
+msgstr "Unikalus Å¡io turinio gabalo pavadnimas"
+
+#: models.py:12
+msgid "description"
+msgstr "aprašymas"
+
+#: models.py:13
+msgid "content"
+msgstr "turinys"
+
+#: models.py:17
+msgid "chunk"
+msgstr "gabalas"
+
+#: models.py:18
+msgid "chunks"
+msgstr "gabalai"
+
+#: models.py:33
+msgid "A unique name for this attachment"
+msgstr "Unikalus Å¡io priedo pavadnimas"
+
+#: models.py:38
+msgid "attachment"
+msgstr "priedas"
+
+#: models.py:38
+msgid "attachments"
+msgstr "priedai"
diff --git a/chunks/locale/pl/LC_MESSAGES/django.mo b/chunks/locale/pl/LC_MESSAGES/django.mo
new file mode 100644
index 0000000..a26b41c
Binary files /dev/null and b/chunks/locale/pl/LC_MESSAGES/django.mo differ
diff --git a/chunks/locale/pl/LC_MESSAGES/django.po b/chunks/locale/pl/LC_MESSAGES/django.po
new file mode 100644
index 0000000..c562232
--- /dev/null
+++ b/chunks/locale/pl/LC_MESSAGES/django.po
@@ -0,0 +1,54 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-07-19 11:39+0200\n"
+"PO-Revision-Date: 2010-05-19 16:19\n"
+"Last-Translator: \n"
+"Language-Team: LANGUAGE \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Translated-Using: django-rosetta 0.5.3\n"
+
+#: models.py:11 models.py:33
+msgid "key"
+msgstr "klucz"
+
+#: models.py:11
+msgid "A unique name for this chunk of content"
+msgstr "Unikalna nazwa dla tego kawaÅka treÅci"
+
+#: models.py:12
+msgid "description"
+msgstr "opis"
+
+#: models.py:13
+msgid "content"
+msgstr "zawartoÅÄ"
+
+#: models.py:17
+msgid "chunk"
+msgstr "kawaÅek"
+
+#: models.py:18
+msgid "chunks"
+msgstr "kawaÅki"
+
+#: models.py:33
+msgid "A unique name for this attachment"
+msgstr "Unikalna nazwa dla tego zaÅÄ
cznika"
+
+#: models.py:38
+msgid "attachment"
+msgstr "zaÅÄ
cznik"
+
+#: models.py:38
+msgid "attachments"
+msgstr "zaÅÄ
czniki"
diff --git a/chunks/locale/ru/LC_MESSAGES/django.mo b/chunks/locale/ru/LC_MESSAGES/django.mo
new file mode 100644
index 0000000..e1d650c
Binary files /dev/null and b/chunks/locale/ru/LC_MESSAGES/django.mo differ
diff --git a/chunks/locale/ru/LC_MESSAGES/django.po b/chunks/locale/ru/LC_MESSAGES/django.po
new file mode 100644
index 0000000..593521f
--- /dev/null
+++ b/chunks/locale/ru/LC_MESSAGES/django.po
@@ -0,0 +1,53 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-07-19 11:39+0200\n"
+"PO-Revision-Date: 2012-03-04 22:10+0100\n"
+"Last-Translator: xxx \n"
+"Language-Team: LANGUAGE \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: models.py:11 models.py:33
+msgid "key"
+msgstr "клÑÑ"
+
+#: models.py:11
+msgid "A unique name for this chunk of content"
+msgstr "УникалÑное Ð¸Ð¼Ñ Ð´Ð»Ñ ÑÑого ÑÑагменÑа ÑодеÑжаниÑ"
+
+#: models.py:12
+msgid "description"
+msgstr "опиÑание"
+
+#: models.py:13
+msgid "content"
+msgstr "ÑодеÑжание"
+
+#: models.py:17
+msgid "chunk"
+msgstr "ÑÑагменÑ"
+
+#: models.py:18
+msgid "chunks"
+msgstr "ÑÑагменÑÑ"
+
+#: models.py:33
+msgid "A unique name for this attachment"
+msgstr "УникалÑное Ð¸Ð¼Ñ Ð´Ð»Ñ ÑÑого пÑиложениÑ"
+
+#: models.py:38
+msgid "attachment"
+msgstr "пÑиложение"
+
+#: models.py:38
+msgid "attachments"
+msgstr "пÑиложениÑ"
diff --git a/chunks/locale/uk/LC_MESSAGES/django.mo b/chunks/locale/uk/LC_MESSAGES/django.mo
new file mode 100644
index 0000000..7c5388e
Binary files /dev/null and b/chunks/locale/uk/LC_MESSAGES/django.mo differ
diff --git a/chunks/locale/uk/LC_MESSAGES/django.po b/chunks/locale/uk/LC_MESSAGES/django.po
new file mode 100644
index 0000000..edb9b06
--- /dev/null
+++ b/chunks/locale/uk/LC_MESSAGES/django.po
@@ -0,0 +1,53 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-07-19 11:39+0200\n"
+"PO-Revision-Date: 2012-03-04 17:29+0100\n"
+"Last-Translator: xxx \n"
+"Language-Team: LANGUAGE \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: models.py:11 models.py:33
+msgid "key"
+msgstr "клÑÑ"
+
+#: models.py:11
+msgid "A unique name for this chunk of content"
+msgstr "УнÑкалÑна назва Ð´Ð»Ñ ÑÑÑÑ ÑаÑÑини змÑÑÑÑ"
+
+#: models.py:12
+msgid "description"
+msgstr "опиÑ"
+
+#: models.py:13
+msgid "content"
+msgstr "змÑÑÑ"
+
+#: models.py:17
+msgid "chunk"
+msgstr "ÑаÑÑина"
+
+#: models.py:18
+msgid "chunks"
+msgstr "ÑаÑÑини"
+
+#: models.py:33
+msgid "A unique name for this attachment"
+msgstr "УнÑкалÑна назва Ð´Ð»Ñ ÑÑого додаÑкÑ"
+
+#: models.py:38
+msgid "attachment"
+msgstr "додаÑок"
+
+#: models.py:38
+msgid "attachments"
+msgstr "додаÑки"
diff --git a/chunks/models.py b/chunks/models.py
new file mode 100644
index 0000000..ef244eb
--- /dev/null
+++ b/chunks/models.py
@@ -0,0 +1,42 @@
+from django.core.cache import cache
+from django.db import models
+from django.utils.translation import ugettext_lazy as _
+
+
+class Chunk(models.Model):
+ """
+ A Chunk is a piece of content associated with a unique key that can be inserted into
+ any template with the use of a special template tag.
+ """
+ key = models.CharField(_('key'), help_text=_('A unique name for this chunk of content'), primary_key=True, max_length=255)
+ description = models.CharField(_('description'), blank=True, max_length=255)
+ content = models.TextField(_('content'), blank=True)
+
+ class Meta:
+ ordering = ('key',)
+ verbose_name = _('chunk')
+ verbose_name_plural = _('chunks')
+
+ def __unicode__(self):
+ return self.key
+
+ def cache_key(self):
+ return 'chunk_' + self.key
+
+ def save(self, *args, **kwargs):
+ ret = super(Chunk, self).save(*args, **kwargs)
+ cache.delete(self.cache_key())
+ return ret
+
+
+class Attachment(models.Model):
+ key = models.CharField(_('key'), help_text=_('A unique name for this attachment'), primary_key=True, max_length=255)
+ attachment = models.FileField(upload_to='chunks/attachment')
+
+ class Meta:
+ ordering = ('key',)
+ verbose_name, verbose_name_plural = _('attachment'), _('attachments')
+
+ def __unicode__(self):
+ return self.key
+
diff --git a/chunks/templatetags/__init__.py b/chunks/templatetags/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/chunks/templatetags/chunks.py b/chunks/templatetags/chunks.py
new file mode 100644
index 0000000..083c48a
--- /dev/null
+++ b/chunks/templatetags/chunks.py
@@ -0,0 +1,63 @@
+from django import template
+from django.db import models
+from django.core.cache import cache
+
+
+register = template.Library()
+
+Chunk = models.get_model('chunks', 'chunk')
+Attachment = models.get_model('chunks', 'attachment')
+
+
+def do_get_chunk(parser, token):
+ # split_contents() knows not to split quoted strings.
+ tokens = token.split_contents()
+ if len(tokens) < 2 or len(tokens) > 3:
+ raise template.TemplateSyntaxError, "%r tag should have either 2 or 3 arguments" % (tokens[0],)
+ if len(tokens) == 2:
+ tag_name, key = tokens
+ cache_time = 0
+ if len(tokens) == 3:
+ tag_name, key, cache_time = tokens
+ # Check to see if the key is properly double/single quoted
+ if not (key[0] == key[-1] and key[0] in ('"', "'")):
+ raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name
+ # Send key without quotes and caching time
+ return ChunkNode(key[1:-1], cache_time)
+
+
+class ChunkNode(template.Node):
+ def __init__(self, key, cache_time=0):
+ self.key = key
+ self.cache_time = cache_time
+
+ def render(self, context):
+ try:
+ cache_key = 'chunk_' + self.key
+ c = cache.get(cache_key)
+ if c is None:
+ c = Chunk.objects.get(key=self.key)
+ cache.set(cache_key, c, int(self.cache_time))
+ content = c.content
+ except Chunk.DoesNotExist:
+ n = Chunk(key=self.key)
+ n.save()
+ return ''
+ return content
+
+register.tag('chunk', do_get_chunk)
+
+
+def attachment(key, cache_time=0):
+ try:
+ cache_key = 'attachment_' + key
+ c = cache.get(cache_key)
+ if c is None:
+ c = Attachment.objects.get(key=key)
+ cache.set(cache_key, c, int(cache_time))
+ return c.attachment.url
+ except Attachment.DoesNotExist:
+ return ''
+
+register.simple_tag(attachment)
+
diff --git a/edumed/settings.d/30-apps.py b/edumed/settings.d/30-apps.py
index 10c6c12..0ba0726 100644
--- a/edumed/settings.d/30-apps.py
+++ b/edumed/settings.d/30-apps.py
@@ -12,6 +12,7 @@ INSTALLED_APPS = (
'django_cas',
'sponsors',
'haystack',
+ 'chunks',
'django.contrib.auth',
diff --git a/edumed/static/css/main.css b/edumed/static/css/main.css
index 974aa37..4fecbb1 100644
--- a/edumed/static/css/main.css
+++ b/edumed/static/css/main.css
@@ -5,6 +5,8 @@
padding: 1.5em 1.25em;
width: 11.25em;
height: 11.688em; }
+ #main-promobox a {
+ display: block; }
#main-promobox h1 {
color: white;
margin: 0;
diff --git a/edumed/static/css/main.scss b/edumed/static/css/main.scss
index a37de9e..e956c81 100755
--- a/edumed/static/css/main.scss
+++ b/edumed/static/css/main.scss
@@ -10,6 +10,9 @@ $px: .0625em;
width: 220*$px - 2 * 20*$px;
height: 235*$px - 2 * 1.5em;
+ a {
+ display: block;
+ }
h1 {
color: white;
margin: 0;
diff --git a/edumed/templates/home.html b/edumed/templates/home.html
index 7be0b3e..759e72c 100755
--- a/edumed/templates/home.html
+++ b/edumed/templates/home.html
@@ -1,6 +1,7 @@
{% extends "base.html" %}
{% load catalogue_tags %}
{% load course_boxes_toc from curriculum_tags %}
+{% load chunk from chunks %}
{% block full_title %}Edukacja medialna{% endblock %}
@@ -11,16 +12,7 @@
Co nowego?
-TytuÅ informacji pierwszej
-
-Boks na informacje powinien pomieÅciÄ do dwóch krótkich zdaÅ uÅożonych
-w trzech, a możeâ¦
-
-TytuÅ informacji drugiej
-
-Boks na informacje powinien pomieÅciÄ do dwóch krótkich zdaÅ uÅożonych
-w trzech wierszach?
-{#% chunk "promobox" %#}
+{% chunk "promobox" %}
@@ -44,6 +36,10 @@ w trzech wierszach?
diff --git a/edumed/urls.py b/edumed/urls.py
index d988610..303e011 100644
--- a/edumed/urls.py
+++ b/edumed/urls.py
@@ -1,12 +1,10 @@
from django.conf.urls import patterns, include, url
from django.conf import settings
-from django.views.generic import TemplateView
+from .views import HomeView
urlpatterns = patterns('',
- # Examples:
- # url(r'^$', 'edumed.views.home', name='home'),
- url(r'^$', TemplateView.as_view(template_name="home.html"), name="home"),
+ url(r'^$', HomeView.as_view(), name="home"),
url(r'^kompetencje/', include('curriculum.urls')),
url(r'^lekcje/', include('catalogue.urls')),
# url(r'^i/', include('django.contrib.flatpages.urls')),
diff --git a/edumed/views.py b/edumed/views.py
index e69de29..b497716 100755
--- a/edumed/views.py
+++ b/edumed/views.py
@@ -0,0 +1,12 @@
+import os.path
+from django.conf import settings
+from django.views.generic import TemplateView
+
+class HomeView(TemplateView):
+ template_name="home.html"
+
+ def get_context_data(self, **kwargs):
+ context = super(HomeView, self).get_context_data(**kwargs)
+ context['package_url'] = os.path.join(settings.MEDIA_URL, settings.CATALOGUE_PACKAGE)
+ context['package_student_url'] = os.path.join(settings.MEDIA_URL, settings.CATALOGUE_PACKAGE_STUDENT)
+ return context