Skip to main content

HSLayers-NG integrated into Wagtail CMS with Codered

Project description

HSLayers-NG map widget for Wagtail CodeRed CMS

Note: Has npm dependency on HSLayers-NG that gets automatically installed into static files. python manage.py collectstatic must be executed for the module to correctly locate the HSLayers bundles.

Instalation

  1. Copy whole codered-hslayers to the Wagtail root to a new folder named 'hslayers'

  2. Add 'hslayers' to the INSTALLED_APPS list in the settings/base.py

INSTALLED_APPS = [
    # This project
    'website',
    
    # CodeRed CMS
    'coderedcms',
    'bootstrap4',
    ...
    
    'hslayers'
]
  1. You have three options now:

    • Keep existing CodeRed 'Web Page', 'Article Landing Page' and 'Article Page' untouched and add a new page type 'Web Page Extended', 'Article Landing Page Extended' and 'Article Page Extended' with new widgets of hslayers

      • Run hslayers migrations
      $ python3 manage.py makemigrations hslayers
      
      • Go to point 4
    • Modify existing CodeRed 'Web Page' and/or 'Article Landing Page' and/or 'Article Page' type and add hslayers widgets to it

      • Edit Wagtail's models.py file

        • Add those imports at the top
        from coderedcms.blocks import (
          CONTENT_STREAMBLOCKS,
          LAYOUT_STREAMBLOCKS,
          GridBlock,
          HeroBlock,
          CardGridBlock,
          CardBlock
        )
        
        from django.utils.translation import gettext_lazy as _
        from hslayers import blocks
        from wagtail.core.fields import StreamField
        from wagtail.core.blocks import RawHTMLBlock
        
        • Replace code of WebPage and/or ArticleIndexPage and/or ArticlePage function with the WebPage2 and/or ArticleIndexPageExtended and/or ArticlePageExtended function code from the hslayers/models.py file
      • Delete WebPage2 and/or ArticleIndexPageExtended and/or ArticlePageExtended method in the hslayers/models.py file

      • In case of ArticleIndexPage and ArticlePage overriding, don't forget to modify subpage_types and parent_page_types to your needs. In this particular case delete 'hslayers.ArticlePageExtended' and 'hslayers.ArticleIndexPageExtended' from the code

      parent_page_types = ['website.ArticleIndexPage', 'hslayers.ArticleIndexPageExtended']
      ...
      subpage_types = ['website.ArticlePage', 'hslayers.ArticlePageExtended']
      
      • Go to point 4
    • Use hslayers widgets in any other Wagtail models

      • Take the code of WebPage2 and/or ArticleIndexPageExtended the hslayers/models.py file and modify it as you wish or use the widgets anywhere else
      • Go to point 4
  2. Update Wagtail migrations

$ python3 manage.py makemigrations
$ python3 manage.py migrate
$ python3 manage.py collectstatic
  1. Restart Wagtail

  2. New HSLayers blocks are added to the CMS

    • HSLayers map
    • Aligned Paragraph
    • Header

Development

Update semantic version of the package

Run test update without commiting

$ bumpver update --patch(--minor|--major) --dry

Run update and commit the changes to the repo

$ bumpver update --patch(--minor|--major)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crx_hslayers-2.1.0.tar.gz (11.5 MB view details)

Uploaded Source

Built Distribution

crx_hslayers-2.1.0-py3-none-any.whl (11.7 MB view details)

Uploaded Python 3

File details

Details for the file crx_hslayers-2.1.0.tar.gz.

File metadata

  • Download URL: crx_hslayers-2.1.0.tar.gz
  • Upload date:
  • Size: 11.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for crx_hslayers-2.1.0.tar.gz
Algorithm Hash digest
SHA256 a3b3e20583e5bbe3b3b66bf721e4be83eb98ba7b578396d304606e895c09ebf4
MD5 2583a9390f2813b1652e458f8d25ce08
BLAKE2b-256 5645449b28b40be4c56362308dfcd19745e4d301fd28590603fc66f5b34a6d0f

See more details on using hashes here.

File details

Details for the file crx_hslayers-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: crx_hslayers-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for crx_hslayers-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66dacc5f2e9d9afd015c9568f2263ae2dddd720f12632760a1df7ae1c347918f
MD5 1d7dd6a78dc8d8f66393545bb86f47b3
BLAKE2b-256 f994f70b9f3780894b275f2b28293365e9b42e4d92a3475fc7c1f1137053bbc9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page