This is an automated email from the ASF dual-hosted git repository. machristie pushed a commit to branch AIRAVATA-3698--Add-support-for-Python-3.11 in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit 47f09aecae5a42c5d20921b6b65d712734bc019a Author: Marcus Christie <[email protected]> AuthorDate: Wed Jun 21 14:43:20 2023 -0400 AIRAVATA-3698 Upgrade to Wagtail 5.0, remove wagtailfontawesome --- django_airavata/settings.py | 1 - django_airavata/wagtailapps/base/blocks.py | 36 ++++++------- .../base/migrations/0027_auto_20230621_1622.py | 63 ++++++++++++++++++++++ .../wagtailapps_base/icons/align-right.svg | 5 ++ .../wagtailapps_base/icons/arrows-left-right.svg | 5 ++ .../wagtailapps_base/icons/building-columns.svg | 5 ++ .../base/templates/wagtailapps_base/icons/film.svg | 5 ++ .../templates/wagtailapps_base/icons/icons.svg | 5 ++ .../templates/wagtailapps_base/icons/square.svg | 5 ++ .../wagtailapps_base/icons/window-minimize.svg | 4 ++ django_airavata/wagtailapps/base/wagtail_hooks.py | 11 ++++ requirements.txt | 5 +- setup.py | 1 - 13 files changed, 128 insertions(+), 23 deletions(-) diff --git a/django_airavata/settings.py b/django_airavata/settings.py index 977e6d0f..8b52d95e 100644 --- a/django_airavata/settings.py +++ b/django_airavata/settings.py @@ -67,7 +67,6 @@ INSTALLED_APPS = [ # wagtail third party dependencies 'modelcluster', 'taggit', - 'wagtailfontawesome', 'wagtail_draftail_anchors', 'wagtailcodeblock', diff --git a/django_airavata/wagtailapps/base/blocks.py b/django_airavata/wagtailapps/base/blocks.py index f3cad89c..d2c6e0fb 100644 --- a/django_airavata/wagtailapps/base/blocks.py +++ b/django_airavata/wagtailapps/base/blocks.py @@ -61,7 +61,7 @@ class FontAwesomeIcon(StructBlock): "separated by space and styling the class in css") class Meta: - icon = 'fa-flag' + icon = 'icons' template = "blocks/font_awesome_icon_block.html" @@ -77,7 +77,7 @@ class ParagraphBlock(StructBlock): body = RichTextBlock() class Meta: - icon = "fa-paragraph" + icon = "pilcrow" template = "blocks/paragraph_block.html" help_text = "Create a free form paragraph" @@ -94,7 +94,7 @@ class IuFooter(StructBlock): footer_links = RichTextBlock() class Meta: - icon = "fa-university" + icon = "building-columns" template = "blocks/iu_footer.html" help_text = "Create an IU Footer" @@ -134,7 +134,7 @@ class PlaceholderBlock(StructBlock): "separated by space and styling the class in css") class Meta: - icon = "fa-map-marker" + icon = "arrows-left-right" template = "blocks/placeholder_block.html" @@ -150,7 +150,7 @@ class CustomEmbedBlock(StructBlock): "separated by space and styling the class in css") class Meta: - icon = "fa-link" + icon = "link" template = "blocks/embed_block.html" help_text = ("Insert a youtube URL e.g " "https://www.youtube.com/watch?v=SGJFWirQ3ks") @@ -164,7 +164,7 @@ class CssCommentBlock(StructBlock): required=True, help_text="Write some comment to mark the css") class Meta: - icon = "fa-comment" + icon = "comment" template = "blocks/css_comment.html" help_text = "Css Comment" @@ -187,7 +187,7 @@ class HorizontalRule(StructBlock): "separated by space and styling the class in css") class Meta: - icon = "fa-long-arrow-right" + icon = "horizontalrule" template = "blocks/hrule.html" help_text = "Horizontal Rule" @@ -221,7 +221,7 @@ class BootstrapJumbotron(StructBlock): "separated by space and styling the class in css") class Meta: - icon = "fa-indent" + icon = "form" template = "blocks/bootstrap/jumbotron.html" help_text = "Create a bootstrap jumbotron" @@ -251,7 +251,7 @@ class BootstrapButton(StructBlock): "separated by space and styling the class in css") class Meta: - icon = "fa-bold" + icon = "bold" template = "blocks/bootstrap/button.html" help_text = "Create a bootstrap button" @@ -320,7 +320,7 @@ class BootstrapAlert(StructBlock): "separated by space and styling the class in css") class Meta: - icon = "fa-bell" + icon = "warning" template = "blocks/bootstrap/alert.html" help_text = "Create a bootstrap alert" @@ -371,7 +371,7 @@ class BootstrapCard(StructBlock): "separated by space and styling the class in css") class Meta: - icon = "fa-id-card" + icon = "square" template = "blocks/bootstrap/card.html" help_text = "Create a bootstrap card" @@ -416,7 +416,7 @@ class BootstrapCarousel(StructBlock): "separated by space and styling the class in css") class Meta: - icon = "fa-film" + icon = "film" template = "blocks/bootstrap/carousel.html" help_text = ("Create a bootstrap carousel. Fill the images in order " "to get optimized display.") @@ -444,7 +444,7 @@ class BootstrapWell(StructBlock): "separated by space and styling the class in css") class Meta: - icon = "fa-window-minimize" + icon = "window-minimize" template = "blocks/bootstrap/well.html" @@ -475,7 +475,7 @@ class BootstrapMediaObject(StructBlock): "separated by space and styling the class in css") class Meta: - icon = "fa-align-right" + icon = "align-right" template = "blocks/bootstrap/media.html" @@ -563,14 +563,14 @@ class FullWidthContainer(ContainerBlock): container_class = "container-fluid" class Meta: - icon = "fa-arrows-h" + icon = "arrows-h" class MaxWidthContainer(ContainerBlock): container_class = "container" class Meta: - icon = "fa-square-o" + icon = "square-o" class ContainerChoiceBlock(StreamBlock): @@ -602,7 +602,7 @@ class NavItem(StructBlock): ], required=False, help_text="The main menu is at the top of the dashboard when a user first logs in. Horizontal alignment does not apply when added to main menu.") class Meta: - icon = "fa-minus" + icon = "minus" template = "blocks/bootstrap/nav-item.html" @@ -663,5 +663,5 @@ class Nav(StructBlock): ]) class Meta: - icon = "fa-bars" + icon = "bars" template = "blocks/bootstrap/nav.html" diff --git a/django_airavata/wagtailapps/base/migrations/0027_auto_20230621_1622.py b/django_airavata/wagtailapps/base/migrations/0027_auto_20230621_1622.py new file mode 100644 index 00000000..94165923 --- /dev/null +++ b/django_airavata/wagtailapps/base/migrations/0027_auto_20230621_1622.py @@ -0,0 +1,63 @@ +# Generated by Django 3.2.18 on 2023-06-21 16:22 + +from django.db import migrations +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('django_airavata_wagtail_base', '0026_auto_20210923_2212'), + ] + + operations = [ + migrations.AlterField( + model_name='customcss', + name='css', + field=wagtail.fields.StreamField([('css_block', wagtail.blocks.RawHTMLBlock(help_text='Write Css Here', required=True)), ('css_comment', wagtail.blocks.StructBlock([('message', wagtail.blocks.TextBlock(help_text='Write some comment to mark the css', required=True))]))], blank=True, default='', help_text='Write custom css and give comments as necessary', null=True, use_json_field=True, verbose_name='CSS block'), + ), + migrations.AlterField( + model_name='cybergatewayhomepage', + name='contact', + field=wagtail.fields.StreamField([('paragraph_block', wagtail.blocks.StructBlock([('custom_class', wagtail.blocks.TextBlock(blank=True, help_text='control this element by giving unique class names separated by space and styling the class in css', required=False)), ('body', wagtail.blocks.RichTextBlock())])), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.blocks.CharBlock(required=False)), ('wi [...] + ), + migrations.AlterField( + model_name='cybergatewayhomepage', + name='footer', + field=wagtail.fields.StreamField([('paragraph_block', wagtail.blocks.StructBlock([('custom_class', wagtail.blocks.TextBlock(blank=True, help_text='control this element by giving unique class names separated by space and styling the class in css', required=False)), ('body', wagtail.blocks.RichTextBlock())])), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.blocks.CharBlock(required=False)), ('wi [...] + ), + migrations.AlterField( + model_name='footertext', + name='footer', + field=wagtail.fields.StreamField([('paragraph_block', wagtail.blocks.StructBlock([('custom_class', wagtail.blocks.TextBlock(blank=True, help_text='control this element by giving unique class names separated by space and styling the class in css', required=False)), ('body', wagtail.blocks.RichTextBlock())])), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.blocks.CharBlock(required=False)), ('wi [...] + ), + migrations.AlterField( + model_name='homepage', + name='body', + field=wagtail.fields.StreamField([('paragraph_block', wagtail.blocks.StructBlock([('custom_class', wagtail.blocks.TextBlock(blank=True, help_text='control this element by giving unique class names separated by space and styling the class in css', required=False)), ('body', wagtail.blocks.RichTextBlock())])), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.blocks.CharBlock(required=False)), ('wi [...] + ), + migrations.AlterField( + model_name='navextra', + name='nav', + field=wagtail.fields.StreamField([('nav', wagtail.blocks.StructBlock([('custom_class', wagtail.blocks.CharBlock(required=False)), ('nav_items', wagtail.blocks.StreamBlock([('nav_item', wagtail.blocks.StructBlock([('link', wagtail.blocks.CharBlock(help_text='Full URL or relative path (e.g., /auth/login)')), ('link_text', wagtail.blocks.CharBlock(required=False)), ('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('icon_class', wagtail.blocks.CharBlock(help_te [...] + ), + migrations.AlterField( + model_name='rowblankpagerelation', + name='body', + field=wagtail.fields.StreamField([('paragraph_block', wagtail.blocks.StructBlock([('custom_class', wagtail.blocks.TextBlock(blank=True, help_text='control this element by giving unique class names separated by space and styling the class in css', required=False)), ('body', wagtail.blocks.RichTextBlock())])), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.blocks.CharBlock(required=False)), ('wi [...] + ), + migrations.AlterField( + model_name='rowblankpagerelation', + name='container', + field=wagtail.fields.StreamField([('full_width_container', wagtail.blocks.StructBlock([('inline_styles', wagtail.blocks.TextBlock(blank=True, help_text='Apply inline CSS styles to container wrapper.', required=False)), ('custom_classes', wagtail.blocks.CharBlock(help_text='Apply custom CSS classes to container wrapper. You can define CSS classes in a Custom CSS snippet.', required=False)), ('background_image', wagtail.images.blocks.ImageChooserBlock(help_text='Apply backgroun [...] + ), + migrations.AlterField( + model_name='rowcybergatewayhomepagerelation', + name='body', + field=wagtail.fields.StreamField([('paragraph_block', wagtail.blocks.StructBlock([('custom_class', wagtail.blocks.TextBlock(blank=True, help_text='control this element by giving unique class names separated by space and styling the class in css', required=False)), ('body', wagtail.blocks.RichTextBlock())])), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.blocks.CharBlock(required=False)), ('wi [...] + ), + ] diff --git a/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/align-right.svg b/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/align-right.svg new file mode 100644 index 00000000..15bf5e35 --- /dev/null +++ b/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/align-right.svg @@ -0,0 +1,5 @@ +<svg id="icon-align-right" xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"> + <!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --> + <path + d="M448 64c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z" /> +</svg> diff --git a/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/arrows-left-right.svg b/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/arrows-left-right.svg new file mode 100644 index 00000000..9dd85e69 --- /dev/null +++ b/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/arrows-left-right.svg @@ -0,0 +1,5 @@ +<svg id="icon-arrows-left-right" xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"> + <!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --> + <path + d="M406.6 374.6l96-96c12.5-12.5 12.5-32.8 0-45.3l-96-96c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 224l-293.5 0 41.4-41.4c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-96 96c-12.5 12.5-12.5 32.8 0 45.3l96 96c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 288l293.5 0-41.4 41.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z" /> +</svg> diff --git a/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/building-columns.svg b/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/building-columns.svg new file mode 100644 index 00000000..a59f366f --- /dev/null +++ b/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/building-columns.svg @@ -0,0 +1,5 @@ +<svg id="icon-building-columns" xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"> + <!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --> + <path + d="M243.4 2.6l-224 96c-14 6-21.8 21-18.7 35.8S16.8 160 32 160v8c0 13.3 10.7 24 24 24H456c13.3 0 24-10.7 24-24v-8c15.2 0 28.3-10.7 31.3-25.6s-4.8-29.9-18.7-35.8l-224-96c-8-3.4-17.2-3.4-25.2 0zM128 224H64V420.3c-.6 .3-1.2 .7-1.8 1.1l-48 32c-11.7 7.8-17 22.4-12.9 35.9S17.9 512 32 512H480c14.1 0 26.5-9.2 30.6-22.7s-1.1-28.1-12.9-35.9l-48-32c-.6-.4-1.2-.7-1.8-1.1V224H384V416H344V224H280V416H232V224H168V416H128V224zM256 64a32 32 0 1 1 0 64 32 32 0 1 1 0-64z" /> +</svg> diff --git a/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/film.svg b/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/film.svg new file mode 100644 index 00000000..1a53494d --- /dev/null +++ b/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/film.svg @@ -0,0 +1,5 @@ +<svg id="icon-film" xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"> + <!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --> + <path + d="M0 96C0 60.7 28.7 32 64 32H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM48 368v32c0 8.8 7.2 16 16 16H96c8.8 0 16-7.2 16-16V368c0-8.8-7.2-16-16-16H64c-8.8 0-16 7.2-16 16zm368-16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V368c0-8.8-7.2-16-16-16H416zM48 240v32c0 8.8 7.2 16 16 16H96c8.8 0 16-7.2 16-16V240c0-8.8-7.2-16-16-16H64c-8.8 0-16 7.2-16 16zm368-16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V240c0-8.8 [...] +</svg> diff --git a/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/icons.svg b/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/icons.svg new file mode 100644 index 00000000..7cb413bf --- /dev/null +++ b/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/icons.svg @@ -0,0 +1,5 @@ +<svg id="icon-icons" xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"> + <!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --> + <path + d="M500.3 7.3C507.7 13.3 512 22.4 512 32V176c0 26.5-28.7 48-64 48s-64-21.5-64-48s28.7-48 64-48V71L352 90.2V208c0 26.5-28.7 48-64 48s-64-21.5-64-48s28.7-48 64-48V64c0-15.3 10.8-28.4 25.7-31.4l160-32c9.4-1.9 19.1 .6 26.6 6.6zM74.7 304l11.8-17.8c5.9-8.9 15.9-14.2 26.6-14.2h61.7c10.7 0 20.7 5.3 26.6 14.2L213.3 304H240c26.5 0 48 21.5 48 48V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V352c0-26.5 21.5-48 48-48H74.7zM192 408a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM478.7 278.3L440.3 368H [...] +</svg> diff --git a/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/square.svg b/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/square.svg new file mode 100644 index 00000000..39e348fc --- /dev/null +++ b/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/square.svg @@ -0,0 +1,5 @@ +<svg id="icon-square" xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"> + <!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --> + <path + d="M384 80c8.8 0 16 7.2 16 16V416c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V96c0-8.8 7.2-16 16-16H384zM64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64z" /> +</svg> diff --git a/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/window-minimize.svg b/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/window-minimize.svg new file mode 100644 index 00000000..80e1bc27 --- /dev/null +++ b/django_airavata/wagtailapps/base/templates/wagtailapps_base/icons/window-minimize.svg @@ -0,0 +1,4 @@ +<svg id="icon-window-minimize" xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"> + <!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --> + <path d="M32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H32z" /> +</svg> diff --git a/django_airavata/wagtailapps/base/wagtail_hooks.py b/django_airavata/wagtailapps/base/wagtail_hooks.py index 50fea371..bba00646 100644 --- a/django_airavata/wagtailapps/base/wagtail_hooks.py +++ b/django_airavata/wagtailapps/base/wagtail_hooks.py @@ -1,4 +1,5 @@ import logging +from pathlib import Path from django.shortcuts import redirect from wagtail import hooks @@ -8,6 +9,9 @@ from wagtail.admin.rich_text.converters.html_to_contentstate import ( logger = logging.getLogger(__name__) +BASE_DIR = Path(__file__).resolve().parent +TEMPLATES_DIR = BASE_DIR / "templates" + @hooks.register('register_rich_text_features') def register_custom_style_feature(features): @@ -51,3 +55,10 @@ def direct_serve_document(document, request): except Exception as e: logger.warning("direct_serve_document error: ", exc_info=e) return None + + [email protected]('register_icons') +def register_icons(icons): + svg_files = TEMPLATES_DIR.glob("**/*.svg") + svg_paths = [str(svg_file.relative_to(TEMPLATES_DIR)) for svg_file in svg_files] + return icons + svg_paths diff --git a/requirements.txt b/requirements.txt index 718d2f02..e2b0e73d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,9 +9,8 @@ django-webpack-loader==0.6.0 logging-formatter-anticrlf==1.2 zipstream-new==1.1.8 -wagtail>=4.2,<4.3 -wagtailfontawesome==1.2.1 -wagtail-draftail-anchors==0.2.0 +wagtail==5.0.2 +wagtail-draftail-anchors==0.5.0 wagtailcodeblock==1.29.0.0 jupyter==1.0.0 diff --git a/setup.py b/setup.py index c2447dee..0b7844c1 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,6 @@ setup( 'thrift', 'thrift_connector', 'wagtail', - 'wagtailfontawesome', 'jupyter', 'papermill', "airavata-django-portal-sdk",
