2
0

__init__.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. """
  2. Blocks module entry point. Used to cleanly organize blocks into
  3. individual files based on purpose, but provide them all as a
  4. single `blocks` module.
  5. """
  6. from django.utils.translation import gettext_lazy as _
  7. from wagtail import blocks
  8. from .stream_form_blocks import (
  9. CoderedStreamFormCharFieldBlock,
  10. CoderedStreamFormCheckboxesFieldBlock,
  11. CoderedStreamFormCheckboxFieldBlock,
  12. CoderedStreamFormDateFieldBlock,
  13. CoderedStreamFormDateTimeFieldBlock,
  14. CoderedStreamFormDropdownFieldBlock,
  15. CoderedStreamFormFileFieldBlock,
  16. CoderedStreamFormImageFieldBlock,
  17. CoderedStreamFormNumberFieldBlock,
  18. CoderedStreamFormRadioButtonsFieldBlock,
  19. CoderedStreamFormStepBlock,
  20. CoderedStreamFormTextFieldBlock,
  21. CoderedStreamFormTimeFieldBlock
  22. )
  23. from .html_blocks import (
  24. ButtonBlock,
  25. EmbedGoogleMapBlock,
  26. ImageBlock,
  27. ImageLinkBlock,
  28. DownloadBlock,
  29. EmbedVideoBlock,
  30. PageListBlock,
  31. PagePreviewBlock,
  32. QuoteBlock,
  33. RichTextBlock,
  34. TableBlock
  35. )
  36. from .content_blocks import ( # noqa
  37. CardBlock,
  38. CarouselBlock,
  39. ContentWallBlock,
  40. ImageGalleryBlock,
  41. ModalBlock,
  42. NavDocumentLinkWithSubLinkBlock,
  43. NavExternalLinkWithSubLinkBlock,
  44. NavPageLinkWithSubLinkBlock,
  45. PriceListBlock,
  46. ReusableContentBlock
  47. )
  48. from .layout_blocks import (
  49. CardGridBlock,
  50. GridBlock,
  51. HeroBlock
  52. )
  53. from .base_blocks import ( # noqa
  54. BaseBlock,
  55. BaseLayoutBlock,
  56. BaseLinkBlock,
  57. ClassifierTermChooserBlock,
  58. CoderedAdvColumnSettings,
  59. CoderedAdvSettings,
  60. CoderedAdvTrackingSettings,
  61. CollectionChooserBlock,
  62. )
  63. # Collections of blocks commonly used together.
  64. HTML_STREAMBLOCKS = [
  65. ('text', RichTextBlock(icon='cr-font')),
  66. ('button', ButtonBlock()),
  67. ('image', ImageBlock()),
  68. ('image_link', ImageLinkBlock()),
  69. ('html', blocks.RawHTMLBlock(icon='code', form_classname='monospace', label=_('HTML'), )),
  70. ('download', DownloadBlock()),
  71. ('embed_video', EmbedVideoBlock()),
  72. ('quote', QuoteBlock()),
  73. ('table', TableBlock()),
  74. ('google_map', EmbedGoogleMapBlock()),
  75. ('page_list', PageListBlock()),
  76. ('page_preview', PagePreviewBlock()),
  77. ]
  78. CONTENT_STREAMBLOCKS = HTML_STREAMBLOCKS + [
  79. ('card', CardBlock()),
  80. ('carousel', CarouselBlock()),
  81. ('image_gallery', ImageGalleryBlock()),
  82. ('modal', ModalBlock(HTML_STREAMBLOCKS)),
  83. ('pricelist', PriceListBlock()),
  84. ('reusable_content', ReusableContentBlock()),
  85. ]
  86. NAVIGATION_STREAMBLOCKS = [
  87. ('page_link', NavPageLinkWithSubLinkBlock()),
  88. ('external_link', NavExternalLinkWithSubLinkBlock()),
  89. ('document_link', NavDocumentLinkWithSubLinkBlock()),
  90. ]
  91. BASIC_LAYOUT_STREAMBLOCKS = [
  92. ('row', GridBlock(HTML_STREAMBLOCKS)),
  93. ('html', blocks.RawHTMLBlock(icon='code', form_classname='monospace', label=_('HTML'))),
  94. ]
  95. LAYOUT_STREAMBLOCKS = [
  96. ('hero', HeroBlock([
  97. ('row', GridBlock(CONTENT_STREAMBLOCKS)),
  98. ('cardgrid', CardGridBlock([
  99. ('card', CardBlock()),
  100. ])),
  101. ('html', blocks.RawHTMLBlock(icon='code', form_classname='monospace', label=_('HTML'))),
  102. ])),
  103. ('row', GridBlock(CONTENT_STREAMBLOCKS)),
  104. ('cardgrid', CardGridBlock([
  105. ('card', CardBlock()),
  106. ])),
  107. ('html', blocks.RawHTMLBlock(icon='code', form_classname='monospace', label=_('HTML'))),
  108. ]
  109. STREAMFORM_FIELDBLOCKS = [
  110. ('sf_singleline', CoderedStreamFormCharFieldBlock(group=_('Fields'))),
  111. ('sf_multiline', CoderedStreamFormTextFieldBlock(group=_('Fields'))),
  112. ('sf_number', CoderedStreamFormNumberFieldBlock(group=_('Fields'))),
  113. ('sf_checkboxes', CoderedStreamFormCheckboxesFieldBlock(group=_('Fields'))),
  114. ('sf_radios', CoderedStreamFormRadioButtonsFieldBlock(group=_('Fields'))),
  115. ('sf_dropdown', CoderedStreamFormDropdownFieldBlock(group=_('Fields'))),
  116. ('sf_checkbox', CoderedStreamFormCheckboxFieldBlock(group=_('Fields'))),
  117. ('sf_date', CoderedStreamFormDateFieldBlock(group=_('Fields'))),
  118. ('sf_time', CoderedStreamFormTimeFieldBlock(group=_('Fields'))),
  119. ('sf_datetime', CoderedStreamFormDateTimeFieldBlock(group=_('Fields'))),
  120. ('sf_image', CoderedStreamFormImageFieldBlock(group=_('Fields'))),
  121. ('sf_file', CoderedStreamFormFileFieldBlock(group=_('Fields'))),
  122. ]
  123. STREAMFORM_BLOCKS = [
  124. ('step', CoderedStreamFormStepBlock(STREAMFORM_FIELDBLOCKS + HTML_STREAMBLOCKS)),
  125. ]