From 8f15e9e503a0a919094d081a60a9ce21599b3032 Mon Sep 17 00:00:00 2001 From: Jarmil <jarmil.halamicek@seznam.cz> Date: Fri, 27 Nov 2020 11:24:56 +0100 Subject: [PATCH] WIP: PDP: presun jupyterize tagu a prislusnych templates pod PDP --- {uniweb => pdp}/templates/jupyter/basic.tpl | 0 .../templates/jupyter/celltags.tpl | 0 {uniweb => pdp}/templates/jupyter/mathjax.tpl | 0 {uniweb => pdp}/templates/jupyter/my.tpl | 0 {uniweb => pdp}/templatetags/__init__.py | 0 .../templatetags/pdp_filters.py | 2 +- .../regulace_konopi/snippet_sections.html | 2 +- uniweb/migrations/0010_auto_20201127_1123.py | 761 ++++++++++++++++++ uniweb/templates/uniweb/snippet_sections.html | 2 +- 9 files changed, 764 insertions(+), 3 deletions(-) rename {uniweb => pdp}/templates/jupyter/basic.tpl (100%) rename {uniweb => pdp}/templates/jupyter/celltags.tpl (100%) rename {uniweb => pdp}/templates/jupyter/mathjax.tpl (100%) rename {uniweb => pdp}/templates/jupyter/my.tpl (100%) rename {uniweb => pdp}/templatetags/__init__.py (100%) rename uniweb/templatetags/uniweb_filters.py => pdp/templatetags/pdp_filters.py (94%) create mode 100644 uniweb/migrations/0010_auto_20201127_1123.py diff --git a/uniweb/templates/jupyter/basic.tpl b/pdp/templates/jupyter/basic.tpl similarity index 100% rename from uniweb/templates/jupyter/basic.tpl rename to pdp/templates/jupyter/basic.tpl diff --git a/uniweb/templates/jupyter/celltags.tpl b/pdp/templates/jupyter/celltags.tpl similarity index 100% rename from uniweb/templates/jupyter/celltags.tpl rename to pdp/templates/jupyter/celltags.tpl diff --git a/uniweb/templates/jupyter/mathjax.tpl b/pdp/templates/jupyter/mathjax.tpl similarity index 100% rename from uniweb/templates/jupyter/mathjax.tpl rename to pdp/templates/jupyter/mathjax.tpl diff --git a/uniweb/templates/jupyter/my.tpl b/pdp/templates/jupyter/my.tpl similarity index 100% rename from uniweb/templates/jupyter/my.tpl rename to pdp/templates/jupyter/my.tpl diff --git a/uniweb/templatetags/__init__.py b/pdp/templatetags/__init__.py similarity index 100% rename from uniweb/templatetags/__init__.py rename to pdp/templatetags/__init__.py diff --git a/uniweb/templatetags/uniweb_filters.py b/pdp/templatetags/pdp_filters.py similarity index 94% rename from uniweb/templatetags/uniweb_filters.py rename to pdp/templatetags/pdp_filters.py index d36977c1..4884a319 100644 --- a/uniweb/templatetags/uniweb_filters.py +++ b/pdp/templatetags/pdp_filters.py @@ -34,7 +34,7 @@ def jupyterize(value): c.preprocessors = ["TagRemovePreprocessor"] nb_body, _ = nbconvert.TemplateExporter( - config=c, template_file="uniweb/templates/jupyter/my.tpl" + config=c, template_file="pdp/templates/jupyter/my.tpl" ).from_filename(filename) # HACK: fucking ugly. Ale netusim kde se to tam bere, asi nekde v hloubi notebookovskych templates diff --git a/regulace_konopi/templates/regulace_konopi/snippet_sections.html b/regulace_konopi/templates/regulace_konopi/snippet_sections.html index e903f9ff..a7262e91 100644 --- a/regulace_konopi/templates/regulace_konopi/snippet_sections.html +++ b/regulace_konopi/templates/regulace_konopi/snippet_sections.html @@ -1,4 +1,4 @@ -{% load uniweb_filters wagtailcore_tags wagtailimages_tags %} +{% load pdp_filters wagtailcore_tags wagtailimages_tags %} <section class="mb-8 lg:mb-16"> {% for block in page.content %} diff --git a/uniweb/migrations/0010_auto_20201127_1123.py b/uniweb/migrations/0010_auto_20201127_1123.py new file mode 100644 index 00000000..0d1c6747 --- /dev/null +++ b/uniweb/migrations/0010_auto_20201127_1123.py @@ -0,0 +1,761 @@ +# Generated by Django 3.1.2 on 2020-11-27 10:23 + +import wagtail.contrib.table_block.blocks +import wagtail.core.blocks +import wagtail.core.fields +import wagtail.images.blocks +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("uniweb", "0009_auto_20201126_1505"), + ] + + operations = [ + migrations.AlterField( + model_name="uniwebflexiblepage", + name="content", + field=wagtail.core.fields.StreamField( + [ + ( + "title", + wagtail.core.blocks.CharBlock( + group="nadpisy", + icon="title", + label="nadpis", + template="uniweb/blocks/title.html", + ), + ), + ( + "advanced_title", + wagtail.core.blocks.StructBlock( + [ + ( + "align", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("left", "vlevo"), + ("center", "uprostřed"), + ("right", "vpravo"), + ], + label="zarovnání", + ), + ), + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "černá na bílé"), + ("white_on_black", "bílá na černé"), + ("white_on_blue", "bílá na modré"), + ("white_on_cyan", "bílá na tyrkysové"), + ("white_on_violet", "bílá na fialové"), + ], + label="barva", + ), + ), + ( + "title", + wagtail.core.blocks.CharBlock(label="nadpis"), + ), + ] + ), + ), + ( + "picture_title", + wagtail.core.blocks.StructBlock( + [ + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "černá na bílé"), + ("white_on_black", "bílá na černé"), + ("white_on_blue", "bílá na modré"), + ("white_on_cyan", "bílá na tyrkysové"), + ("white_on_violet", "bílá na fialové"), + ], + label="barva", + ), + ), + ( + "title", + wagtail.core.blocks.CharBlock(label="nadpis"), + ), + ( + "picture", + wagtail.images.blocks.ImageChooserBlock( + help_text="rozměr na výšku 75px nebo více (obrázek bude zmenšen na výšku 75px)", + label="obrázek", + ), + ), + ] + ), + ), + ( + "text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + group="texty", + label="text", + template="uniweb/blocks/text.html", + ), + ), + ( + "advanced_text", + wagtail.core.blocks.StructBlock( + [ + ( + "align", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("left", "vlevo"), + ("center", "uprostřed"), + ("right", "vpravo"), + ], + label="zarovnání", + ), + ), + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "černá na bílé"), + ("white_on_black", "bílá na černé"), + ("white_on_blue", "bílá na modré"), + ("white_on_cyan", "bílá na tyrkysové"), + ("white_on_violet", "bílá na fialové"), + ], + label="barva", + ), + ), + ( + "text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="text", + ), + ), + ] + ), + ), + ( + "text_columns", + wagtail.core.blocks.StructBlock( + [ + ( + "left_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="levý sloupec", + ), + ), + ( + "right_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="pravý sloupec", + ), + ), + ] + ), + ), + ( + "advanced_text_columns", + wagtail.core.blocks.StructBlock( + [ + ( + "align", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("left", "vlevo"), + ("center", "uprostřed"), + ("right", "vpravo"), + ], + label="zarovnání", + ), + ), + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "černá na bílé"), + ("white_on_black", "bílá na černé"), + ("white_on_blue", "bílá na modré"), + ("white_on_cyan", "bílá na tyrkysové"), + ("white_on_violet", "bílá na fialové"), + ], + label="barva", + ), + ), + ( + "left_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="levý sloupec", + ), + ), + ( + "right_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="pravý sloupec", + ), + ), + ] + ), + ), + ( + "gallery", + wagtail.core.blocks.ListBlock( + wagtail.images.blocks.ImageChooserBlock(label="obrázek"), + group="ostatní", + icon="image", + label="galerie", + template="uniweb/blocks/gallery.html", + ), + ), + ( + "picture_list", + wagtail.core.blocks.StructBlock( + [ + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "černá na bílé"), + ("white_on_black", "bílá na černé"), + ("white_on_blue", "bílá na modré"), + ("white_on_cyan", "bílá na tyrkysové"), + ("white_on_violet", "bílá na fialové"), + ], + label="barva", + ), + ), + ( + "items", + wagtail.core.blocks.ListBlock( + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="odstavec", + ), + label="odstavce", + ), + ), + ( + "picture", + wagtail.images.blocks.ImageChooserBlock( + help_text="rozměr 25x25px nebo více (obrázek bude zmenšen na 25x25px)", + label="obrázek", + ), + ), + ] + ), + ), + ( + "table", + wagtail.contrib.table_block.blocks.TableBlock( + group="ostatní", + label="tabulka", + template="uniweb/blocks/table.html", + ), + ), + ], + blank=True, + verbose_name="obsah stránky", + ), + ), + migrations.AlterField( + model_name="uniwebhomepage", + name="content", + field=wagtail.core.fields.StreamField( + [ + ( + "title", + wagtail.core.blocks.CharBlock( + group="nadpisy", + icon="title", + label="nadpis", + template="uniweb/blocks/title.html", + ), + ), + ( + "advanced_title", + wagtail.core.blocks.StructBlock( + [ + ( + "align", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("left", "vlevo"), + ("center", "uprostřed"), + ("right", "vpravo"), + ], + label="zarovnání", + ), + ), + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "černá na bílé"), + ("white_on_black", "bílá na černé"), + ("white_on_blue", "bílá na modré"), + ("white_on_cyan", "bílá na tyrkysové"), + ("white_on_violet", "bílá na fialové"), + ], + label="barva", + ), + ), + ( + "title", + wagtail.core.blocks.CharBlock(label="nadpis"), + ), + ] + ), + ), + ( + "picture_title", + wagtail.core.blocks.StructBlock( + [ + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "černá na bílé"), + ("white_on_black", "bílá na černé"), + ("white_on_blue", "bílá na modré"), + ("white_on_cyan", "bílá na tyrkysové"), + ("white_on_violet", "bílá na fialové"), + ], + label="barva", + ), + ), + ( + "title", + wagtail.core.blocks.CharBlock(label="nadpis"), + ), + ( + "picture", + wagtail.images.blocks.ImageChooserBlock( + help_text="rozměr na výšku 75px nebo více (obrázek bude zmenšen na výšku 75px)", + label="obrázek", + ), + ), + ] + ), + ), + ( + "text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + group="texty", + label="text", + template="uniweb/blocks/text.html", + ), + ), + ( + "advanced_text", + wagtail.core.blocks.StructBlock( + [ + ( + "align", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("left", "vlevo"), + ("center", "uprostřed"), + ("right", "vpravo"), + ], + label="zarovnání", + ), + ), + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "černá na bílé"), + ("white_on_black", "bílá na černé"), + ("white_on_blue", "bílá na modré"), + ("white_on_cyan", "bílá na tyrkysové"), + ("white_on_violet", "bílá na fialové"), + ], + label="barva", + ), + ), + ( + "text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="text", + ), + ), + ] + ), + ), + ( + "text_columns", + wagtail.core.blocks.StructBlock( + [ + ( + "left_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="levý sloupec", + ), + ), + ( + "right_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="pravý sloupec", + ), + ), + ] + ), + ), + ( + "advanced_text_columns", + wagtail.core.blocks.StructBlock( + [ + ( + "align", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("left", "vlevo"), + ("center", "uprostřed"), + ("right", "vpravo"), + ], + label="zarovnání", + ), + ), + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "černá na bílé"), + ("white_on_black", "bílá na černé"), + ("white_on_blue", "bílá na modré"), + ("white_on_cyan", "bílá na tyrkysové"), + ("white_on_violet", "bílá na fialové"), + ], + label="barva", + ), + ), + ( + "left_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="levý sloupec", + ), + ), + ( + "right_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="pravý sloupec", + ), + ), + ] + ), + ), + ( + "gallery", + wagtail.core.blocks.ListBlock( + wagtail.images.blocks.ImageChooserBlock(label="obrázek"), + group="ostatní", + icon="image", + label="galerie", + template="uniweb/blocks/gallery.html", + ), + ), + ( + "picture_list", + wagtail.core.blocks.StructBlock( + [ + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "černá na bílé"), + ("white_on_black", "bílá na černé"), + ("white_on_blue", "bílá na modré"), + ("white_on_cyan", "bílá na tyrkysové"), + ("white_on_violet", "bílá na fialové"), + ], + label="barva", + ), + ), + ( + "items", + wagtail.core.blocks.ListBlock( + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="odstavec", + ), + label="odstavce", + ), + ), + ( + "picture", + wagtail.images.blocks.ImageChooserBlock( + help_text="rozměr 25x25px nebo více (obrázek bude zmenšen na 25x25px)", + label="obrázek", + ), + ), + ] + ), + ), + ( + "table", + wagtail.contrib.table_block.blocks.TableBlock( + group="ostatní", + label="tabulka", + template="uniweb/blocks/table.html", + ), + ), + ], + blank=True, + verbose_name="obsah stránky", + ), + ), + ] diff --git a/uniweb/templates/uniweb/snippet_sections.html b/uniweb/templates/uniweb/snippet_sections.html index 20fe13e6..a5c7a628 100644 --- a/uniweb/templates/uniweb/snippet_sections.html +++ b/uniweb/templates/uniweb/snippet_sections.html @@ -1,4 +1,4 @@ -{% load uniweb_filters wagtailcore_tags wagtailimages_tags %} +{% load pdp_filters wagtailcore_tags wagtailimages_tags %} <section class="mb-8 lg:mb-16"> {% for block in page.content %} -- GitLab