-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(v3.6.0): tup 230 make form plugin work (#500)
* feat(tup-230): working form plugin * docs(tup-230): clarify form submission failure * feat(tup-230): use jquery version that has ajax The django-forms(-maintained) plugin expects jquery with ajax features. Our CMS was using a slim build of jQuery. The size difference is 17KB, which I consider negligible. * feat(tup-230): make spam protection available * feat(tup-230): e-mail template (when e-mail works) * docs(tup-230): tweak comment in settings * fix(tup-230): comments & semantic html in template * fix(tup-230): revert and make some html changes - less changes form original - sometimes the original html was better for styling * feat(tup-230): style form (no design review yet) Also, no button styling yet. * chore(tup-230): rename css file, add pointer file Pointer file mimics what I do for blog CSS, which is also in source. * docs(tup-230): comment for captcha settings * fix(tup-230): pin core-styles to v0.3.0 This is before the API change, and the tag just before CMS v3.6.0. * feat(tup-230): initial button styles Regarding "--from-future-core-styles": - Core-Styles with c-button is beyond v0.3.0 at which we are pinned. - I avoid past v0.3.0, cuz API changed, and I try to limit complexity. * feat(tup-230):improve & organize field styles * chore(tup-230): improve proof of captcha override * chore(tup-230): fix innocuous typos * feat(tup-230): add & document basic custom captcha * docs(tup-230): widget template comments cleanup * fix(tup-230): move field errors to bottom * fix(tup-230): remove unaltered e-mail template When we want to customize e-mail, dev should learn template override. I have to balance how much I help new devs with my own productivity. * fix(tup-230): template indentation and comments * chore(tup-230): delete superfluous file * docs(tup-230): better template comments * chore(tup-230): remove excess template change * fix(tup-230): style single checkbox fields on grid This returns single label and checkbox pair to one line. * fix(tup-230): tweak single checkbox field grid gap
- Loading branch information
1 parent
eb7c282
commit 938b9b3
Showing
20 changed files
with
713 additions
and
37 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,115 @@ | ||
"""Configure djangocms_forms and related apps""" | ||
|
||
from django.utils.translation import gettext_lazy as _ | ||
|
||
######################## | ||
# KNOWN ISSUES | ||
######################## | ||
|
||
# Unable to export to Excel nor YAML | ||
# (No success hiding those formats from editor) | ||
# https://github.com/avryhof/djangocms-forms/issues/8 | ||
|
||
######################## | ||
# DJANGOCMS_FORMS | ||
# https://github.com/avryhof/djangocms-forms/ | ||
######################## | ||
|
||
# DJANGOCMS_FORMS_PLUGIN_MODULE = ('Generic') | ||
# DJANGOCMS_FORMS_PLUGIN_NAME = ('Form') | ||
|
||
# DJANGOCMS_FORMS_TEMPLATES = ( | ||
# ('djangocms_forms/form_template/default.html', ('Default')), | ||
# ) | ||
DJANGOCMS_FORMS_USE_HTML5_REQUIRED = True | ||
|
||
# DJANGOCMS_FORMS_REDIRECT_DELAY = 1000 | ||
|
||
# The default value is only for test and dev | ||
# DJANGO_FORMS_RECAPTCHA_PUBLIC_KEY = '' # set in Deployments repo, not here | ||
# DJANGO_FORMS_RECAPTCHA_SECRET_KEY = '' # set on sever directly, not here | ||
|
||
DJANGOCMS_FORMS_SPAM_PROTECTIONS = ( | ||
(0, _('None')), | ||
# (1, _('Honeypot')), # if necessary, learn how to use | ||
(2, _('ReCAPTCHA')), | ||
) | ||
DEFAULT_SPAM_PROTECTION = 0 | ||
|
||
# Improve form legibility and conceal unavailable features | ||
# https://github.com/avryhof/djangocms-forms/blob/97d7c21/djangocms_forms/cms_plugins.py#L69-L121 | ||
DJANGOCMS_FORMS_FIELDSETS = ( | ||
(None, {'fields': ('name', 'form_template',),}), | ||
( | ||
_('Text'), | ||
{ | ||
'description': _( | ||
'The <strong>Title</strong> and <strong>Description</strong> ' | ||
'will display above the input fields and Submit button.' | ||
), | ||
'fields': ('title', 'description','submit_btn_txt',), | ||
}, | ||
), | ||
( | ||
None, | ||
{ | ||
'description': _( | ||
'You can change the message that appears <em>after</em> someone submits your form. By default, this says "<strong>Thank you!</strong>"' | ||
), | ||
'fields': ('post_submit_msg',), | ||
}, | ||
), | ||
( | ||
_('Redirect settings'), | ||
{ | ||
'description': _( | ||
'Whether and how to redirect the form <em>after</em> submission.' | ||
), | ||
'fields': ('success_redirect', ('page_redirect', 'external_redirect'), 'redirect_delay',), | ||
} | ||
), | ||
( | ||
_('Submission settings'), | ||
{ | ||
'description': 'Whether to save form data.', | ||
'fields': ( | ||
'save_data', | ||
'spam_protection', | ||
), | ||
}, | ||
), | ||
( | ||
_('Submission e-mail (unavailable feature)'), | ||
{ | ||
'classes': ('collapse',), | ||
'description': 'Choose storage options to capture form data. You can enter an e-mail address to which to e-mail form submissions.', | ||
'fields': ( | ||
# Submitting form with 'email_to' defined causes server error | ||
# FAQ: We may need to setup some django e-mail server for these | ||
'email_to', | ||
'email_from', | ||
'email_subject', | ||
'email_uploaded_files', | ||
), | ||
}, | ||
), | ||
) | ||
|
||
######################## | ||
# DJANGO | ||
# https://docs.djangoproject.com/en/2.2/ref/settings/#form-renderer | ||
######################## | ||
|
||
# Allow form template override | ||
# https://github.com/torchbox/django-recaptcha/issues/211#issuecomment-675608391 | ||
FORM_RENDERER = 'django.forms.renderers.TemplatesSetting' | ||
|
||
######################## | ||
# DJANGO CMS | ||
######################## | ||
|
||
_INSTALLED_APPS = [ | ||
'djangocms_forms', # form plugin for editors | ||
'django.forms', # support form template override | ||
'captcha', # support recaptcha for djangocms_forms | ||
] |
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,3 @@ | ||
/* SEE: ../../site_cms/css/src/app.djangocms_forms.css */ | ||
/* FAQ: We use future syntax that often must be processed to work in the now; | ||
and the process does not support outputting files to this directory */ |
Oops, something went wrong.