コード例 #1
0
ファイル: blocks.py プロジェクト: xr-web-de/xr-web
class EmailFormBlock(CollapsibleFieldsMixin, blocks.StructBlock):
    heading = blocks.CharBlock(**heading_block_kwargs)
    form_page = blocks.PageChooserBlock(
        ["xr_newsletter.EmailFormPage", "xr_newsletter.NewsletterFormPage"])
    font_color = blocks.ChoiceBlock(choices=COLOR_CHOICES,
                                    default=COLOR_XR_BLACK)
    background_color = blocks.ChoiceBlock(choices=BG_COLOR_CHOICES,
                                          default=COLOR_XR_TRANSPARENT)
    caption = blocks.CharBlock(**caption_block_kwargs)
    description = blocks.TextBlock(**description_block_kwargs)

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

    class Meta:
        icon = "form"
        template = "xr_newsletter/blocks/email_form.html"
コード例 #2
0
ファイル: blocks.py プロジェクト: ababic/newamerica-cms
class CustomImageBlock(blocks.StructBlock):
    image = ImageChooserBlock(icon="image", required=True)
    align = blocks.ChoiceBlock(choices=[('center', 'Centered'),
                                        ('left', 'Left'), ('right', 'Right')],
                               default='center',
                               required=True)
    width = blocks.ChoiceBlock([
        ('initial', 'Auto'),
        ('width-133', 'Medium'),
        ('width-166', 'Large'),
        ('width-200', 'X-Large'),
        ('width-full', 'Full-width'),
    ],
                               default="initial",
                               required=True)
    use_original = blocks.BooleanBlock(
        required=False,
        help_text=
        "check if you do not want image compressed. Should be checked for all figures."
    )
    figure_number = blocks.CharBlock(required=False, max_length=3)
    figure_title = blocks.CharBlock(required=False, max_length=100)
    open_image_on_click = blocks.BooleanBlock(default=False, required=False)

    class Meta:
        template = 'blocks/image_block.html'
コード例 #3
0
ファイル: blocks.py プロジェクト: xr-web-de/xr-web
class GridBlock(CollapsibleFieldsMixin, blocks.StructBlock):
    heading = blocks.CharBlock(**heading_block_kwargs)
    items = blocks.StreamBlock([
        ("teaser", TeaserBlock()),
        ("image", ImageBlock()),
        ("video", VideoBlock()),
        ("slogan", SloganBlock()),
    ])
    COLUMN_CHOICES = ((2, _("2")), (3, _("3")), (4, _("4")))
    columns = blocks.ChoiceBlock(choices=COLUMN_CHOICES, default=3)
    font_color = blocks.ChoiceBlock(choices=COLOR_CHOICES,
                                    default=COLOR_XR_BLACK)
    background_color = blocks.ChoiceBlock(choices=BG_COLOR_CHOICES,
                                          default=COLOR_XR_TRANSPARENT)

    fields = [
        "heading",
        "columns",
        "items",
        {
            "label": _("Settings"),
            "fields": ["align", "font_color", "background_color"]
        },
    ]

    class Meta:
        icon = "grip"
        template = "xr_pages/blocks/grid.html"
コード例 #4
0
class StyledTextBlock(blocks.StructBlock):
    TEXT_ALIGN_CHOICES = (
        ('left', 'Left'),
        ('center', 'Center'),
        ('right', 'Right'),
    )

    FONT_SIZE_CHOICES = (
        ('small', 'Small'),
        ('normal', 'Normal'),
        ('large', 'Large'),
        ('jumbo', 'Jumbo'),
    )

    FONT_FAMILY_CHOICES = (
        ('sans-serif', 'Sans Serif'),
        ('serif', 'Serif'),
    )

    text = blocks.RichTextBlock()
    background_color = blocks.ChoiceBlock(choices=BACKGROUND_COLOR_CHOICES, default='white')
    text_align = blocks.ChoiceBlock(choices=TEXT_ALIGN_CHOICES, default='left')
    font_size = blocks.ChoiceBlock(choices=FONT_SIZE_CHOICES, default='normal')
    font_family = blocks.ChoiceBlock(choices=FONT_FAMILY_CHOICES, default='sans-serif')

    class Meta:
        template = 'common/blocks/styled_text.html'
        icon = 'doc-full'
        label = 'Styled Text Block'
コード例 #5
0
ファイル: blocks.py プロジェクト: ampstat/wagtail-jetstream
class ColorOptionsBlock(blocks.StructBlock):
    background_image = ImageChooserBlock(
        required=False,
        help_text="This image, if supplied, will appear as a background for this block"
    )
    background_color = blocks.ChoiceBlock(
        choices=BACKGROUND_COLORS,
        blank=False,
        required=False,
        default=BACKGROUND_COLORS[0],
        help_text="Set the background color of this block.  If a Background Image is also supplied, the Background "
                  "Image will be displayed instead of this color"
    )
    text_color = blocks.ChoiceBlock(
        choices=FOREGROUND_COLORS,
        blank=False,
        required=False,
        default=FOREGROUND_COLORS[0],
        help_text="Set the color for the text in this block. This is here so you can make your text visible on both "
                  "light and dark backgrounds."
    )

    class Meta:
        form_classname = 'color-options struct-block'
        # Don't display a label for this block. Our override of wagtailadmin/block_forms/struct.html obeys this flag.
        no_label = True
コード例 #6
0
class HeatmapPlotBlock(BaseHeatmapPlotBlock):
    """
    Basic heatmap plot
    """
    colorscale = blocks.ChoiceBlock(
        required=False,
        choices=COLORSCALE_CHOICES,
        help_text='Sets the colorscale',
    )

    reversescale = blocks.BooleanBlock(
        required=False,
        help_text='Reverse the colorscale',
    )

    zsmooth = blocks.ChoiceBlock(
        required=False,
        choices=ZSMOOTH_CHOICES,
        help_text='Picks a smoothing algorithm use to smooth z data',
    )

    layout = LayoutChooserBlock(required=False)

    def get_trace_fields(self):
        return ['colorscale', 'reversescale', 'zsmooth']
コード例 #7
0
class WhoIsThere(blocks.StructBlock):

    title = blocks.CharBlock(required=False, max_length=255)
    color = blocks.CharBlock(required=True, max_length=255)

    attendees = blocks.StreamBlock(
        [
            ('attendee',
             blocks.StructBlock(
                 [('name', blocks.CharBlock()),
                  ('nickname', blocks.CharBlock()),
                  ('company', blocks.CharBlock()),
                  ('dates', blocks.CharBlock()), ('sure', blocks.CharBlock()),
                  ('remote', blocks.CharBlock()),
                  ('tshirt',
                   blocks.ChoiceBlock(choices=[('xxs', 'xxs'), (
                       'xs', 'xs'), ('s', 's'), ('m', 'm'), (
                           'l', 'l'), ('xl', 'xl'), ('xxl', 'xxl')])),
                  ('food',
                   blocks.ChoiceBlock(choices=[(
                       'normal', 'normal'), ('vegie',
                                             'vegie'), ('other', 'other')])),
                  ('email', blocks.CharBlock(required=False)),
                  ('comment', blocks.CharBlock(required=False))],
                 template='home/blocks/attendee_content.html')),
        ],
        icon='cogs',
    )

    class Meta:
        template = 'home/who_column_block.html'
        icon = 'placeholder'
        label = 'WHOS THERE'
コード例 #8
0
ファイル: blocks.py プロジェクト: nickmoreton/nhsx-website
class PromoGroupBlock(FlattenValueContext, blocks.StructBlock):
    class Meta:
        template = "wagtailnhsukfrontend/promo_group.html"

    column = blocks.ChoiceBlock(
        [("one-half", "One-half"), ("one-third", "One-third"),],
        default="one-half",
        required=True,
    )

    size = blocks.ChoiceBlock([("", "Default"), ("small", "Small"),], required=False)

    def get_context(self, value, parent_context=None):
        context = super().get_context(value, parent_context)
        context["num_columns"] = {"one-half": 2, "one-third": 3,}[value["column"]]
        return context

    heading_level = blocks.IntegerBlock(
        min_value=2,
        max_value=4,
        default=3,
        help_text="The heading level affects users with screen readers. Default=3, Min=2, Max=4.",
    )

    promos = blocks.ListBlock(BasePromoBlock)
コード例 #9
0
class GoogleCalendarBlock(blocks.StructBlock):
    calendars = blocks.ListBlock(blocks.StructBlock([
        ('source', blocks.CharBlock(
            help_text=_('Calendar ID as given by google calendar'),
        )),
        ('color', ColorBlock()),
    ]))
    mode = blocks.ChoiceBlock(choices=[
        ('WEEK', _('Week')),
        ('', _('Month')),
        ('AGENDA', _('Agenda')),
    ], required=False)
    height = blocks.IntegerBlock()
    background_color = ColorBlock()
    week_start = blocks.ChoiceBlock(choices=[
        ('2', _('Monday')),
        ('1', _('Sunday')),
        ('7', _('Saturday')),
    ])

    class Meta:
        label = _('Google Calendar')
        icon = 'fa-calendar'
        template = 'google/blocks/calendar.html'
        group = _('Embed')
コード例 #10
0
class StructuredDataActionBlock(blocks.StructBlock):
    """
    Action object from schema.org
    """
    action_type = blocks.ChoiceBlock(verbose_name=_('Action Type'),
                                     required=True,
                                     choices=schema.SCHEMA_ACTION_CHOICES)
    target = blocks.URLBlock(verbose_name=_('Target URL'))
    language = blocks.CharBlock(
        verbose_name=_('Language'),
        help_text=
        _('If the action is offered in multiple languages, create separate actions for each language.'
          ),  # noqa
        default='en-US')
    result_type = blocks.ChoiceBlock(
        required=False,
        verbose_name=_('Result Type'),
        help_text=_('Leave blank for OrderAction'),
        choices=schema.SCHEMA_RESULT_CHOICES)
    result_name = blocks.CharBlock(
        required=False,
        verbose_name=_('Result Name'),
        help_text=_('Example: "Reserve a table", "Book an appointment", etc.'))
    extra_json = blocks.RawHTMLBlock(
        required=False,
        verbose_name=_('Additional action markup'),
        classname='monospace',
        help_text=
        _("Additional JSON-LD inserted into the Action dictionary. Must be properties of https://schema.org/Action."  # noqa
          ))

    class Meta:
        template = 'coderedcms/blocks/struct_data_action.json'
        label = _('Action')
コード例 #11
0
ファイル: models.py プロジェクト: chongeva/flatwhite
class CoverSectionBlock(blocks.StructBlock):
    image = ImageChooserBlock()
    image_position = blocks.ChoiceBlock(choices=[
        ('left top', 'Left Top'),
        ('left center', 'Left Center'),
        ('left bottom', 'Left Bottom'),
        ('right top', 'Right Top'),
        ('right center', 'Right Center'),
        ('right bottom', 'Right Bottom'),
        ('center top', 'Center Top'),
        ('center center', 'Center Center'),
        ('center bottom', 'Center Bottom'),
    ],
                                        icon='edit',
                                        required=False)
    image_size = blocks.ChoiceBlock(choices=[
        ('cover', 'Full Cover'),
        ('half', 'Half'),
    ],
                                    icon='edit',
                                    required=False)
    background_colour = blocks.CharBlock(required=False)
    description = blocks.RichTextBlock()
    text_align = blocks.ChoiceBlock(choices=[
        ('left', 'Left'),
        ('center', 'Center'),
        ('right', 'Right'),
    ],
                                    icon='edit')

    class Meta:
        icon = 'placeholder'
コード例 #12
0
ファイル: blocks.py プロジェクト: Zerokami/uwkm_streamfields
class BackgroundBlock(blocks.StructBlock):
    type_field = blocks.ChoiceBlock(choices=(
        ('parallaxBg', 'Parallax'),
        ('fixedBg', 'Stilstaand'),
    ))
    background_image = ImageChooserBlock(
        label='Afbeelding',
        help_text='Het achtergrondplaatje van het blok.',
    )
    block_height = blocks.IntegerBlock(
        label='Hoogte',
        help_text='Hoogte van het blok in pixels.',
        min_value=0,
        max_value=999,
        default=250,
    )
    columns = blocks.ChoiceBlock(
        label='Kolommen',
        choices=[('2', 'Twee'), ('1', 'Een')],
        default='2',
    )
    text_left = blocks.RichTextBlock(
        label='Tekst links',
        help_text='Tekst aan de linkerkant op de achtergrond.',
        required=False,
    )
    text_right = blocks.RichTextBlock(
        label='Tekst rechts',
        help_text='Tekst aan de rechterkant op de achtergrond.',
        required=False,
    )
    text_color = ColorPickerBlock(
        label='Kleur tekst',
        required=False,
    )
コード例 #13
0
class CTABlock(blocks.StructBlock, ThemeableBlock):
    class CTAText(models.TextChoices):
        DOWNLOAD = ('Download', 'Download')
        DOWNLOAD_PDF = ('Download PDF', 'Download PDF')
        EXPLORE_SERIES = ('Explore Series', 'Explore Series')

    class CTAIcon(models.TextChoices):
        NO_ICON = ('', 'No Icon')
        DOWNLOAD = ('fas fa-download', 'Download')
        POINTER = ('fas fa-mouse-pointer', 'Pointer')

    file = DocumentChooserBlock(required=False)
    link = blocks.CharBlock(
        required=False,
        help_text="This will only work if no file is uploaded.")
    button_text = blocks.ChoiceBlock(required=False,
                                     choices=CTAText.choices,
                                     max_length=32)
    button_icon = blocks.ChoiceBlock(required=False,
                                     choices=CTAIcon.choices,
                                     default=CTAIcon.NO_ICON,
                                     max_length=32)

    def get_template(self, context, *args, **kwargs):
        standard_template = super(CTABlock,
                                  self).get_template(context, *args, **kwargs)
        return self.get_theme_template(standard_template, context, 'cta_block')

    class Meta:
        icon = 'view'
        label = 'Call to Action'
コード例 #14
0
ファイル: models.py プロジェクト: Ecotrust/wcoa
class CTAStreamBlock(blocks.StructBlock):
    cta_title = blocks.CharBlock(required=False)
    cta_content = blocks.RichTextBlock(required=False)
    cta_page = blocks.PageChooserBlock(label="page", required=False)
    cta_link = blocks.URLBlock(label="URL",required=False)
    # Width would be better as a CoiceBlock
    width = blocks.IntegerBlock(required=False,max_value=12,min_value=0,help_text="Number of columns to span out of 12 (e.g., input of 3 would mean give this a width of 3 out of the 12 (25%))")
    text_color = blocks.ChoiceBlock(choices=[
        ('white', 'White'),
        ('black', 'Black'),
        ('blue', 'Blue'),
        ('green', 'Green'),
        ('red', 'Red'),
        ('purple', 'Purple'),
        ('grey', 'Grey'),
    ], icon='color_palette', required=False)
    background_color = blocks.ChoiceBlock(choices=[
        ('white', 'White'),
        ('black', 'Black'),
        ('blue', 'Blue'),
        ('green', 'Green'),
        ('red', 'Red'),
        ('purple', 'Purple'),
        ('grey', 'Grey'),
    ], icon='color', required=False)
    background_image = ImageChooserBlock(required=False)

    class Meta:
        icon = 'form'
        value_class = LinkStructValue
コード例 #15
0
class TwoColumnBlock(blocks.StructBlock):
    """Struct block for two columns section"""

    background_color = blocks.ChoiceBlock(choices=ColorChoices.choices)
    text_color = blocks.ChoiceBlock(choices=TextColorChoices.choices)
    left = blocks.StreamBlock(
        [
            ("simple_card", CardSimpleBlock()),
            ("detail_card", CardDetailBlock()),
            ("icon_bullets", IconBulletBlock()),
            ("rich_text", blocks.RichTextBlock()),
        ],
        min_num=1,
    )
    right = blocks.StreamBlock(
        [
            ("simple_card", CardSimpleBlock()),
            ("detail_card", CardDetailBlock()),
            ("icon_bullets", IconBulletBlock()),
            ("rich_text", blocks.RichTextBlock()),
        ],
        min_num=1,
    )

    class Meta:
        template = "pages/blocks/layout/two_columns_block.html"
コード例 #16
0
ファイル: blocks.py プロジェクト: octoberclub/nhsx-website
class PromoGroupBlock(FlattenValueContext, blocks.StructBlock):

    class Meta:
        template = 'wagtailnhsukfrontend/promo_group.html'

    column = blocks.ChoiceBlock([
        ('one-half', 'One-half'),
        ('one-third', 'One-third'),
    ], default='one-half', required=True)

    size = blocks.ChoiceBlock([
        ('', 'Default'),
        ('small', 'Small'),
    ], required=False)

    def get_context(self, value, parent_context=None):
        context = super().get_context(value, parent_context)
        context['num_columns'] = {
            'one-half': 2,
            'one-third': 3,
        }[value['column']]
        return context

    heading_level = blocks.IntegerBlock(
        min_value=2,
        max_value=4,
        default=3,
        help_text='The heading level affects users with screen readers. Default=3, Min=2, Max=4.'
    )

    promos = blocks.ListBlock(BasePromoBlock)
コード例 #17
0
ファイル: blocks.py プロジェクト: nickmoreton/nhsx-website
class CaseStudyBlock(blocks.StructBlock):
    heading = blocks.CharBlock(required=False)
    heading_level = blocks.IntegerBlock(
        min_value=2,
        max_value=4,
        default=3,
        help_text="The heading level affects users with screen readers. Default=3, Min=2, Max=4.",
    )
    column = blocks.ChoiceBlock(
        [("one-half", "One-half"), ("one-third", "One-third"),],
        default="one-third",
        required=True,
    )
    tag_id = blocks.ChoiceBlock(choices=get_casestudy_tag_list, required=True)

    def get_context(self, value, parent_context=None):
        context = super().get_context(value, parent_context=parent_context)
        context["num_columns"] = {"one-half": 2, "one-third": 3,}[value["column"]]
        value["tag"] = CaseStudyTag.objects.get(id=value["tag_id"])
        value["items"] = self._get_items(value["tag_id"], 99)
        context.update(value)
        return context

    class Meta:
        abstract = True
コード例 #18
0
ファイル: blocks.py プロジェクト: rosamundm/rosederwelt-blog
class PicBlock(StructBlock):
    image = ImageChooserBlock(label=_("Image"))
    caption = CharBlock(required=False, label=_("Caption"))
    float = blocks.ChoiceBlock(
        required=False,
        choices=[
            ("right", _("Right")),
            ("left", _("Left")),
            ("center", _("Center")),
        ],
        default="center",
        label=_("Float"),
    )
    size = blocks.ChoiceBlock(
        required=False,
        choices=[
            ("small", _("Small")),
            ("medium", _("Medium")),
            ("large", _("Large")),
        ],
        default="medium",
        label=_("Size"),
    )

    class Meta:
        icon = "image"
コード例 #19
0
ファイル: shelves.py プロジェクト: danmorley/nhs-example
class StandardTwoColumnShelf(TwoColumnShelf):
    meta_layout = blocks.ChoiceBlock(choices=TWO_COLUMNS_LAYOUT_CHOICES, label='Layout')
    meta_variant = blocks.ChoiceBlock(choices=TWO_COLUMNS_VARIANT_CHOICES,
                                        default='standard',
                                        label='Variant',
                                        classname='dct-meta-field')
    
    class Meta:
        verbose_name = 'two column'
コード例 #20
0
ファイル: blocks.py プロジェクト: ampstat/wagtail-jetstream
class HeroImageBlock(blocks.StructBlock, BlockTupleMixin):

    style = blocks.ChoiceBlock(
        choices=[
            ('regular-width', 'Regular Width'),
            ('full-width', 'Full Width')
        ],
        default='regular-width',
        label='Overall style',
        help_text=('Regular Width fills the normal page area. '
                   'Full Width fills the entire width of the browser. Shorter images will be tiled.')
    )
    text_style = blocks.ChoiceBlock(
        choices=[
            ('bare-serif', 'Bare text w/ serif font'),
            ('bare-sans-serif', 'Bare text w/ sans-serif font'),
            ('white-translucent-serif', 'White translucent background behind serif text'),
            ('white-translucent-sans-serif', 'White translucent background behind sans-serif text'),
        ],
        default='white-translucent-serif',
        label='Text style'
    )
    image = ImageChooserBlock()
    title = blocks.CharBlock(required=False)
    desc = blocks.RichTextBlock(
        required=False,
        label='Text'
    )
    height = blocks.IntegerBlock(
        default=500,
        label='Height (pixels)'
    )
    position = blocks.ChoiceBlock(
        choices=[
            ('position-top-left', 'Top Left'),
            ('position-top-middle', 'Top Middle'),
            ('position-top-right', 'Top Right'),
            ('position-left', 'Left'),
            ('position-middle', 'Middle'),
            ('position-right', 'Right'),
            ('position-bottom-left', 'Bottom Left'),
            ('position-bottom-middle', 'Bottom Middle'),
            ('position-bottom-right', 'Bottom Right'),
        ],
        default='position-middle',
        label='Text Position'
    )
    actions = ActionButtonBarBlock(
        label='Action Buttons',
        required=False
    )

    class Meta:
        label = 'Hero Image'
        template = 'jetstream/blocks/hero_image_block.html'
        form_classname = 'hero-image struct-block'
        icon = 'image'
コード例 #21
0
class StandardInformationPanel(InformationPanel):
    meta_variant = blocks.ChoiceBlock(choices=INFO_PANEL_VARIANTS,
                                      label='Variant',
                                      classname='dct-meta-field')
    meta_layout = blocks.ChoiceBlock(choices=INFO_PANEL_LAYOUTS,
                                     label='Layout',
                                     classname='dct-meta-field')

    class Meta:
        verbose_name = 'information panel'
コード例 #22
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'
コード例 #23
0
ファイル: blocks.py プロジェクト: Zerokami/uwkm_streamfields
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,
    )
コード例 #24
0
class ContactFormBlock(blocks.StructBlock):
    body = blocks.RichTextBlock()
    form_heading = blocks.CharBlock(required=False)
    subject = blocks.ChoiceBlock(ContactForm.declared_fields['subject'].choices)
    recruitment_type = blocks.ChoiceBlock(
        ContactForm.declared_fields['recruitment_type'].choices,
        help_text=_("w przypadku formularza rekrutacyjnego to pole definiuje adres, na który wysyłane są zgłoszenia"),
    )

    class Meta:
        template = 'main/blocks/contact_form.html'
コード例 #25
0
ファイル: blocks.py プロジェクト: linahanner/xr-web
class MessageBlock(blocks.StructBlock):
    message = TextBlock()
    font_size_factor = blocks.FloatBlock(default=1)
    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)
    link = LinkBlock()

    class Meta:
        icon = "openquote"
        template = "xr_pages/blocks/message.html"
コード例 #26
0
class LiveChannelBlock(blocks.StructBlock):
    start = blocks.DateTimeBlock()
    end = blocks.DateTimeBlock(reqired=False)
    cid = blocks.CharBlock("Channel ID", max_length=255)
    wid = blocks.CharBlock("Watch ID", max_length=255, reqired=False)
    vendor = blocks.ChoiceBlock(choices=LiveVendor.choices)
    channel_type = blocks.ChoiceBlock(choices=ChannelType.choices)
    token = blocks.CharBlock(max_length=255, reqired=False)

    class Meta:
        icon = 'view'
        value_class = LiveChannelStructValue
        form_template = 'block_forms/live_channel.html'
コード例 #27
0
ファイル: shelves.py プロジェクト: danmorley/nhs-example
class StandardGridShelf(GridShelf, WithTracking):
    meta_variant = blocks.ChoiceBlock(choices=GRID_VARIANT_CHOICES,
                                    default='standard',
                                    label='Variant',
                                    classname='dct-meta-field')
    
    meta_layout = blocks.ChoiceBlock(choices=GRID_LAYOUT_CHOICES,
                                     default='full_width',
                                     label='Layout',
                                     help_text='Use this to select number of columns on desktop (only one column'
                                               ' on mobile)', classname='dct-meta-field')

    class Meta:
        form_classname = 'dct-grid-shelf dct-meta-panel'
コード例 #28
0
ファイル: blocks.py プロジェクト: Zerokami/uwkm_streamfields
class TableStructBlock(blocks.StructBlock):
    type_table = blocks.ChoiceBlock(
        choices=[(' ', 'Gewone tabel'), ('price-table', 'Prijs tabel')],
        label='Type tabel',
    )
    table_borders = blocks.ChoiceBlock(choices=[
        ('no-borders', 'Geen lijnen'),
        ('column-borders', 'Kolom lijnen'),
        ('row-borders', 'Regel lijnen'),
        ('all-borders', 'Kolom en regel lijnen'),
    ],
                                       label='Tabel lijnen')
    table_header_rows = blocks.IntegerBlock(
        label='Tabelheaderrijen',
        min_value=0,
        max_value=100,
        default=2,
    )
    table_footer_rows = blocks.IntegerBlock(
        label='Tabelfooterrijen',
        min_value=0,
        max_value=100,
        default=2,
    )
    table_header_background = ColorPickerBlock(
        label='Tabelheader achtergrondkleur',
        required=False,
    )
    table_header_color = ColorPickerBlock(
        label='Tabelheader tekstkleur',
        required=False,
    )
    table_header_text_size = blocks.IntegerBlock(
        label='Tabelheader grootte tekst',
        help_text='Tabelheader grootte van de tekst.',
        min_value=1,
        max_value=100,
        default=20,
    )
    table_footer_background = ColorPickerBlock(
        label='Tabelfooter achtergrondkleur',
        required=False,
    )
    table_footer_color = ColorPickerBlock(
        label='Tabelfooter tekstkleur',
        required=False,
    )
    table = TableBlock(table_options=TABLE_OPTIONS,
                       label='Tabel',
                       help_text='HTML is mogelijk in de tabel')
コード例 #29
0
ファイル: blocks.py プロジェクト: Dave3o3/xr-web
class TitleBlock(CollapsibleFieldsMixin, blocks.StructBlock):
    title = blocks.CharBlock()
    font_color = blocks.ChoiceBlock(choices=COLOR_CHOICES, default=COLOR_XR_BLACK)
    ALIGN_CHOICES = ((ALIGN_CENTER, _("Center")), (ALIGN_LEFT, _("Left")))
    align = blocks.ChoiceBlock(
        choices=ALIGN_CHOICES,
        default=ALIGN_LEFT,
        help_text=_("Choose the alignment of the block."),
    )

    fields = ["title", {"label": _("Appearance"), "fields": ["align", "font_color"]}]

    class Meta:
        icon = "title"
        template = "xr_pages/blocks/title.html"
コード例 #30
0
class LinePlotBlock(BaseLinePlotBlock):
    """
    Basic line plot with common x axis values
    """
    mode = blocks.ChoiceBlock(default='lines', choices=MODE_CHOICES)
    fill = blocks.ChoiceBlock(default='none', choices=PLOT_FILL_CHOICES)
    line_shape = blocks.ChoiceBlock(default='linear',
                                    choices=LINE_SHAPE_CHOICES)
    line_width = blocks.IntegerBlock(default=2, min_value=1, max_value=5)
    marker_size = blocks.IntegerBlock(default=6, min_value=1, max_value=40)

    layout = LayoutChooserBlock(required=False)

    def get_trace_fields(self):
        return ['mode', 'fill', 'line_shape', 'line_width', 'marker_size']