Example #1
0
class OtherImgBlock(blocks.StructBlock):
    title = blocks.CharBlock(label=_('模块标题'))
    fill_the_screen_or_nor = blocks.BooleanBlock(label=_('是否撑满屏幕'),
                                                 required=False)

    img_for_pc = ImageChooserBlock(required=True, label=_('PC端图片'))
    img_for_MOBILE = ImageChooserBlock(required=False, label=_('移动端图片'))

    link = blocks.URLBlock(required=False, label=_('链接(非必填)'))

    class Meta:
        label = "其余图文"
        icon = 'user'

        template = 'home/blocks/otherimg.html'
Example #2
0
class LocalAreaLinksBlock(blocks.StructBlock):
    introduction = blocks.RichTextBlock(
        features=RICH_TEXT_FEATURES,
        default="<p>Select your local area for information:</p>",
    )
    aylesbury_vale_url = blocks.URLBlock(required=False,
                                         label="Aylesbury Vale URL")
    chiltern_url = blocks.URLBlock(required=False, label="Chiltern URL")
    south_bucks_url = blocks.URLBlock(required=False, label="South Bucks URL")
    wycombe_url = blocks.URLBlock(required=False, label="Wycombe URL")

    class Meta:
        icon = ""
        template = "patterns/molecules/streamfield/blocks/local_area_links_block.html"

    def get_context(self, value, parent_context=None):
        context = super().get_context(value, parent_context=parent_context)
        context["has_area_links"] = any([
            value["aylesbury_vale_url"],
            value["chiltern_url"],
            value["south_bucks_url"],
            value["wycombe_url"],
        ])
        return context
Example #3
0
class ButtonBlock(blocks.StructBlock):
    """Internal or External Button URL """

    button_page = blocks.PageChooserBlock(
        required=False, help_text='If selected, this url will be used first')
    button_url = blocks.URLBlock(
        required=False,
        help_text=
        'If added, this url will be used secondarily to the button page')

    class Meta:
        template = "streams/button_block.html"
        icon = "link"
        label = "Single Button "
        value_class = LinkStructValue
Example #4
0
class ShowcasesBlock(blocks.StructBlock):
    title = blocks.CharBlock()
    subtitle = blocks.CharBlock(required=False)
    more_link = PageOrExternalLinkBlock(required=False)
    items = blocks.ListBlock(
        blocks.StructBlock((
            ('title', blocks.CharBlock()),
            ('subtitle', blocks.CharBlock(required=False)),
            ('link_url', blocks.URLBlock(required=False)),
            ('image', ImageChooserBlock()),
        )))

    class Meta:
        icon = 'view'
        template = 'core/blocks/showcases_block.html'
Example #5
0
class SeriesProcessBlock(blocks.StructBlock):
    title = blocks.CharBlock(label=_('模块标题'))
    has_update_or_nor = blocks.BooleanBlock(label=_('是否有敬请期待'), required=False)
    series = blocks.ListBlock(blocks.StructBlock([
        ('course_photo', ImageChooserBlock(required=True, label=_('课程图片'))),
        ('title', blocks.CharBlock(required=True, label=_('课程标题'))),
        ('description', blocks.CharBlock(required=True, label=_('课程描述'))),
        ('link', blocks.URLBlock(required=True, label=_('课程链接'))),
    ]),
                              label=_('课程路径'))

    class Meta:
        icon = 'user'
        label = "系列课程流程列表"
        template = 'home/blocks/series_process_list.html'
Example #6
0
class CTABlock(blocks.StructBlock):
    """A simple call to action section."""

    title = blocks.CharBlock(required=True, max_length=60)
    text = blocks.RichTextBlock(required=True, features=["bold", "italic"])
    button_page = blocks.PageChooserBlock(required=False)
    button_url = blocks.URLBlock(required=False)
    button_text = blocks.CharBlock(required=True,
                                   default='Learn More',
                                   max_length=40)

    class Meta:  # noqa
        template = "streams/cta_block.html"
        icon = "placeholder"
        label = "Call to Action"
Example #7
0
class ButtonBlock(blocks.StructBlock):
    """ An external or internal URL """

    button_page = blocks.PageChooserBlock(
        required=False, help_text='If selected, this url will be used first')
    button_url = blocks.URLBlock(
        required=False,
        help_text=
        'If selected, this url will be used secondarily to the button page')

    class Meta:
        template = 'streams/button_block.html'
        icon = 'placeholder'
        label = 'Single Button'
        value_class = LinkStructValue
Example #8
0
class CTABlock(blocks.StructBlock):
    '''a smiple call to action section'''
    title=blocks.CharBlock(required=True,max_length=50)
    text=blocks.RichTextBlock(required=True,features=['bold','italic'])

    #internal
    button_page=blocks.PageChooserBlock(required=False)
    #external
    button_url=blocks.URLBlock(required=False)
    button_text=blocks.CharBlock(required=True,default='Learn MOre',max_length=40)

    class Meta:
        template='streams/cta_block.html'
        icon='placeholder'
        label='Call to action'
Example #9
0
class AsideLinkBlock(blocks.StructBlock):
    """Either a search or calendar link in a section aside"""
    link_type = blocks.ChoiceBlock(choices=[
        ('calculator', 'Calculator'),
        ('calendar', 'Calendar'),
        ('record', 'Record'),
        ('search', 'Search')
    ], icon='link', required=False, help_text='Set an icon')

    url = blocks.URLBlock()
    text = blocks.CharBlock(required=True)
    coming_soon = blocks.BooleanBlock(required=False)

    class Meta:
        icon = 'link'
Example #10
0
class ShowcasesBlock(blocks.StructBlock):
    title = blocks.CharBlock()
    subtitle = blocks.CharBlock(required=False)
    more_link = PageOrExternalLinkBlock(required=False)
    items = blocks.ListBlock(
        blocks.StructBlock((
            ("title", blocks.CharBlock()),
            ("subtitle", blocks.CharBlock(required=False)),
            ("link_url", blocks.URLBlock(required=False)),
            ("image", ImageChooserBlock()),
        )))

    class Meta:
        icon = "view"
        template = "core/blocks/showcases_block.html"
Example #11
0
class ButtonBlock(blocks.StructBlock):
    """Une URL interne ou externe """

    button_page = blocks.PageChooserBlock(
        required=False, help_text="If selected, this url will be used first")
    button_url = blocks.URLBlock(
        required=False,
        help_text=
        "If added, this url will be used secondarily to the button page")

    class Meta:
        template = "core/buton_block.html"
        icon = "placeholder"
        label = "Simple bouton"
        value_class = LinkStructValue
Example #12
0
class CardBlock(blocks.StructBlock):
    title = blocks.CharBlock(required=True, help_text="Add a 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)),
        ]))

    class Meta:
        template = "streams/card_block.html"
        icon = "placeholder"
        label = "Cards"
Example #13
0
class ConcertBlock(blocks.StructBlock):
    band_img = ImageChooserBlock(required=True)
    hidden = blocks.BooleanBlock(
        default=True,
        help_text=_(
            'If hidden box is checked, concert will not be displayed on'
            ' the page'),
        required=False)
    on_sale = blocks.BooleanBlock(
        default=True,
        help_text=_('If unchecked, Buy Tickets button will be grayed out'),
        required=False)
    virtual = blocks.BooleanBlock(default=False,
                                  help_text=_('Is this a virtual concert?'),
                                  required=False)
    canceled = blocks.BooleanBlock(default=False, required=False)
    postponed = blocks.BooleanBlock(default=False, required=False)
    sold_out = blocks.BooleanBlock(default=False, required=False)
    # Virtual concert will remain available on demand until this date
    available_until = blocks.DateTimeBlock(
        required=False,
        blank=True,
        null=True,
        help_text=_(
            'Date that on-demand virtual concert will remain available until'))
    # Band/opener names and url properties replaced with single RichTextField to account for wide variety in how the
    # bands info may be displayed
    band_info = blocks.RichTextBlock(help_text=_(
        'Provide the names of the bands/openers and any other info here. Text will be'
        ' centered.'))
    concert_dates = blocks.ListBlock(blocks.DateTimeBlock())
    gates_time = blocks.TimeBlock(default=datetime.time(hour=18),
                                  required=False,
                                  blank=True,
                                  null=True)
    show_time = blocks.TimeBlock(default=datetime.time(hour=19),
                                 required=False,
                                 blank=True,
                                 null=True)
    member_price = blocks.CharBlock(default='$',
                                    max_length=100,
                                    blank=True,
                                    null=True)
    public_price = blocks.CharBlock(default='$', max_length=100)

    # Added a ticket URL for concerts that are sold from a non-standard URL
    ticket_url = blocks.URLBlock(
        default='https://redbuttegarden.ticketfly.com')
Example #14
0
class TitleAndTextBlock(blocks.StructBlock):

    title = blocks.CharBlock(required=True,
                             validators=[check_for_title],
                             max_length=60)
    text = blocks.RichTextBlock(required=True, features=['p', 'bold', 'ol'])
    button_page = blocks.PageChooserBlock(required=False)
    button_url = blocks.URLBlock(required=False)
    button_text = blocks.CharBlock(required=True,
                                   default='Learn Wagtail',
                                   max_length=40)

    class Meta:
        template = "newapp/title_text.html"
        icon = "edit"
        lable = "titleandtext"
Example #15
0
class RecipeBlock(blocks.StructBlock):
    ingredients = blocks.ListBlock(
        blocks.StructBlock([
            ('ingredient', blocks.CharBlock()),
            ('amount', blocks.CharBlock(required=False)),
        ]))
    instructions = blocks.ListBlock(
        blocks.StructBlock([
            ('name', blocks.CharBlock(required=False)),
            ('text', blocks.CharBlock()),
            ('url', blocks.URLBlock(required=False)),
            ('image', ImageChooserBlock(required=False)),
        ]))

    class Meta:
        template = 'blocks/recipe.html'
Example #16
0
class CTABlock(blocks.StructBlock):
    """ A simple call to action section """
    title = blocks.CharBlock(required=True,
                             max_length=60,
                             help_text='Add your title')
    text = blocks.RichTextBlock(required=True, features=['bold', 'italic'])
    button_page = blocks.PageChooserBlock(required=False)
    button_url = blocks.URLBlock(required=False)
    button_text = blocks.CharBlock(required=True,
                                   default='Learn More',
                                   max_length=40)

    class Meta:  #noqa
        template = 'streams/cta_block.html'
        icon = 'placeholder'
        label = 'Call to Action'
Example #17
0
class ButtonBlock(blocks.StructBlock):
    """An external or internal URL."""

    button_page = blocks.PageChooserBlock(required=False, help_text='If selected, this url will be used first')
    button_url = blocks.URLBlock(required=False, help_text='If added, this url will be used secondarily to the button page')

    # def get_context(self, request, *args, **kwargs):
    #     context = super().get_context(request, *args, **kwargs)
    #     context['latest_posts'] = BlogDetailPage.objects.live().public()[:3]
    #     return context

    class Meta:  # noqa
        template = "streams/button_block.html"
        icon = "placeholder"
        label = "Single Button"
        value_class = LinkStructValue
Example #18
0
class LinkSignupBlock(blocks.StructBlock):
    heading = blocks.CharBlock(label="Überschrift", required=False)
    text = blocks.RichTextBlock(label="Text", required=False)

    url = blocks.URLBlock(label="Button-URL")
    button_text = blocks.CharBlock(label="Button Text")
    button_color = blocks.CharBlock(label="Button Farbe",
                                    required=False,
                                    default="#3a9d00")
    button_icon = ImageChooserBlock(label="Icon", required=False)
    button_hint = blocks.CharBlock(label="Button Hinweistext", required=False)

    class Meta:
        label = "Link-Anmeldung"
        icon = "form"
        template = "blocks/link_signup.html"
Example #19
0
class ActionAreaBlock(blocks.StructBlock):
    text = blocks.CharBlock(required=True, help_text='Add your title')
    image = ImageChooserBlock(required=False)
    button_page = blocks.PageChooserBlock(required=False)
    button_url = blocks.URLBlock(
        required=False,
        help_text=
        "If the button page above is selected, that will be used first.")
    button_text = blocks.CharBlock(required=False,
                                   default='Learn More',
                                   max_length=18)

    class Meta:
        template = "streams/action_area_block.html"
        icon = "doc-full-inverse"
        label = "Jumbotron - Text & Button"
Example #20
0
class CardBlock(blocks.StructBlock):
    title = blocks.CharBlock(required=False)

    cards = blocks.ListBlock(
        blocks.StructBlock([
            ("image", ImageChooserBlock(required=False)),
            ("title", blocks.CharBlock(required=False, max_length=40)),
            ("text", blocks.TextBlock(required=False, max_length=200)),
            ("button_page", blocks.PageChooserBlock(required=False)),
            ("button_url", blocks.URLBlock(required=False))
        ]))

    class Meta:
        template = 'streams/card_block.html'
        icon = 'placeholder'
        label = 'Staff Card'
Example #21
0
class CTABlock(blocks.StructBlock):
    """ A simple call to action section"""

    title = blocks.CharBlock(required=True, max_length=77)
    text = blocks.RichTextBlock(required=True,
                                features=["bold", "italic", "link"])
    button_page = blocks.PageChooserBlock(required=False)
    button_url = blocks.URLBlock(required=False)
    button_text = blocks.CharBlock(required=True,
                                   default="Learn More...",
                                   max_length=33)

    class Meta:
        template = "core/cta_block.html"
        icon = "placeholder"
        label = "Call to Action"
Example #22
0
class CTABlock(blocks.StructBlock):
    """Call to action section"""

    title = blocks.CharBlock(required=False, max_length=60)
    text = blocks.RichTextBlock(required=True, max_length=100)
    # can limit features if needed
    button_page = blocks.PageChooserBlock(required=False)
    button_url = blocks.URLBlock(required=False)
    button_text = blocks.CharBlock(required=True,
                                   default='Learn More',
                                   max_length=20)

    class Meta:  # noqa
        template = "streams/cta_block.html"
        icon = "placeholder"
        label = "Call to Action"
Example #23
0
class ExternalLinkBlock(BaseBlock):
    """
    Block for external links.
    """

    link = wagtail_blocks.URLBlock(label="URL")
    text = wagtail_blocks.CharBlock(label="Link text", required=False)
    style = wagtail_blocks.ChoiceBlock(label="Style",
                                       choices=LINK_STYLE_CHOICES,
                                       default="link",
                                       required=False)

    class Meta:
        label = "External link"
        icon = "link"
        template = "content/blocks/external_link.html"
Example #24
0
class ContributionsBlock(blocks.StructBlock):
    class Meta:
        template = "wagtail_resume/blocks/contributions_block.html"
        icon = "code"

    heading = blocks.CharBlock(default="Contributions")
    fa_icon = blocks.CharBlock(default="fas fa-code-branch")
    contributions = blocks.ListBlock(
        blocks.StructBlock(
            [
                ("title", blocks.CharBlock()),
                ("description", blocks.TextBlock()),
                ("url", blocks.URLBlock()),
            ],
            icon="folder-open-inverse",
        ))
Example #25
0
class VideoLink(blocks.StructBlock):
    url = blocks.URLBlock(label="URL",
                          required=True,
                          help_text="URL zu dem Video, auf das verlinkt wird")

    image = ImageChooserBlock(
        label="Bild (schwarz wenn nichts angegeben)",
        required=False,
    )

    caption = blocks.CharBlock(label="Bild-Unterschrift", required=False)

    class Meta:
        label = "Link zu Video"
        icon = "media"
        template = "blocks/video_link.html"
Example #26
0
class ButtonBlock(blocks.StructBlock):
    """An external or internal URL."""

    button_page = blocks.PageChooserBlock(
        required=False, help_text="if selected, this url will be used first"
    )
    button_url = blocks.URLBlock(
        required=False,
        help_text="if added, this url will be used second to the button page",
    )

    class Meta:  # noqa
        template = "streams/button_block.html"
        icon = "placeholder"
        label = "Single Button"
        value_class = LinkStructValue
Example #27
0
class LinkButtonBlock(blocks.StructBlock):
    lead_text = blocks.CharBlock(
        required=False,
        max_length=50,
        help_text="Text leading up the action text of the button.",
    )
    action_text = blocks.CharBlock(
        required=True,
        max_length=50,
        help_text="Emphasised text for the button action.",
    )
    link = blocks.URLBlock(required=True)

    class Meta:
        icon = "link"
        template = "services/blocks/link_button.html"
Example #28
0
class NotebookBlock(blocks.StructBlock):
    show_code = blocks.BooleanBlock(default=True)
    url = blocks.URLBlock(required=False)
    ipynb = blocks.StaticBlock()

    class Meta:
        label = 'Jupyter Notebook'
        icon = 'link-external'
        value_class = NotebookStructValue

    def clean(self, value):
        for name, val in value.items():
            if name == 'url':
                req = requests.get(val)
                value['ipynb'] = req.text
        return super().clean(value)
class LinkNoText(blocks.StructBlock):
    """A link struct block."""

    internal_link = blocks.PageChooserBlock(
        required=False,
        help_text='Select an internal page to link to. Internal links are used before external links (if both are provided).',
    )
    external_link = blocks.URLBlock(
        required=False,
        help_text='Type an external website to link to. Internal links are used before external links (if both are provided).',
    )

    class Meta:
        icon = "link"
        label = "Link"
        value_class = LinkValue
Example #30
0
class CardBlock(blocks.StructBlock):
    """Cards blocks from 1 or 5 card"""

    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=''))
        ]))

    class Meta:
        template = "patterns/molecules/streams/card_block.html"
        icon = "doc-full-inverse"
        label = "Card Block"