class AsciinemaBlock(blocks.StructBlock): FONT_SIZE = ( ('small', _('small')), ('medium', _('medium')), ('big', _('big')), ) THEME = ( ('asciinema', ) * 2, ('tango', ) * 2, ('solarized-dark', ) * 2, ('solarized-light', ) * 2, ('monokai', ) * 2, ) title = blocks.CharBlock(required=False) poster = blocks.CharBlock( required=False, default='npt:0:0', help_text=_('npt:2:34 || data:text/plain,Poster text')) document = DocumentChooserBlock(required=True) font_size = blocks.ChoiceBlock(FONT_SIZE, default='small') theme = blocks.ChoiceBlock(THEME, default='monokai') speed = blocks.IntegerBlock(default=1, min_value=1) start_at = blocks.CharBlock(default='0', help_text=_('123, mm:ss, hh:mm:ss')) cols = blocks.IntegerBlock(default=0, min_value=0, max_value=1024) rows = blocks.IntegerBlock(default=5, min_value=0, max_value=1024) loop = blocks.BooleanBlock(default=False, required=False) preload = blocks.BooleanBlock(default=False, required=False) autoplay = blocks.BooleanBlock(default=False, required=False) class Meta: icon = 'media' template = 'wagtail_asciinema/blocks/asciinema_block.html'
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' )
class TableStructBlock(blocks.StructBlock): type_table = blocks.ChoiceBlock( choices = [(' ', 'Ordinary table'), ('price-table', 'Price table')], label=_('Type table'), ) table_borders = blocks.ChoiceBlock( choices = [ ('no-borders', 'No lines'), ('column-borders', 'Column lines'), ('row-borders', 'Now lines'), ('all-borders', 'Column and line lines'), ], label=_('Table lines') ) table_header_rows = blocks.IntegerBlock( label = _('Table header'), min_value = 0, max_value = 100, default = 2, ) table_footer_rows = blocks.IntegerBlock( label = _('Table footer'), min_value = 0, max_value = 100, default = 2, ) table_header_background = ColorPickerBlock( label = _('Table header background'), required = False, ) table_header_color = ColorPickerBlock( label = _('Table header color'), required = False, ) table_header_text_size = blocks.IntegerBlock( label = _('Table header size text'), help_text = 'Table header size of the text.', min_value = 1, max_value = 100, default = 20, ) table_footer_background = ColorPickerBlock( label = _('Table footer background color'), required = False, ) table_footer_color = ColorPickerBlock( label = _('Table footer color'), required = False, ) table = TableBlock( label=_('Tabel'), table_options=TABLE_OPTIONS, help_text='HTML is possible in the table' )
class ButtonBlock(blocks.StructBlock): button_color = ColorPickerBlock( label = 'Achtergrondkleur kiezer', help_text = 'De kleur van de achtergrond.', required = False, ) color = ColorPickerBlock( label = 'Fontkleur kiezer', help_text = 'De kleur van de tekst.', required = False, ) icon = IconChoiceBlock( label = 'Icoon', help_text = 'Icoon op de knop. (Font awesome)', required = False, ) icon_size = blocks.IntegerBlock( label = 'Icoon grootte', help_text = 'Grootte van de icoon op de knop. (in pixels)', default = 14, ) text = blocks.CharBlock( label = 'Tekst', max_length = 50, help_text = 'Tekst op de knop.', ) text_size = blocks.IntegerBlock( label = 'Tekst grootte', help_text = 'Grootte van de tekst op de knop. (in pixels)', default = 14, ) width = blocks.ChoiceBlock( label = 'Breedte', choices = [ (' ', 'Automatisch'), ('btn-block', '100%'), ] ) link = blocks.PageChooserBlock( label = 'Link', can_choose_root = True, required= False, help_text="Kies een van de twee: link / externe link." ) ext_link = blocks.CharBlock( label='Externe link', max_length = 255, required = False, help_text="Kies een van de twee: link / externe link." )
class ButtonBlock(blocks.StructBlock): button_color = ColorPickerBlock( label = _('Background color picker'), help_text = 'The color of the background.', required = False, ) color = ColorPickerBlock( label = _('Font color selector'), help_text = 'The color of the text.', required = False, ) icon = IconChoiceBlock( label = _('Icon'), help_text = 'Icon on the button.. (Font awesome)', required = False, ) icon_size = blocks.IntegerBlock( label = _('Icon size'), help_text = 'Size of the icon on the button. (in pixels)', default = 14, ) text = blocks.CharBlock( label = _('Text'), max_length = 50, help_text = 'Tekst op de knop.', ) text_size = blocks.IntegerBlock( label = _('Text Size'), help_text = 'Size of the text on the button. (in pixels)', default = 14, ) width = blocks.ChoiceBlock( label = _('Width'), choices = [ (' ', 'Automatically'), ('btn-block', '100%'), ] ) link = blocks.PageChooserBlock( label = _('Link'), can_choose_root = True, required= False, help_text="Choose one of the two: link / external link." ) ext_link = blocks.CharBlock( label='Externe link', max_length = 255, required = False, help_text="Choose one of the two: link / external link." )
class CoworkerBlock(blocks.StructBlock): name = blocks.CharBlock(max_length=255, blank=True) roepnaam = blocks.CharBlock(max_length=255, null=True, blank=True) job_function = blocks.CharBlock(max_length=255, blank=True, null=True) address = blocks.CharBlock( max_length=255, blank=True, null=True, required=False, ) email = blocks.EmailBlock( max_length=254, blank=True, null=True, required=False, ) phone = blocks.CharBlock( max_length=255, blank=True, null=True, required=False, ) linkedin = blocks.URLBlock( max_length=200, blank=True, null=True, required=False, ) positions = blocks.IntegerBlock(default=1) image = ImageChooserBlock()
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, )
class TextAreaBlock(blocks.StructBlock): label = blocks.CharBlock(label=_('Label'), max_length=255, required=False, help_text=_('The text displayed aside the field')) required = blocks.BooleanBlock(label=_('Required'), default=True, required=False) rows = blocks.IntegerBlock(label=_('Rows'), default=3, required=True) attribute = blocks.CharBlock( label=_('Attribute'), max_length=255, required=True, default='message', help_text=_('The attribute used for transactional template')) placeholder = blocks.CharBlock( label=_('Placeholder'), max_length=255, required=False, help_text=_('The text displayed inside the field when empty')) class Meta: label = _('SendInBlue textarea') icon = 'placeholder' template = 'sendinblue/blocks/textarea.html' def get_context(self, value): context = super().get_context(value) context['textarea'] = value return context
class SocialFeedBlock(blocks.StructBlock): feedconfig = FeedChooserBlock( required=False, help_text= _("Select a feed configuration to show. Leave blank to show a mix of all the feeds" )) limit = blocks.IntegerBlock(required=False, min_value=0) class Meta: icon = 'icon icon-fa-rss' template = 'wagtailsocialfeed/social_feed_block.html' def get_context(self, value): context = super(SocialFeedBlock, self).get_context(value) feedconfig = value['feedconfig'] feed = None if feedconfig: feed = get_feed_items(feedconfig, limit=value['limit']) else: feed = get_feed_items_mix(SocialFeedConfiguration.objects.all(), limit=value['limit']) context['feed'] = feed return context
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')
class MyTestPage(Page): body = StreamField([ ('char_array', blocks.ListBlock(blocks.CharBlock())), ('int_array', blocks.ListBlock(blocks.IntegerBlock())), ('struct', MyBlock()), ('image', ImageChooserBlock()), ])
class QuestionBlock(blocks.StructBlock): title = blocks.CharBlock(label='Вопрос') counter = blocks.IntegerBlock( label='Счетчик', default=0, help_text= 'Внимание! Голоса могут увеличиваться во время редактирования опубликованной статьи' )
class IPhoneAppBlock(blocks.StructBlock): """Twitter iPhone App Twitter Card specifications""" name = blocks.CharBlock(max_length=255) id = blocks.IntegerBlock() url = blocks.CharBlock(max_length=255, required=False) class Meta: template = 'wagtailseo/cards/apps/iphone.html'
class GoogleFormBlock(blocks.StructBlock): form_id = blocks.CharBlock() height = blocks.IntegerBlock() class Meta: label = _('Google Form') icon = 'fa-check-square-o' template = 'google/blocks/form.html' group = _('Embed')
class SliderBlock(blocks.StructBlock): slider_delay = blocks.IntegerBlock( required=False, help_text="Enter the milliseconds of the delay between each slide") slider_items = blocks.ListBlock(SliderItemBlock()) class Meta: template = "blocks/slider_block.html" icon = "image"
class DividerBlock(blocks.StructBlock): border_color = ColorPickerBlock( label='Divider', help_text='Lijn kleur.', ) border_width = blocks.IntegerBlock( default=2, min_value=1, max_value=50, help_text="De dikte van de horizontal lijn.", label="Dikte")
class ChartDataset(blocks.StructBlock): label = blocks.CharBlock( label='Dataset Label', max_length=120, default='Dataset #1', ) dataset_data = blocks.ListBlock( blocks.IntegerBlock(), label='Data', default='0', )
class ResponsiveImageBlock(blocks.StructBlock): image = ImageChooserBlock() height = blocks.IntegerBlock( min_value=1, default=400, ) class Meta: label = _('Responsive Image') icon = 'fa-picture-o' template = 'blocks/image.html' group = _('Basic')
class WidthBlock(blocks.StructBlock): width = blocks.IntegerBlock( min_value=1, max_value=5, help_text="How many grid columns to occupy in rendered template") content = blocks.StreamBlock([ ('rich_text', blocks.RichTextBlock()), ('raw_html', blocks.RawHTMLBlock()), ('image', image_blocks.ImageChooserBlock()), ], min_num=1, max_num=1)
class DividerBlock(blocks.StructBlock): border_color = ColorPickerBlock( label = _('Divider'), help_text = 'Line color.', ) border_width = blocks.IntegerBlock( label=_("Thckness"), default=2, min_value=1, max_value=50, help_text="The thickness of the horizontal line.", )
class PersonBlock(blocks.StructBlock): name = blocks.CharBlock() height = blocks.DecimalBlock() age = blocks.IntegerBlock() email = blocks.EmailBlock() # def get_context(self, value, parent_context=None): # context = super(PersonBlock, self).get_context(value, parent_context=parent_context) # return context class Meta: template = 'blocks/person_block.html'
class GoogleMapsBlock(blocks.StructBlock): address = blocks.TextBlock( label = 'Adres', help_text = 'Adres, plaats, land', required = False, ) height = blocks.IntegerBlock( label = 'Hoogte', help_text = 'Hoogte van het blok in pixels.', min_value = 0, max_value = 999, default = 250, )
class GoogleMapsBlock(blocks.StructBlock): address = blocks.TextBlock( label = _('Address'), help_text = 'Address, place, country', required = False, ) height = blocks.IntegerBlock( label = _('Height'), help_text = 'Height of the block in pixels.', min_value = 0, max_value = 999, default = 250, )
class GoogleDriveBlock(blocks.StructBlock): folder_id = blocks.CharBlock() view = blocks.ChoiceBlock(choices=[ ('list', _('List')), ('grid', _('Grid')), ]) height = blocks.IntegerBlock() class Meta: label = _('Google Drive') icon = 'fa-folder-open' template = 'google/blocks/drive.html' group = _('Embed')
class ParagraphBlock(blocks.StructBlock): text_alignment = blocks.ChoiceBlock(label='Tekst uitlijning', choices=TEXT_ALIGNMENT_CHOICES, default='text-left') text_width = blocks.IntegerBlock( label='Tekst breedte', default=12, min_value=1, max_value=12, help_text= "Geeft de breedte van de paragraaf aan, waarbij 12 maximaal is. Som van tekst breedte en tekst offset is ook best maximaal 12" ) text_offset = blocks.IntegerBlock( label='Tekst offset', default=0, min_value=0, max_value=10, help_text= "Geeft de offset van de paragraaf aan, dus hoever de paragraaf naar rechts wordt verschoven (0 = volledig links)" ) text = blocks.TextBlock( label='Paragraaf tekst', min_length=160, required=False, help_text= 'Plaats hier de tekst voor 1 paragraaf, en voeg zoveel paragrafen toe als nodig' ) richtext = blocks.RichTextBlock( label='Richtext (= alternatief)', required=False, help_text="Deze wordt enkel getoond indien de 'Paragraaf tekst' leeg is" ) class Meta: template = 'home/blocks/paragraph_block.html' label = 'paragraaf' icon = 'edit'
class TabbedContentItem(blocks.StructBlock): tab_name = blocks.CharBlock(label='tabblad titel', required=True, max_length=32, help_text='de titel voor het tabblad') rich_content = blocks.RichTextBlock(required=True) text_width = blocks.IntegerBlock( label='Breedte', default=12, min_value=1, max_value=12, help_text= "Geeft de breedte van de tabs + inhoud aan, waarbij 12 maximaal is.")
class FooterSettings(BaseSetting): class Meta: verbose_name = _('footer') footer = StreamField( [('column', blocks.StructBlock([ ('size', blocks.IntegerBlock(min_value=1, max_value=12)), ('content', blocks.RichTextBlock()), ]))], blank=True, ) panels = [StreamFieldPanel('footer')]
class BlogBlock(blocks.StructBlock): title = blocks.CharBlock(label=_('Title'), required=False) nb_articles = blocks.IntegerBlock(label=_('Number of articles'), default=3) def get_context(self, value, parent_context=None): from .utils import get_blog_from_context context = super(BlogBlock, self).get_context(value, parent_context=parent_context) context['blog'] = get_blog_from_context(parent_context or {}) return context class Meta: label = _('Blog') icon = 'fa-rss' template = 'blog/blog-block.html'
class ColumnBlock(blocks.StructBlock): columns = blocks.ListBlock( blocks.StructBlock([('width', blocks.IntegerBlock( min_value=1, max_value=12, help_text=_('Width out of 12'), )), ('content', blocks.StreamBlock(BASIC_BLOCKTYPES)) ])) class Meta: label = _('Columns') icon = 'fa-columns' template = 'blocks/columns.html' group = _('Meta')
class ConferenceRegistrationForm(AbstractFormBlock): govdelivery_code = blocks.CharBlock(help_text=( "Conference registrants will be subscribed to this GovDelivery " "list.")) capacity = blocks.IntegerBlock(help_text=( "Enter an integer that will be the conference attendance limit.")) success_message = blocks.RichTextBlock(help_text=( "Enter a message that will be shown on successful registration.")) at_capacity_message = blocks.RichTextBlock(help_text=( "Enter a message that will be shown when the event is at capacity.")) failure_message = blocks.RichTextBlock( help_text=("Enter a message that will be shown if the GovDelivery " "subscription fails.")) class Meta: handler = 'data_research.handlers.ConferenceRegistrationHandler' template = 'data_research/conference-registration-form.html'