Exemple #1
0
class TitleAndTextBlock(blocks.StructBlock):
    """Title and text and nothing else."""

    title = blocks.CharBlock(required=True, help_text='Add your title')
    text = blocks.TextBlock(required=True, help_text='Add additional text')

    class Meta: # noqa
        template = "streams/title_and_text_block.html"
        icon = "edit"
        label = "Title & Text"
Exemple #2
0
class BlogPage(Page):
    date = models.DateField("Post date")
    description = models.CharField(max_length=250, blank=True)
    tags = ClusterTaggableManager(through='blog.BlogTag', blank=True)
    categories = ParentalManyToManyField('blog.BlogCategory', blank=True)

    body = StreamField([
        ('heading', blocks.CharBlock(classname="full title")),
        ('paragraph', blocks.RichTextBlock()),
        ('two_columns', TwoColumnBlock()),
        ('three_columns', ThreeColumnBlock()),
        ('image', ImageChooserBlock()),
        ('htmljs', blocks.TextBlock()),
        ('code_bash', blocks.TextBlock()),
        ('code_py', blocks.TextBlock()),
        ('code_htmljs', blocks.TextBlock()),
    ],
                       null=True,
                       blank=True)

    search_fields = Page.search_fields + [
        index.SearchField('description'),
        index.SearchField('body'),
    ]

    content_panels = Page.content_panels + [
        MultiFieldPanel([
            FieldPanel('date'),
            FieldPanel('tags'),
            FieldPanel('categories', widget=forms.CheckboxSelectMultiple),
        ],
                        heading="Blog information"),
        FieldPanel('description'),
        StreamFieldPanel('body'),
        InlinePanel('gallery_images', label="Gallery images"),
    ]

    def get_context(self, request):
        #update context: adding catgories list for side widget
        context = super().get_context(request)
        SetContext(context)
        return context
Exemple #3
0
class TestimonialsBlock(blocks.StreamBlock):

    testimonial = blocks.StructBlock([
        ('testimonial', blocks.TextBlock(icon='help', label='Testimonial')),
        ('client', RichTextBlock(icon='edit', label='Client')),
    ], icon='help')

    class Meta:
        template = "blocks/testimonials_block.html"
        icon = "openquote"
        label = "Testimonials Slider"
Exemple #4
0
class FAQBlock(blocks.StreamBlock):

    faq = blocks.StructBlock([
        ('question', blocks.TextBlock(icon='help', label='FAQ Question')),
        ('answer', RichTextBlock(icon='edit', label='FAQ Answer')),
    ], icon='help')

    class Meta:
        template = "blocks/faq_block.html"
        icon = "help"
        label = "FAQ Dropdown"
Exemple #5
0
class TocBlock(blocks.StructBlock):
    title = blocks.CharBlock(default='TOC')
    toc_items = blocks.TextBlock()

    class Meta:
        template = 'home/blocks/toc.html'
        icon = 'list-ul'

    @property
    def items(self):
        return json2obj(self.toc_items)
Exemple #6
0
class TitleAndTextBlock(blocks.StructBlock):

    title = blocks.CharBlock(
        required=True,
        help_txt="Add your title")  #instead of models.CharField()
    text = blocks.TextBlock(required=True, htp_text="Add additional text")

    class Meta:
        template = "streams/title_and_text_block.html"
        icon = "edit"
        label = "Title & Text"
Exemple #7
0
class PageBlock(blocks.StructBlock):
    """Title and text nothing else"""

    title = blocks.CharBlock(required=True, help_text="page head title")
    content = blocks.TextBlock(required=True, help_text="page description")

    class Meta:
        template = "home/tittle_and_text_block.html"
        icon = "edit"
        label = "Title & Text"
        value_class = LinkStructValue
Exemple #8
0
class TeamCardsBlock(blocks.StructBlock):
    """ Cards with image and title else """

    title = blocks.CharBlock(
        required=False, help_text='Add a title for the cards if necessary, ')

    cards = blocks.ListBlock(
        blocks.StructBlock([
            ('image',
             images_blocks.ImageChooserBlock(
                 required=True, help_text='Use a 400x300px picture,')),
            ('name', blocks.CharBlock(max_length=48)),
            ('position', blocks.TextBlock(max_length=48)),
            ('text', blocks.TextBlock(max_length=256, required=False)),
        ]))

    class Meta:
        template = 'streams/team_block.html'
        icon = 'fa-address-card'
        label = 'Staff cards'
Exemple #9
0
class HomeFeatureSlide(blocks.StructBlock):
    title = blocks.CharBlock(max_length=100,
                             required=True,
                             help_text='Add additional title')
    text = blocks.TextBlock(required=True, help_text='Add additional text')
    icon = blocks.CharBlock(max_length=50, required=True)

    class Meta:
        template = "home/home_feature_slide.html"
        icon = "edit"
        label = "Feature"
class BodyBlock(blocks.StreamBlock):

    heading = blocks.CharBlock()
    description = blocks.TextBlock()
    email = blocks.EmailBlock()
    number = blocks.IntegerBlock()
    numbers = blocks.ListBlock(blocks.IntegerBlock())
    paragraph = blocks.RichTextBlock()
    image = ImageChooserBlock()
    author = AuthorBlock()
    authors = blocks.ListBlock(AuthorBlock())
class TitleAndTextBlock(blocks.StructBlock):
    """Title and text and nothing else."""

# just replace models with blocks, replace fields with block
    title = blocks.CharBlock(required=True, help_text="Add your title")
    text = blocks.TextBlock(required=True, help_text="Add additional text")

    class Meta:
        template = "streams/title_and_text_block.html"
        icon = "edit"
        label = "Title & Text"
Exemple #12
0
class TitleAndTextTextBlock(blocks.TextBlock):
    """Title and text and nothing else"""

    title = blocks.CharBlock(required=True, help_text="Ajouter votre titre")
    text = blocks.TextBlock(required=True,
                            help_text="Ajouter le contenu du paragraphe")

    class Meta:
        template = "streams/title_and_text_block.html"
        icon = "edit"
        label = "Titret et contenu"
class WhatsappBlock(blocks.StructBlock):
    image = ImageChooserBlock(required=False)
    document = DocumentChooserBlock(icon="document", required=False)
    media = MediaBlock(icon="media", required=False)
    message = blocks.TextBlock(
        max_lenth=4096,
        help_text="each message cannot exceed 4096 characters.")

    class Meta:
        icon = "user"
        form_classname = "whatsapp-message-block struct-block"
Exemple #14
0
class ImageBlock(blocks.StructBlock):
    header = blocks.TextBlock(required=True, help_text="add your header")
    header_color = ImageColorTypeChooserBlock(required=True,
                                              help_text="choose header color")
    sub_copy = blocks.TextBlock(required=True, help_text="add your sub_copy")
    sub_copy_color = ImageColorTypeChooserBlock(
        required=True, help_text="choose sub copy color")
    link_text = blocks.CharBlock(required=True, max_length=255)
    link_url = blocks.URLBlock(required=True, help_text="add url")
    link_tab_chooser = LinkTabChooserBlock(
        required=True,
        help_text="choose either open image on new or current tab")
    link_media_content = blocks.TextBlock(help_text="for now idk for what")

    image = ImageChooserBlock(required=True, help_text="choose image")

    class Meta:
        template = "streams/image_block.html"
        icon = "image"
        label = "Image"
class WebBlock(blocks.StructBlock):

    Title = blocks.CharBlock(required=True, help_text='Add Title')
    Description = blocks.TextBlock(required=True, help_text='Add Description')
    Article = blocks.RichTextBlock(required=True)

    class Meta:

        template = 'resources/web_card.html'
        icon = 'edit'
        label = 'weblink'
class StreamFieldBlogPost(Page):

    content = StreamField([('paragraph', blocks.RichTextBlock()),
                           ('premium_paragraph', blocks.RichTextBlock()),
                           ('discovery_url', blocks.TextBlock()),
                           ('image', ImageChooserBlock()),
                           ('youtube_video', EmbedBlock())])

    api_fields = [APIField("content")]

    content_panels = Page.content_panels + [StreamFieldPanel('content')]
Exemple #17
0
class CarouselBlock(blocks.StreamBlock):
    image = ImageChooserBlock()
    quotation = blocks.StructBlock([
        ('text', blocks.TextBlock()),
        ('author', blocks.CharBlock()),
    ])

    class Meta:
        template = "streams/carousel_block.html"
        icon = "code"
        label = "Image Carousel"
Exemple #18
0
class HeroStaticLeftBlock(blocks.StructBlock):
    background_image = ImageChooserBlock()
    title = blocks.CharBlock(required=False)
    headline = blocks.CharBlock()
    body = blocks.TextBlock()
    page = blocks.PageChooserBlock(required=False)
    page_secodary = blocks.PageChooserBlock(required=False)
    external_url = blocks.URLBlock(required=False)

    class Meta:
        template = 'main/blocks/hero_static_left.html'
Exemple #19
0
class QuoteBlock(blocks.StructBlock):
    quote = blocks.TextBlock(
        label='Citaat',
        required=True,
        max_length=150,
    )

    quote_pos = blocks.ChoiceBlock(
        choices=(
            ('up', 'Boven'),
            ('under', 'Onder'),
        ),
        label='Positie quote',
        help_text='De positie van de quote (boven of onder het plaatje).',
    )

    quote_size = blocks.ChoiceBlock(
        choices=(
            ('24px', '24px'),
            ('40px', '40px'),
        ),
        label='Quote tekstgrootte',
        help_text='De tekstgroote van de quote.',
    )

    quote_background_color = ColorPickerBlock(
        label='Achtergrondkleur',
        required=False,
        help_text='De achtergrondkleur van de quote.')
    quote_color = ColorPickerBlock(label='Kleur tekst',
                                   required=False,
                                   help_text='De tekstkleur van de quote.')

    logo = ImageChooserBlock(required=False)

    name = blocks.CharBlock(
        label='Naam',
        max_length=50,
        help_text='Naam van de persoon achter het citaat.',
    )

    company = blocks.CharBlock(
        label='Bedrijf',
        max_length=50,
        help_text='Naam van het bedrijf achter het citaat.',
    )

    city = blocks.CharBlock(label='Plaats', max_length=50, help_text='Plaats')

    link = blocks.PageChooserBlock(
        label='Interne link',
        can_choose_root=True,
        required=False,
    )
Exemple #20
0
class CrowdfundingRocket2Page(FixUrlMixin, Page):
    class Meta:
        verbose_name = "crowdfunding - rocket 2"

    title_en = models.CharField(
        verbose_name=_("title"),
        max_length=255,
        blank=True,
        help_text=_("The page title as you'd like it to be seen by the public"),
    )
    target_amount = models.IntegerField()
    title_translated = TranslatedField("title", "title_en")
    body_sk = StreamField([("text", blocks.TextBlock())])
    body_en = StreamField([("text", blocks.TextBlock())])
    body = TranslatedField("body_sk", "body_en")

    content_panels_sk = Page.content_panels + [
        FieldPanel("target_amount"),
        StreamFieldPanel("body_sk"),
    ]
    content_panels_en = [
        FieldPanel("title_en", classname="full title"),
        StreamFieldPanel("body_en"),
    ]
    edit_handler = TabbedInterface(
        [
            ObjectList(content_panels_sk, heading="Content SK"),
            ObjectList(content_panels_en, heading="Content EN"),
            ObjectList(Page.promote_panels, heading="Promote"),
            ObjectList(Page.settings_panels, heading="Settings", classname="settings"),
        ]
    )

    def get_context(self, request, *args, **kwargs):
        context = super().get_context(request, *args, **kwargs)
        festival = self.get_ancestors().type(FestivalPage).first()
        if festival:
            context["festival"] = festival.specific
        else:
            context["festival"] = last_festival(self)
        return context
Exemple #21
0
class SloganBlock(CollapsibleFieldsMixin, blocks.StructBlock):
    heading = blocks.CharBlock(**heading_block_kwargs)
    text = blocks.TextBlock(
        required=False,
        rows=1,
        help_text=_("The text is displayed centered and linebreaks will be preserved."),
    )
    font_size = blocks.IntegerBlock(
        default=40,
        help_text=_(
            "Adjust the font size to fit your needs. Use the preview feature to see "
            "how big the font will be rendered."
        ),
    )
    font_color = blocks.ChoiceBlock(choices=COLOR_CHOICES, default=COLOR_XR_YELLOW)
    background_color = blocks.ChoiceBlock(choices=COLOR_CHOICES, default=COLOR_XR_GREEN)
    background_image = ImageChooserBlock(required=False)
    caption = blocks.CharBlock(**caption_block_kwargs)
    description = blocks.TextBlock(**description_block_kwargs)
    link = LinkBlock()

    fields = [
        "heading",
        "text",
        {"label": _("Card"), "fields": ["caption", "description", "link"]},
        {
            "label": _("Settings"),
            "fields": [
                "align",
                "font_size",
                "font_color",
                "background_color",
                "background_image",
            ],
        },
    ]

    class Meta:
        icon = "openquote"
        template = "xr_pages/blocks/slogan.html"
        value_class = XrStructValue
Exemple #22
0
class Card(blocks.StructBlock):
    title = blocks.CharBlock(
        max_length=50,
        help_text='Bold title text for this card. Max length is 50 chars.')
    text = blocks.TextBlock(
        max_length=255,
        help_text='Optional text for this card. Max length is 255 chars.',
        required=False,
    )
    image = ImageChooserBlock(
        help_text='Image will be automatically cropped to 500px by 300px')
    link = Link(help_text='Enter a link or select a page')
class CustomBlockquoteBlock(blocks.StructBlock):
    """Custom blockquote block with the quote text and 
    the optional quote author and source."""
    quote = blocks.TextBlock(required=True, help_text=_('Quote text.'), rows=3)
    author = blocks.CharBlock(required=False,
                              help_text=_('Author of the quoted text.'))
    source = blocks.CharBlock(required=False,
                              help_text=_('Source of the quoted text.'))

    class Meta:
        icon = 'openquote'
        template = 'blockquote_block/blockquote.html'
Exemple #24
0
class TitleAndTextBlock(blocks.StructBlock):
    """
    Title and text block
    """

    title = blocks.CharBlock(required=True, help_text="Add your title")
    text = blocks.TextBlock(required=True, help_text="Add your text")

    class Meta:
        template = "streams/title_and_text_block.html"
        icon = "edit"
        label = "Title & Text"
Exemple #25
0
class AboutTestimonialBlock(blocks.StructBlock):
    feedback = blocks.TextBlock(required=True, help_text='Add Client Feedback')
    client_name = blocks.CharBlock(max_length=40,
                                   required=True,
                                   help_text='Add Client Name')
    date = blocks.DateBlock()
    photo = ImageChooserBlock(required=True, help_text='Upload slide image')

    class Meta:
        template = "about/testimonials.html"
        icon = "edit"
        label = "Testimonial"
Exemple #26
0
class CardBlock(blocks.StructBlock):
    """Card deck with image, text, and button"""

    title = blocks.CharBlock(required=False, help_text='Add your title')

    cards = blocks.ListBlock(
        blocks.StructBlock([
            ("image", ImageChooserBlock(required=True)),
            ("title", blocks.CharBlock(required=True, max_length=40)),
            ("text", blocks.TextBlock(required=True, max_length=200)),
            ("button_page", blocks.PageChooserBlock(required=False)),
            ("button_url",
             blocks.URLBlock(required=False,
                             help_text="Button page will be first")),
            ("button_cta", blocks.TextBlock(required=False, max_length=20)),
        ]))

    class Meta:  # noqa
        template = "streams/card_block.html"
        icon = "placeholder"
        label = "Cards"
Exemple #27
0
class TitleAndTextBlock(blocks.StructBlock):
    """ Title and text and nothing else,"""

    title = blocks.CharBlock(required=True, help_text="Ajouter un titre")
    text = blocks.TextBlock(required=True,
                            help_text="Ajouter un text supplémentaire")

    class Meta:
        verbose_name = "Un titre et un sous-titre"
        template = "core/title_and_text_block.html"
        icon = "edit"
        label = "Title & Text"
Exemple #28
0
class Titre(TemplatedBlock):
    class Meta:
        icon = 'title'
        group = 'Contenu texte'

    niveau = blocks.ChoiceBlock(
        default='h2',
        choices=[('h{}'.format(i), 'Titre de niveau {}'.format(i))
                 for i in range(2, 7)],
        icon='title',
    )
    texte = blocks.TextBlock(icon='pilcrow')
Exemple #29
0
class FacilityBlock(blocks.StructBlock):
    title = blocks.CharBlock(required=True, help_text="Add your title")
    image = ImageChooserBlock(required=True,
                              help_text="White colored image preferred")
    desc = blocks.TextBlock(required=True,
                            max_length=500,
                            verbose_name="Description")

    class Meta:
        template = "blocks/facility_block.html"
        icon = "placeholder"
        label = "Insurance Facilities"
Exemple #30
0
class LandingPost(BasePost):
    Page = TranslatablePage
    body = StreamField([
        ('heading', blocks.CharBlock(classname="full title")),
        ('paragraph', blocks.RichTextBlock()),
        ('code', CodeBlock(label='Code')),
        ('code_output', blocks.TextBlock()),
        ('image', ImageChooserBlock(icon="image")),
        ('table',
         TableBlock(icon="form", template='blog/blocks/table_template.html')),
        ('custom_html', blocks.TextBlock(icon='plus-inverse')),
    ],
                       null=True,
                       blank=True)

    content_panels = Page.content_panels + [
        FieldPanel('categories', widget=forms.CheckboxSelectMultiple),
        StreamFieldPanel('body'),
        PageChooserPanel(
            'related_page1',
            ['blog.PostPage', 'blog.LandingPage', 'blog.LandingPost']),
        PageChooserPanel(
            'related_page2',
            ['blog.PostPage', 'blog.LandingPage', 'blog.LandingPost']),
    ]
    settings_panels = Page.settings_panels + [
        FieldPanel('date'),
        ImageChooserPanel('thumbnail'),
        MultiFieldPanel([
            FieldPanel('is_series'),
            FieldPanel('series_name'),
            FieldPanel('series_id')
        ],
                        heading='SeriesSetting',
                        classname="collapsible collapsed"),
    ]

    def get_context(self, request, *args, **kwargs):
        context = super().get_context(request, *args, **kwargs)
        return context