Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from django.utils.translation import ugettext_lazy as _
from wagtail.core import blocks
from coderedcms.wagtail_flexible_forms import blocks as form_blocks
from coderedcms.blocks.base_blocks import BaseBlock, CoderedAdvSettings
from coderedcms.forms import (
CoderedDateField, CoderedDateInput,
CoderedDateTimeField, CoderedDateTimeInput,
CoderedTimeField, CoderedTimeInput,
SecureFileField
)
class CoderedFormAdvSettings(CoderedAdvSettings):
condition_trigger_id = blocks.CharBlock(
required=False,
max_length=255,
label=_('Condition Trigger ID'),
help_text=_(
'The "Custom ID" of another field that that will trigger this field to be shown/hidden.') # noqa
)
condition_trigger_value = blocks.CharBlock(
required=False,
max_length=255,
label=_('Condition Trigger Value'),
help_text=_(
'The value of the field in "Condition Trigger ID" that will trigger this field to be shown.') # noqa
)
"""
CoderedAdvSettings plus additional tracking fields.
"""
ga_tracking_event_category = blocks.CharBlock(
required=False,
max_length=255,
label=_('Tracking Event Category'),
)
ga_tracking_event_label = blocks.CharBlock(
required=False,
max_length=255,
label=_('Tracking Event Label'),
)
class CoderedAdvColumnSettings(CoderedAdvSettings):
"""
BaseBlockSettings plus additional column fields.
"""
column_breakpoint = blocks.ChoiceBlock(
choices=cr_settings['FRONTEND_COL_BREAK_CHOICES'],
default=cr_settings['FRONTEND_COL_BREAK_DEFAULT'],
required=False,
verbose_name=_('Column Breakpoint'),
help_text=_('Screen size at which the column will expand horizontally or stack vertically.'),
)
class BaseBlock(blocks.StructBlock):
"""
Common attributes for all blocks used in CodeRed CMS.
"""
local_blocks += (
(
'custom_template',
blocks.ChoiceBlock(
choices=template_choices,
default=None,
required=False,
label=_('Template'))
),
)
super().__init__(local_blocks, **kwargs)
class CoderedAdvTrackingSettings(CoderedAdvSettings):
"""
CoderedAdvSettings plus additional tracking fields.
"""
ga_tracking_event_category = blocks.CharBlock(
required=False,
max_length=255,
label=_('Tracking Event Category'),
)
ga_tracking_event_label = blocks.CharBlock(
required=False,
max_length=255,
label=_('Tracking Event Label'),
)
class CoderedAdvColumnSettings(CoderedAdvSettings):