Пример #1
0
class FeaturedContent(blocks.StructBlock):
    heading = blocks.CharBlock()
    body = blocks.RichTextBlock()

    post = blocks.PageChooserBlock(required=False)
    show_post_link = blocks.BooleanBlock(required=False,
                                         label="Render post link?")
    post_link_text = blocks.CharBlock(required=False)

    image = atoms.ImageBasic(required=False)

    links = blocks.ListBlock(atoms.Hyperlink(required=False),
                             label='Additional Links')

    video = VideoPlayer(required=False)

    class Meta:
        template = '_includes/organisms/featured-content.html'
        icon = 'doc-full-inverse'
        label = 'Featured Content'
        classname = 'block__flush'
        value_class = FeaturedContentStructValue

    class Media:
        js = ['featured-content-module.js']
Пример #2
0
class ContentImage(blocks.StructBlock):
    image = atoms.ImageBasic()
    image_width = blocks.ChoiceBlock(
        choices=[('full', 'full'),
                 (470, '470px'),
                 (270, '270px'),
                 (170, '170px')],
        default='full',)
    image_position = blocks.ChoiceBlock(
        choices=[('right', 'right'),
                 ('left', 'left')],
        default='right',
        help_text='Does not apply if the image is full-width',
    )
    text = blocks.RichTextBlock(required=False, label='Caption')
    is_bottom_rule = blocks.BooleanBlock(
        required=False,
        default=True,
        label='Has bottom rule line',
        help_text='Check to add a horizontal rule line to bottom of inset.'
    )

    class Meta:
        icon = 'image'
        template = '_includes/molecules/content-image.html'
        label = 'Image'
Пример #3
0
class SnippetList(blocks.StructBlock):
    heading = blocks.CharBlock(required=False)
    body = blocks.RichTextBlock(required=False)
    has_top_rule_line = blocks.BooleanBlock(
        default=False,
        required=False,
        help_text=('Check this to add a horizontal rule line to top of '
                   'snippet list.')
    )
    image = atoms.ImageBasic(required=False)
    actions_column_width = blocks.ChoiceBlock(
        label='Width of "Actions" column',
        required=False,
        help_text='Choose the width in % that you wish to set '
                  'the Actions column in a snippet list.',
        choices=[
            ('70', '70%'),
            ('66', '66%'),
            ('60', '60%'),
            ('50', '50%'),
            ('40', '40%'),
            ('33', '33%'),
            ('30', '30%'),
        ],
    )

    snippet_type = blocks.ChoiceBlock(
        choices=get_snippet_type_choices,
        required=True
    )
    show_thumbnails = blocks.BooleanBlock(
        required=False,
        help_text='If selected, each snippet in the list will include a 150px-'
                  'wide image from the snippet\'s thumbnail field.'
    )
    actions = blocks.ListBlock(blocks.StructBlock([
        ('link_label', blocks.CharBlock(
            help_text='E.g., "Download" or "Order free prints"'
        )),
        ('snippet_field', blocks.ChoiceBlock(
            choices=get_snippet_field_choices,
            help_text='Corresponds to the available fields for the selected '
                      'snippet type.'
        )),
    ]))

    tags = blocks.ListBlock(
        blocks.CharBlock(label='Tag'),
        help_text='Enter tag names to filter the snippets. For a snippet to '
                  'match and be output in the list, it must have been tagged '
                  'with all of the tag names listed here. The tag names '
                  'are case-insensitive.'
    )

    class Meta:
        icon = 'table'
        template = '_includes/organisms/snippet-list.html'
Пример #4
0
class ImageText2575(blocks.StructBlock):
    heading = blocks.CharBlock(required=False)
    body = blocks.RichTextBlock(required=False)
    image = atoms.ImageBasic()
    links = blocks.ListBlock(atoms.Hyperlink(), required=False)
    has_rule = blocks.BooleanBlock(required=False)

    class Meta:
        icon = 'image'
        template = '_includes/molecules/image-text-25-75.html'
Пример #5
0
class FeaturedMenuContent(blocks.StructBlock):
    draft = blocks.BooleanBlock(
        required=False,
        default=False,
        label='Mark block as draft',
        help_text='If checked, this block will only show '
        'on our sharing site (Content).')
    link = Link(required=False, label="H4 link")
    body = blocks.RichTextBlock(required=False)
    image = atoms.ImageBasic(required=False)
Пример #6
0
class ResourceList(blocks.StructBlock):
    heading = blocks.CharBlock(required=False)
    body = blocks.RichTextBlock(required=False)
    has_top_rule_line = blocks.BooleanBlock(
        default=False,
        required=False,
        help_text='Check this to add a horizontal rule line above this block.'
    )
    image = atoms.ImageBasic(required=False)
    actions_column_width = blocks.ChoiceBlock(
        label='Width of "Actions" column',
        required=False,
        help_text='Choose the width in % that you wish to set '
                  'the Actions column in a resource list.',
        choices=[
            ('70', '70%'),
            ('66', '66%'),
            ('60', '60%'),
            ('50', '50%'),
            ('40', '40%'),
            ('33', '33%'),
            ('30', '30%'),
        ],
    )
    show_thumbnails = blocks.BooleanBlock(
        required=False,
        help_text='If selected, each resource in the list will include a '
                  '150px-wide image from the resource\'s thumbnail field.'
    )
    actions = blocks.ListBlock(blocks.StructBlock([
        ('link_label', blocks.CharBlock(
            help_text='E.g., "Download" or "Order free prints"'
        )),
        ('snippet_field', blocks.ChoiceBlock(
            choices=[
                ('related_file', 'Related file'),
                ('alternate_file', 'Alternate file'),
                ('link', 'Link'),
                ('alternate_link', 'Alternate link'),
            ],
            help_text='The field that the action link should point to'
        )),
    ]))
    tags = blocks.ListBlock(
        blocks.CharBlock(label='Tag'),
        help_text='Enter tag names to filter the snippets. For a snippet to '
                  'match and be output in the list, it must have been tagged '
                  'with all of the tag names listed here. The tag names '
                  'are case-insensitive.'
    )

    class Meta:
        label = 'Resource List'
        icon = 'table'
        template = '_includes/organisms/resource-list.html'
Пример #7
0
class InfoUnit(blocks.StructBlock):
    image = atoms.ImageBasic(required=False, )

    heading = HeadingBlock(required=False, default={'level': 'h3'})

    body = blocks.RichTextBlock(blank=True, required=False)
    links = blocks.ListBlock(atoms.Hyperlink(), required=False)

    class Meta:
        icon = 'image'
        template = '_includes/molecules/info-unit.html'
Пример #8
0
class ImageText5050(blocks.StructBlock):
    heading = blocks.CharBlock(required=False)
    body = blocks.RichTextBlock(blank=True, required=False)
    image = atoms.ImageBasic()
    is_widescreen = blocks.BooleanBlock(required=False, label="Use 16:9 image")
    is_button = blocks.BooleanBlock(required=False,
                                    label="Show links as button")
    links = blocks.ListBlock(atoms.Hyperlink(), required=False)

    class Meta:
        icon = 'image'
        template = '_includes/molecules/image-text-50-50.html'
Пример #9
0
class ImageInset(blocks.StructBlock):
    image = atoms.ImageBasic()
    image_position = blocks.ChoiceBlock(choices=[('right', 'right'),
                                                 ('left', 'left')],
                                        default='right')
    is_image_decorative = blocks.BooleanBlock(required=False,
                                              label='Image decorative')
    image_width = blocks.ChoiceBlock(choices=[(170, '170px'), (270, '270px')],
                                     default=270,
                                     label='Image Width',
                                     help_text='Default is 270px.')
    text = blocks.RichTextBlock(required=False)
    is_bottom_rule = blocks.BooleanBlock(required=False,
                                         default=True,
                                         label='Bottom Rule')

    class Meta:
        icon = 'image'
        template = '_includes/molecules/image-inset.html'
        label = 'Image inset'
Пример #10
0
class SnippetList(blocks.StructBlock):
    heading = blocks.CharBlock(required=False)
    body = blocks.RichTextBlock(required=False)
    image = atoms.ImageBasic(required=False)

    snippet_type = blocks.ChoiceBlock(
        choices=[
            (
                m.__module__ + '.' + m.__name__,
                m._meta.verbose_name_plural.capitalize()
            ) for m in get_snippet_models()
        ],
        required=True
    )
    actions = blocks.ListBlock(blocks.StructBlock([
        ('link_label', blocks.CharBlock(
            help_text='E.g., "Download" or "Order free prints"'
        )),
        ('snippet_field', blocks.ChoiceBlock(
            choices=[
                (
                    m._meta.verbose_name_plural.capitalize(),
                    getattr(m, 'snippet_list_field_choices', [])
                ) for m in get_snippet_models()
            ],
            help_text='Corresponds to the available fields for the selected'
                      'snippet type.'
        )),
    ]))

    tags = blocks.ListBlock(
        blocks.CharBlock(label='Tag'),
        help_text='Enter tag names to filter the snippets. For a snippet to '
                  'match and be output in the list, it must have been tagged '
                  'with all of the tag names listed here. The tag names '
                  'are case-insensitive.'
    )

    class Meta:
        icon = 'table'
        template = '_includes/organisms/snippet-list.html'
Пример #11
0
class FeaturedContent(blocks.StructBlock):
    heading = blocks.CharBlock(required=False)
    body = blocks.RichTextBlock(required=False)

    category = blocks.ChoiceBlock(choices=ref.fcm_types, required=False)
    post = blocks.PageChooserBlock(required=False)

    show_post_link = blocks.BooleanBlock(required=False,
                                         label="Render post link?")
    post_link_text = blocks.CharBlock(required=False)

    image = atoms.ImageBasic(required=False)
    links = blocks.ListBlock(atoms.Hyperlink(required=False),
                             label='Additional Links')

    video = blocks.StructBlock([
        ('id',
         blocks.CharBlock(
             required=False,
             label='ID',
             help_text='E.g., in "https://www.youtube.com/watch?v=en0Iq8II4fA",'
             ' the ID is everything after the "?v=".')),
        ('url',
         blocks.CharBlock(required=False,
                          label='URL',
                          help_text='You must use the embed URL, e.g., '
                          'https://www.youtube.com/embed/'
                          'JPTg8ZB3j5c?autoplay=1&enablejsapi=1')),
        ('height', blocks.CharBlock(default='320', required=False)),
        ('width', blocks.CharBlock(default='568', required=False)),
    ])

    class Meta:
        template = '_includes/molecules/featured-content.html'
        icon = 'doc-full-inverse'
        label = 'Featured Content'
        classname = 'block__flush'

    class Media:
        js = ['video-player.js']