Ejemplo n.º 1
0
class CreditImageBlock(StructBlock):
    image = ImageChooserBlock()
    caption = TextBlock(help_text='Photo caption', required=False)
    credit = TextBlock(help_text='Image credit')

    class Meta:
        icon = 'image'
Ejemplo n.º 2
0
class CaptionedImageBlock(StructBlock):
    """
    An image block with a caption, credit, and alignment.
    """
    image = ImageChooserBlock(help_text='The image to display.', )
    caption = TextBlock(
        required=False,
        help_text='The caption will appear under the image, if entered.')
    credit = TextBlock(
        required=False,
        help_text='The credit will appear under the image, if entered.')
    align = ChoiceBlock(
        choices=[
            ('left', 'Left'),
            ('right', 'Right'),
            ('center', 'Center'),
            ('full', 'Full Width'),
        ],
        default='left',
        help_text='How to align the image in the body of the page.')

    class Meta:
        icon = 'image'
        template = 'wagtailcontentstream/blocks/captioned_image.html'
        help_text = 'Select an image and add a caption (optional).'
Ejemplo n.º 3
0
class GraphicLinkGridItemBlock(StructBlock):
    image = ImageChooserBlock()
    title = TextBlock(required=False)
    subtitle = TextBlock(required=False)
    link = URLBlock(required=False)

    def get_context(self, value, parent_context=None):
        context = super().get_context(value, parent_context=parent_context)

        def formatted_title():
            title = value['title']
            if '& ' in title:
                split_title = title.rsplit('& ')
                formatted_title = split_title[0] + '& ' + split_title[
                    1]
            else:
                formatted_title = None

            return formatted_title

        context['formatted_title'] = formatted_title()
        return context

    class Meta:
        icon = 'fa-icon-th'
        template = 'blocks/graphic_link_item.html'
        help_text = 'Select an image and add a caption (optional).'
Ejemplo n.º 4
0
class ContentStreamBlock(StreamBlock):
    heading = TextBlock()
    paragraph = TextBlock()
    code = CodeBlock(label='Code')

    class Meta:
        icon = 'code'
Ejemplo n.º 5
0
class HeadlineCaptionOptions(StreamBlock):
    headline = TextBlock()
    caption = TextBlock()
    item = ItemForOptions()

    class Meta:
        template = 'blocks/HeadlineCaptionOptions.html'
Ejemplo n.º 6
0
class BootstrapButton(StructBlock):
    """
    Custom 'StructBlock' that allows the user to make a bootstrap button
    """
    button_text = TextBlock()
    button_link = TextBlock()
    button_color = ChoiceBlock(choices=[('btn-primary', 'DEFAULT'),
                                        ('btn-danger', 'RED'),
                                        ('btn-secondary', 'GREY'),
                                        ('btn-success', 'GREEN'),
                                        ('btn-warning', 'ORANGE')],
                               blank=True,
                               required=False,
                               help_text="select a button color")
    button_size = ChoiceBlock(choices=[('', 'DEFAULT'), ('btn-lg', 'LARGE'),
                                       ('btn-sm', 'SMALL')],
                              blank=True,
                              required=False,
                              help_text="select a button size")
    custom_class = TextBlock(
        required=False,
        blank=True,
        help_text="control this element by giving unique class names "
        "separated by space and styling the class in css")

    class Meta:
        icon = "fa-bold"
        template = "blocks/bootstrap/button.html"
        help_text = "Create a bootstrap button"
Ejemplo n.º 7
0
class ItemForOptions(StructBlock):
    image = ImageChooserBlock()
    title = TextBlock()
    caption = TextBlock()

    class Meta:
        template = 'blocks/item-block.html'
Ejemplo n.º 8
0
class BootstrapAlert(StructBlock):
    """
    Custom 'StructBlock' that allows the user to make a bootstrap alert
    """
    alert_text = TextBlock()
    alert_color = ChoiceBlock(choices=[
        ('alert-primary', 'DEFAULT'),
        ('alert-secondary', 'GREY'),
        ('alert-success', 'GREEN'),
        ('alert-danger', 'RED'),
        ('alert-warning', 'ORANGE'),
        ('alert-dark', 'DARK'),
        ('alert-light', 'LIGHT'),
    ],
                              blank=True,
                              required=False,
                              help_text="select a background color")
    is_link = BooleanBlock(required=False)
    alert_link = TextBlock(required=False)
    custom_class = TextBlock(
        required=False,
        blank=True,
        help_text="control this element by giving unique class names "
        "separated by space and styling the class in css")

    class Meta:
        icon = "fa-bell"
        template = "blocks/bootstrap/alert.html"
        help_text = "Create a bootstrap alert"
Ejemplo n.º 9
0
class BootstrapMediaObject(StructBlock):
    """
    Custom 'StructBlock' that allows user to make a bootstrap media object.
    """
    media_img = ImageChooserBlock(required=True)
    media_img_alt = TextBlock(required=True)
    media_img_width = IntegerBlock(
        required=False,
        blank=True,
        help_text="Enter an image width as an integer value. Eg(50)")
    media_img_height = IntegerBlock(
        required=False,
        blank=True,
        help_text="Enter an image height as an integer value Eg(50)")
    heading_text = TextBlock(
        required=False,
        blank=True,
        help_text="enter some heading text for media object")
    body_text = RichTextBlock(
        required=True, help_text="Enter some message for the media object")
    custom_class = TextBlock(
        required=False,
        blank=True,
        help_text="control this element by giving unique class names "
        "separated by space and styling the class in css")

    class Meta:
        icon = "fa-align-right"
        template = "blocks/bootstrap/media.html"
Ejemplo n.º 10
0
class VideoBlock(StructBlock):
    caption = TextBlock(label='Seksjonstittel', required=True)
    video_id = TextBlock(label='Youtube video-id', required=True)

    class Meta:
        icon = 'media'
        template = 'home/blocks/sidepanel_video.html'
Ejemplo n.º 11
0
class IconBlock(StructBlock):
    position = ChoiceBlock(choices=(('left', 'Left'), ('center', 'Center'),
                                    ('right', 'Right')),
                           default='center')
    icon = TextBlock("")
    icon_colour = TextBlock("")
    content = RichTextBlock("")
Ejemplo n.º 12
0
class URLActionItemBlock(StructBlock):
    label = TextBlock(required=True)
    url = TextBlock(required=True)

    class Meta:
        icon = 'fa-link'
        template = 'blocks/url_action_item.html'
        help_text = 'Select a URL and label for the button.'
Ejemplo n.º 13
0
class MessageDividerBlock(StructBlock):

    message = TextBlock()
    message_es = TextBlock()

    class Meta:
        icon = "fa-square"
        template = 'blocks/message_divider_block.html'
Ejemplo n.º 14
0
class MediaGalleryImageItem(StructBlock):
    """This utility class is for use by MediaGalleryBlock."""
    image = ImageChooserBlock()
    caption = TextBlock()
    credit = TextBlock()

    class Meta:
        icon ='image'
Ejemplo n.º 15
0
class URLActionItemBlock(StructBlock):
    label = TextBlock(required=True)
    url = TextBlock(required=True)

    class Meta:
        icon = "fa-link"
        template = "wagtailgridder/blocks/url_action_item.html"
        help_text = "Select a URL and label for the button."
Ejemplo n.º 16
0
class ContactTypeStreamBlock(StreamBlock):
    """Model allowing the CMS to bring together multiple struct block objects."""

    contact_type_editor = StructBlock([
        ('heading', TextBlock()),
        ('description', RichTextBlock(required=False)),
        ('email', TextBlock())
    ], icon='title', classname='title')
Ejemplo n.º 17
0
class QuoteBlock(StructBlock):
    leadtext = TextBlock(required=False)
    quotation = TextBlock(required=True)
    source = CharBlock(required=True, max_length=150)

    class Meta:
        template = "streams/quotation_block.html"
        icon = 'user'
        label = 'Famous Quote'
Ejemplo n.º 18
0
class SectionBlock(StructBlock):
    headline = TextBlock(help_text='Write a title for this section.')
    subheadline = TextBlock(required=False, help_text='Write a subheadline for this section (optional).')
    body = ContentStreamBlock(help_text='The section content goes here.')

    class Meta:
        icon = 'emoji-bookmark-tabs'
        template = 'blocks/section.html'
        help_text = 'Sections divide the page into digestible parts.'
Ejemplo n.º 19
0
class MediaGalleryVideoItem(StructBlock):
    """This utility class is for use by MediaGalleryBlock."""
    video = EmbedBlock()
    thumbnail = ImageChooserBlock()
    caption = TextBlock()
    credit = TextBlock()

    class Meta:
        icon ='media'
Ejemplo n.º 20
0
class SlideBlock(StructBlock):
    title = CharBlock("Title ...", blank=True, max_length=250)
    classesTitle = CharBlock(label="Title CSS (text-dark etc)", required=False, blank=True)
    caption = TextBlock(required=False, blank=True)
    classesCaption = CharBlock(label="Caption CSS (text-danger)", required=False, blank=True)
    classes = CharBlock(label="CSS classes (bg-light or bg-dark)", required=False, blank=True)
    background = ImageChooserBlock()
    button = TextBlock(required=False)
    link = URLBlock(required=False)
Ejemplo n.º 21
0
class ExternalMemberQuoteBlock(StructBlock):
    quote_text = TextBlock()
    name = TextBlock()
    role = TextBlock()
    organisation = TextBlock()
    external_member_photo = ImageChooserBlock(required=False)

    class Meta():
        icon = 'fa-user'
Ejemplo n.º 22
0
class coloredInterstitial(StructBlock):
    image = ImageChooserBlock()
    topCaption = TextBlock()
    headline = TextBlock()
    button = PageChooserBlock()
    buttonText = CharBlock()

    class Meta:
        template = 'blocks/colored-interstitial.html'
Ejemplo n.º 23
0
class BootstrapCard(StructBlock):
    """
    Custom 'StructBlock' that allows the user to make a bootstrap card
    """

    card_width = IntegerBlock(help_text="18 works best for card",
                              required=False,
                              blank=True)
    is_card_img = BooleanBlock(required=False)
    is_card_img_overlay = BooleanBlock(
        required=False,
        default=False,
        help_text="Use image as background for card",
        label="Image Overlay?")
    card_img = ImageChooserBlock(required=False)
    card_img_width = IntegerBlock(required=False,
                                  help_text="provide an image width")
    card_img_height = IntegerBlock(required=False,
                                   help_text="provide an image height")
    card_title = TextBlock(required=False, null=True, blank=True)
    card_text = RichTextBlock(required=False, null=True, blank=True)
    card_bg_color = ChoiceBlock(choices=[
        ('bg-primary', 'DEFAULT'),
        ('bg-secondary', 'GREY'),
        ('bg-success', 'GREEN'),
        ('bg-danger', 'RED'),
        ('bg-warning', 'ORANGE'),
        ('bg-dark', 'DARK'),
        ('bg-light', 'LIGHT'),
    ],
                                blank=True,
                                required=False,
                                help_text="select a background color")
    card_text_color = ChoiceBlock(choices=[
        ('text-primary', 'DEFAULT'),
        ('text-secondary', 'GREY'),
        ('text-success', 'GREEN'),
        ('text-danger', 'RED'),
        ('text-warning', 'ORANGE'),
        ('text-dark', 'DARK'),
        ('text-light', 'LIGHT'),
    ],
                                  blank=True,
                                  required=False,
                                  help_text="select a text color")
    buttons = ListBlock(BootstrapButton(required=False), default=[])
    custom_class = TextBlock(
        required=False,
        blank=True,
        help_text="control this element by giving unique class names "
        "separated by space and styling the class in css")

    class Meta:
        icon = "fa-id-card"
        template = "blocks/bootstrap/card.html"
        help_text = "Create a bootstrap card"
Ejemplo n.º 24
0
class WhereWeWorkLocationBlock(StructBlock):
    """
    Allows the addition of a single where we work location
    """
    name = TextBlock()
    phone = TextBlock(required=False)
    google_map = GeoBlock()

    class Meta():
        icon = 'fa-map'
Ejemplo n.º 25
0
class BlockQuote(StructBlock):
    """
    Custom `StructBlock` that allows render text in a blockquote element
    """
    text = TextBlock()
    source = TextBlock(required=False, help_text='Who is this quote acredited to?')

    class Meta:
        icon = 'fa-quote-left'
        template = 'blocks/blockquote.html'
Ejemplo n.º 26
0
class BasicHeaderBackground(StructBlock):
    backgroundImage = ImageChooserBlock(required=True)
    headline = TextBlock(required=False)
    caption = TextBlock(required=False)
    buttonLeftText = TextBlock(required=False)
    buttonRightText = TextBlock(required=False)
    buttonLeftDestination = PageChooserBlock(required=False)
    buttonRightDestination = PageChooserBlock(required=False)

    class Meta:
        template = 'blocks/basic-header.html'
Ejemplo n.º 27
0
class FullPageIntro(StructBlock):
    backgroundImage = ImageChooserBlock()
    headline = TextBlock()
    caption = TextBlock()
    buttonLeftText = TextBlock()
    buttonRightText = TextBlock()
    buttonLeftDestination = PageChooserBlock(required=True)
    buttonRightDestination = PageChooserBlock(required=True)

    class Meta:
        template = 'blocks/full-page.html'
Ejemplo n.º 28
0
class SectionBlockQuote(StructBlock):
    """
    Custom `StructBlock` that allows render text in a blockquote element
    """
    text = TextBlock()
    source = TextBlock(required=False, help_text='Who is this quote acredited to?')
    center = BooleanBlock(default=False, required=False)

    class Meta:
        icon = 'fa-quote-right'
        template = 'blocks/section_blockquote.html'
Ejemplo n.º 29
0
class TestimonialBlock(StructBlock):
    test_name = TextBlock(blank=True)
    test_quote = TextBlock(blank=True)
    test_pic = ImageChooserBlock(blank=True, required=False)
    test_reversed = BooleanBlock(required=False, default=False)

    panels = [FieldPanel('intro')]

    class Meta:
        template = "streams/testimonial_block.html"
        icon = 'group'
        label = 'Client Testimonial'
Ejemplo n.º 30
0
class MediaGalleryBlock(StructBlock):
    """
    """
    title = TextBlock()
    description = TextBlock()
    gallery = StreamBlock([
        ('image_item',MediaGalleryImageItem()),
        ('video_item', MediaGalleryVideoItem())
    ])

    class Meta:
        template = "includes/blocks/media_gallery.html"