Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cc10071
Fixes for dropdown and checkboxes fields
fredevery Aug 10, 2022
ab9bc65
wagtail 3 and over deprecation warnings handling
patillacode Oct 18, 2022
531a18f
Merge pull request #1 from typecode/wagtail-deprecation-warning
fredevery Oct 18, 2022
b33e80d
Merge pull request #2 from octavenz/master
fredevery Oct 18, 2022
c94cef2
Merge pull request #3 from typecode/field-fixes
fredevery Oct 18, 2022
2d64abf
move static_src/ to static/
stephencockerill Mar 1, 2023
23a12e3
Merge pull request #4 from typecode/static-assets
stephencockerill Mar 1, 2023
b3a6e76
Tweaks to formbuilder.js to allow for async init
fredevery Mar 10, 2023
aaa997c
Merge pull request #5 from typecode/formbuilder-js-tweaks
fredevery Mar 10, 2023
e7b082c
update module paths
Mng-dev-ai Mar 16, 2023
4f31deb
Field choices fix
fredevery Jun 2, 2023
0f490f7
Merge pull request #6 from typecode/field-choices-fix
fredevery Jun 2, 2023
02af8b0
Form Snippets
fredevery Jun 7, 2023
3975101
Merge pull request #7 from typecode/form-snippets
fredevery Jun 13, 2023
ed8de4d
Typo Fix
fredevery Jun 15, 2023
740915d
Merge pull request #8 from typecode/typo-fix
fredevery Jun 15, 2023
cb2ced9
add optional salesforce config fields to all field blocks
stephencockerill Jul 6, 2023
35c04c0
Merge pull request #9 from typecode/stephe_sf-fields
stephencockerill Jul 6, 2023
7517176
Update for Wagtail 5.1
Aug 9, 2023
684f980
Add a min length option to text fields (#10)
fredevery Nov 16, 2023
bbf584d
Alternative Email Dropdown (#11)
patillacode Dec 20, 2023
317c76c
Field Toggle
fredevery May 3, 2024
1094d76
Merge pull request #12 from typecode/4226-orgless-users
fredevery May 21, 2024
c1f18e8
add support for richtext checkbox (#13)
stephencockerill Aug 8, 2024
6039eb2
Checkbox default value
fredevery Dec 17, 2024
65ce8a5
cleanup
fredevery Dec 17, 2024
c5e49ed
cleanup
fredevery Dec 17, 2024
f09033f
cleanup
fredevery Dec 17, 2024
e532059
Merge pull request #14 from typecode/checkbox-default-value
fredevery Dec 17, 2024
178ecb9
Use richtext template tag for RichTextCheckbox
fredevery Jan 22, 2025
5446c8d
Merge pull request #16 from typecode/ele-339-richtext-checkbox
fredevery Jan 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.idea
.vscode
/node_modules
/wagtail_advanced_form_builder/static
npm-debug.log
/dist
wagtail_advanced_form_builder.egg-info
Expand Down
2 changes: 1 addition & 1 deletion build_test/models/home_page.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from wagtail.core.models import Page
from wagtail.models import Page


class HomePage(Page):
Expand Down
2 changes: 1 addition & 1 deletion build_test/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'wagtail',
'wagtail.contrib.modeladmin',
'wagtail.contrib.settings',
'wagtail.contrib.routable_page',
Expand Down
2 changes: 1 addition & 1 deletion build_test/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.urls import include, re_path

from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls

urlpatterns = []
Expand Down
2 changes: 1 addition & 1 deletion wagtail_advanced_form_builder/blocks/base_static_block.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.template.loader import render_to_string

from wagtail.core import blocks
from wagtail import blocks


class BaseStaticBlock(blocks.StaticBlock):
Expand Down
38 changes: 23 additions & 15 deletions wagtail_advanced_form_builder/blocks/fields/base_field_block.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
from django import forms
from django.templatetags.static import static

from wagtail.core import blocks
from wagtail.core.blocks import RichTextBlock
from wagtail import blocks
from wagtail.blocks import RichTextBlock

from .conditional_block import ConditionalBlock


class BaseFieldBlock(blocks.StructBlock):

label = blocks.CharBlock(
max_length=255,
required=True,
help_text='The label of the form field.'
max_length=255, required=True, help_text="The label of the form field."
)

required = blocks.BooleanBlock(
default=False,
required=False,
help_text='Tick this box to make this a required field.'
help_text="Tick this box to make this a required field.",
)

display_checkbox_label = blocks.BooleanBlock(
default=False,
required=False,
help_text='Do you want the checkbox label to display? If not you should populate help_text.'
help_text="Do you want the checkbox label to display? If not you should populate help_text.",
)

choices = blocks.ListBlock(
Expand All @@ -39,14 +36,25 @@ class BaseFieldBlock(blocks.StructBlock):
)

max_length = blocks.IntegerBlock(
required=False,
help_text='Set a maximum length for this field. e.g. 100'
required=False, help_text="Set a maximum length for this field. e.g. 100"
)

min_length = blocks.IntegerBlock(
required=False, help_text="Set a minimum length for this field. e.g. 2"
)

default_value = blocks.CharBlock(
max_length=255, required=False, help_text="Set a default value for this field."
)
salesforce_object_name = blocks.CharBlock(
max_length=255,
required=False,
help_text="The Salesforce object name that the form field value will be integrated to.",
)
salesforce_api_field_name = blocks.CharBlock(
max_length=255,
required=False,
help_text='Set a default value for this field.'
help_text="The Salesforce API field name that the form field value will be integrated to.",
)

# placeholder = blocks.CharBlock(
Expand All @@ -58,23 +66,23 @@ class BaseFieldBlock(blocks.StructBlock):
help_text = blocks.CharBlock(
max_length=255,
required=False,
help_text='Text to assist the user in populating this field.'
help_text="Text to assist the user in populating this field.",
)

html = RichTextBlock(
required=False,
)

display_side_by_side = blocks.BooleanBlock(
help_text='Display these items side by side?',
help_text="Display these items side by side?",
required=False,
)

rules = ConditionalBlock(
required=False,
help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.'
help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.",
)

@property
def media(self):
return forms.Media(js=[static('wagtail_advanced_form_builder/js/admin.js')])
return forms.Media(js=[static("wagtail_advanced_form_builder/js/admin.js")])
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import wagtail_advanced_form_builder.constants as consts

from wagtail.core import blocks
from wagtail import blocks

from .condition_block import ConditionBlock

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from wagtail.core import blocks
from wagtail import blocks

from .base_field_block import BaseFieldBlock


class CheckboxFieldBlock(BaseFieldBlock):

choices = None

help_text = blocks.CharBlock(
Expand All @@ -14,18 +13,15 @@ class CheckboxFieldBlock(BaseFieldBlock):

html = None

default_value = None

display_side_by_side = None

empty_label = None

max_length = None
min_length = None

placeholder = None


class Meta:

form_classname = 'waf--field'
icon = 'extraicons--checkbox'
form_classname = "waf--field"
icon = "extraicons--checkbox"
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
from wagtail.core import blocks
from wagtail import blocks

from .base_field_block import BaseFieldBlock


class CheckboxesFieldBlock(BaseFieldBlock):

choices = blocks.ListBlock(
blocks.TextBlock(
required=True,
icon='extraicons--heading-icon',
icon="extraicons--heading-icon",
),
)

default_value = blocks.ListBlock(
blocks.TextBlock(
required=False,
icon='extraicons--heading-icon',
help_text='Enter a value that matches a checkbox choice above to have it ticked by default.'
icon="extraicons--heading-icon",
help_text="Enter a value that matches a checkbox choice above to have it ticked by default.",
),
)

Expand All @@ -25,11 +24,12 @@ class CheckboxesFieldBlock(BaseFieldBlock):
empty_label = None

max_length = None
min_length = None

placeholder = None

display_checkbox_label = None

class Meta:
form_classname = 'waf--field'
icon = 'extraicons--checkboxes'
form_classname = "waf--field"
icon = "extraicons--checkboxes"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import wagtail_advanced_form_builder.constants as consts

from wagtail.core import blocks
from wagtail import blocks


class ConditionBlock(blocks.StructBlock):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import wagtail_advanced_form_builder.constants as consts

from wagtail.core import blocks
from wagtail import blocks

from .condition_block import ConditionBlock
from .blank_condition_block import BlankConditionBlock
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
from wagtail.core import blocks
from wagtail import blocks

from .base_field_block import BaseFieldBlock


class DropdownFieldBlock(BaseFieldBlock):

choices = blocks.ListBlock(
blocks.TextBlock(
required=True,
icon='extraicons--heading-icon',
icon="extraicons--heading-icon",
),
)

html = None

max_length = None
min_length = None

placeholder = None

Expand All @@ -23,5 +23,5 @@ class DropdownFieldBlock(BaseFieldBlock):
display_checkbox_label = None

class Meta:
form_classname = 'waf--field'
icon = 'extraicons--dropdown'
form_classname = "waf--field"
icon = "extraicons--dropdown"
12 changes: 12 additions & 0 deletions wagtail_advanced_form_builder/blocks/fields/field_toggle_block.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from wagtail import blocks

from .checkbox_field_block import CheckboxFieldBlock


class FieldToggleBlock(CheckboxFieldBlock):
name = blocks.CharBlock(
max_length=255, required=False, help_text="The field name to be used in the code"
)
toggled_label = blocks.CharBlock(
max_length=255, required=False, help_text="The label to display when toggled"
)
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from wagtail.core import blocks
from wagtail import blocks

from .base_field_block import BaseFieldBlock


class HiddenFieldBlock(BaseFieldBlock):

default_value = blocks.CharBlock(
max_length=255,
required=True,
label='Value',
help_text='The value to go into the hidden field.'
label="Value",
help_text="The value to go into the hidden field.",
)

choices = None
Expand All @@ -25,6 +24,7 @@ class HiddenFieldBlock(BaseFieldBlock):
empty_label = None

max_length = None
min_length = None

display_side_by_side = None

Expand All @@ -33,6 +33,5 @@ class HiddenFieldBlock(BaseFieldBlock):
rules = None

class Meta:
form_classname = 'waf--field'
icon = 'extraicons--hidden'

form_classname = "waf--field"
icon = "extraicons--hidden"
16 changes: 7 additions & 9 deletions wagtail_advanced_form_builder/blocks/fields/html_field_block.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
from wagtail.core import blocks
from wagtail.core.blocks import RichTextBlock
from wagtail import blocks
from wagtail.blocks import RichTextBlock

from .base_field_block import BaseFieldBlock


class HTMLFieldBlock(BaseFieldBlock):

label = blocks.CharBlock(
max_length=255,
required=True,
help_text='A unique reference for this html block',
label='Unique reference name',
help_text="A unique reference for this html block",
label="Unique reference name",
)

html = RichTextBlock(
Expand All @@ -20,6 +19,7 @@ class HTMLFieldBlock(BaseFieldBlock):
help_text = None

max_length = None
min_length = None

required = None

Expand All @@ -36,7 +36,5 @@ class HTMLFieldBlock(BaseFieldBlock):
display_checkbox_label = None

class Meta:
form_classname = 'waf--field waf--html-field'
icon = 'extraicons--paragraph'


form_classname = "waf--field waf--html-field"
icon = "extraicons--paragraph"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class MultiLineFieldBlock(BaseFieldBlock):

choices = None

html = None
Expand All @@ -14,11 +13,12 @@ class MultiLineFieldBlock(BaseFieldBlock):
empty_label = None

max_length = None
min_length = None

display_side_by_side = None

placeholder = None

class Meta:
form_classname = 'waf--field'
icon = 'extraicons--text-box'
form_classname = "waf--field"
icon = "extraicons--text-box"
Loading