-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature streamforms #171
Merged
Merged
Feature streamforms #171
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
3414df4
Integrated Streamforms with our existing form infrastructure.
0c21511
Moved streamforms. File uploads work correclty now.
10a3b2d
Integrated the modeladmin for StreamForms.
d10e7f4
Cleaned up code.
f26952a
Added integration with our stream fields to stream forms. Added fiel…
ed5cec5
Fixed missing multiline text input.
f404489
Added License for wagtail streamforms
4eb65ec
Added progress bar and previous/next button
460fd48
Fixed off by one error on Previous butotn.
e053aaa
Added extra layer of interaction between coderedcms and wagtail_flexi…
e5a2210
Fixed rendering of form submissions files in admin.
e6b7579
StreamForm inputs now render custom data attributes and custom settings.
f851200
Added template blocks to stream_form_page.html
8584baa
Merge
d6887a7
Added back newlines
5becba8
Started conditional logic js
4551ee5
Added docs
aececf6
Updated docs.
2dfd903
Fixed issue where Anonymous Users weren't getting a session key assig…
b31cd2a
Adding conditional logic to front-end
vsalvino 5aa5104
Merge branch 'feature-streamforms' of github.com:coderedcorp/coderedc…
vsalvino d95fe4b
Added logic to create Form Submissions from complete SEssionFormSubmi…
babd278
Cleaned up data formatting on csv's.
0dc6b12
Added form submission landing page on success for streamform
ce5b1f9
Adding dashed line between form fields in summary email
vsalvino 230b5eb
Merge branch 'feature-streamforms' of github.com:coderedcorp/coderedc…
vsalvino eef7deb
Removed print
83f7c5d
Removed print
5c89bad
Merge branch 'feature-streamforms' of https://github.com/coderedcorp/…
30bc9aa
Fixed progress bar
2f340c2
Removed - from being shown on blank streamform values.
13a9ca9
Added normal dash for null values in stream form submission processing.
93b12df
Merge branch 'master' into feature-streamforms
b7fa35b
Updated stream form date pickers to use our date picker.
3e347ba
Updated docs.
d01bba7
Fixed missing links in docs.
90f19dd
Fixed hyperlink in docs.
6b2c59b
Updated Streamform blocks to use our already existing fields.
3d2b9a1
Fixed issue of confirmation emails not rendering links correctly.
9c0f7ac
Fixed issue of duplicating fields on submission emails.
d30266a
Removed unnecessary line
c39da67
Merge
85f0be0
Updated tests for Streamforms.
789a2c3
Merge branch 'master' into feature-streamforms
f401008
Moving js to new coderedms/ dir
vsalvino 16f5d47
Updating docs
vsalvino c841d07
Removing unreachable return
vsalvino File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
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.') | ||
) | ||
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.') | ||
) | ||
|
||
|
||
class FormBlockMixin(BaseBlock): | ||
class Meta: | ||
abstract=True | ||
|
||
advsettings_class = CoderedFormAdvSettings | ||
|
||
|
||
class CoderedStreamFormFieldBlock(form_blocks.OptionalFormFieldBlock, FormBlockMixin): | ||
pass | ||
|
||
|
||
class CoderedStreamFormCharFieldBlock(form_blocks.CharFieldBlock, FormBlockMixin): | ||
class Meta: | ||
label = _("Text or Email input") | ||
icon = "fa-window-minimize" | ||
|
||
|
||
class CoderedStreamFormTextFieldBlock(form_blocks.TextFieldBlock, FormBlockMixin): | ||
class Meta: | ||
label = _("Multi-line text") | ||
icon = "fa-align-left" | ||
|
||
|
||
class CoderedStreamFormNumberFieldBlock(form_blocks.NumberFieldBlock, FormBlockMixin): | ||
class Meta: | ||
label = _("Numbers only") | ||
icon = "fa-hashtag" | ||
|
||
|
||
class CoderedStreamFormCheckboxFieldBlock(form_blocks.CheckboxFieldBlock, FormBlockMixin): | ||
class Meta: | ||
label = _("Single Checkbox") | ||
icon = "fa-check-square-o" | ||
|
||
|
||
class CoderedStreamFormRadioButtonsFieldBlock(form_blocks.RadioButtonsFieldBlock, FormBlockMixin): | ||
class Meta: | ||
label = _("Radios") | ||
icon = "fa-list-ul" | ||
|
||
|
||
class CoderedStreamFormDropdownFieldBlock(form_blocks.DropdownFieldBlock, FormBlockMixin): | ||
class Meta: | ||
label = _("Dropdown") | ||
icon = "fa-list-alt" | ||
|
||
|
||
class CoderedStreamFormCheckboxesFieldBlock(form_blocks.CheckboxesFieldBlock, FormBlockMixin): | ||
class Meta: | ||
label = _("Checkboxes") | ||
icon = "fa-list-ul" | ||
|
||
|
||
class CoderedStreamFormDateFieldBlock(form_blocks.DateFieldBlock, FormBlockMixin): | ||
class Meta: | ||
label = _("Date") | ||
icon = "fa-calendar" | ||
|
||
field_class = CoderedDateField | ||
widget = CoderedDateInput | ||
|
||
|
||
class CoderedStreamFormTimeFieldBlock(form_blocks.TimeFieldBlock, FormBlockMixin): | ||
class Meta: | ||
label = _("Time") | ||
icon = "fa-clock-o" | ||
|
||
field_class = CoderedTimeField | ||
widget = CoderedTimeInput | ||
|
||
|
||
class CoderedStreamFormDateTimeFieldBlock(form_blocks.DateTimeFieldBlock, FormBlockMixin): | ||
class Meta: | ||
label = _("Date and Time") | ||
icon = "fa-calendar" | ||
|
||
field_class = CoderedDateTimeField | ||
widget = CoderedDateTimeInput | ||
|
||
|
||
class CoderedStreamFormImageFieldBlock(form_blocks.ImageFieldBlock, FormBlockMixin): | ||
class Meta: | ||
label = _("Image Upload") | ||
icon = "fa-picture-o" | ||
|
||
|
||
class CoderedStreamFormFileFieldBlock(form_blocks.FileFieldBlock, FormBlockMixin): | ||
class Meta: | ||
label = _("Secure File Upload") | ||
icon = "fa-upload" | ||
|
||
field_class = SecureFileField | ||
|
||
|
||
class CoderedStreamFormStepBlock(form_blocks.FormStepBlock): | ||
form_fields = blocks.StreamBlock() | ||
|
||
def __init__(self, local_blocks=None, **kwargs): | ||
super().__init__( | ||
local_blocks = [ | ||
('form_fields', blocks.StreamBlock(local_blocks)) | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
coderedcms/migrations/0015_coderedsessionformsubmission_coderedsubmissionrevision.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Generated by Django 2.2.1 on 2019-05-04 15:09 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('contenttypes', '0002_remove_content_type_name'), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('wagtailcore', '0041_group_collection_permissions_verbose_name_plural'), | ||
('coderedcms', '0014_classifiers'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='CoderedSubmissionRevision', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('type', models.CharField(choices=[('created', 'Created'), ('changed', 'Changed'), ('deleted', 'Deleted')], max_length=7)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('submission_id', models.TextField()), | ||
('data', models.TextField()), | ||
('summary', models.TextField()), | ||
('submission_ct', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')), | ||
], | ||
options={ | ||
'ordering': ('-created_at',), | ||
'abstract': False, | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='CoderedSessionFormSubmission', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('form_data', models.TextField()), | ||
('submit_time', models.DateTimeField(auto_now_add=True, verbose_name='submit time')), | ||
('session_key', models.CharField(default=None, max_length=40, null=True)), | ||
('thumbnails_by_path', models.TextField(default='{}')), | ||
('last_modification', models.DateTimeField(auto_now=True, verbose_name='last modification')), | ||
('status', models.CharField(choices=[('incomplete', 'Not submitted'), ('complete', 'Complete'), ('reviewed', 'Under consideration'), ('approved', 'Approved'), ('rejected', 'Rejected')], default='incomplete', max_length=10)), | ||
('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='wagtailcore.Page')), | ||
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
'verbose_name': 'form submission', | ||
'unique_together': {('page', 'session_key'), ('page', 'user')}, | ||
'abstract': False, | ||
'verbose_name_plural': 'form submissions', | ||
}, | ||
), | ||
] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So my concern here is that this will potentially cause migrations from hell once we have to switch to built-in wagtail streamforms. I'm wondering if we should wrap/extend any blocks or concrete models in
wagtail_flexible_forms
, that way all the migrations are pointing to our models, and we can update under the hood as necessary. I only say that because a similar thing happened when we switched from wagtail's built-in RichTextBlock to our own RichTextBlock, and I had to do a bunch of find&replace in migration files in client projects to resolve.I'm not 100% sure if it will cause problems or not, just trying to be proactive. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CoderedAdvancedFormPage
uses the extendedCoderedFormStepBlock
which inherits from theirFormStepBlock
. All of our File Fields are using extended versions of their file fields. The only thing that we might want to do related to this concern is to only use wff as a library and extend theirStreamFormMixin
andStep
/Steps
classes in the CMS so there is no direct contact between the CMS and wff.