Skip to content
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

feat(v3.6.0): tup 230 make form plugin work #500

Merged
merged 27 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f0d1b56
feat(tup-230): working form plugin
wesleyboar Jun 9, 2022
5936994
docs(tup-230): clarify form submission failure
wesleyboar Jun 9, 2022
6834a18
feat(tup-230): use jquery version that has ajax
wesleyboar Jun 10, 2022
36ceba6
feat(tup-230): make spam protection available
wesleyboar Jun 10, 2022
45a176f
feat(tup-230): e-mail template (when e-mail works)
wesleyboar Jun 10, 2022
4bc586f
docs(tup-230): tweak comment in settings
wesleyboar Jun 13, 2022
f935787
fix(tup-230): comments & semantic html in template
wesleyboar Jun 13, 2022
1a00c00
fix(tup-230): revert and make some html changes
wesleyboar Jun 14, 2022
e1795c7
feat(tup-230): style form (no design review yet)
wesleyboar Jun 14, 2022
eef04af
chore(tup-230): rename css file, add pointer file
wesleyboar Jun 14, 2022
f7dff57
docs(tup-230): comment for captcha settings
wesleyboar Jun 14, 2022
9893fcf
fix(tup-230): pin core-styles to v0.3.0
wesleyboar Jun 14, 2022
d6f1f01
feat(tup-230): initial button styles
wesleyboar Jun 14, 2022
351e9b1
feat(tup-230):improve & organize field styles
wesleyboar Jun 14, 2022
8f08398
chore(tup-230): improve proof of captcha override
wesleyboar Jun 15, 2022
16d203f
chore(tup-230): fix innocuous typos
wesleyboar Jun 15, 2022
8121058
feat(tup-230): add & document basic custom captcha
wesleyboar Jun 15, 2022
2695afe
docs(tup-230): widget template comments cleanup
wesleyboar Jun 15, 2022
02daff8
fix(tup-230): move field errors to bottom
wesleyboar Jun 15, 2022
18f18df
fix(tup-230): remove unaltered e-mail template
wesleyboar Jun 15, 2022
9042af0
fix(tup-230): template indentation and comments
wesleyboar Jun 15, 2022
938e1da
chore(tup-230): delete superfluous file
wesleyboar Jun 15, 2022
e15134f
docs(tup-230): better template comments
wesleyboar Jun 15, 2022
0457aaa
chore(tup-230): remove excess template change
wesleyboar Jun 15, 2022
b1c08a6
fix(tup-230): style single checkbox fields on grid
wesleyboar Jun 15, 2022
2c0df77
fix(tup-230): tweak single checkbox field grid gap
wesleyboar Jun 15, 2022
1f8f43b
Merge branch 'release/v3.6.0' into v3.6.0/tup-230-make-form-plugin-work
wesleyboar Jun 21, 2022
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
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"npm": "8.5.5"
},
"devDependencies": {
"@tacc/core-styles": "git+https://git@github.com/TACC/Core-Styles.git",
"@tacc/core-styles": "git+https://git@github.com/TACC/Core-Styles.git#v0.3.0",
wesleyboar marked this conversation as resolved.
Show resolved Hide resolved
"minimist": "^1.2.6",
"node-cmd": "^5.0.0"
},
Expand Down
33 changes: 25 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ djangocms-blog = "1.1.1"
djangocms-bootstrap4 = "2.0.0"
djangocms-column = "1.11.0"
djangocms-file = "3.0.0"
djangocms-forms = "0.2.5"
djangocms-forms-maintained = { git = "https://github.com/avryhof/djangocms-forms", rev = "30f464303d317cf7a3170ad64e11ab4471b4287b" }
wesleyboar marked this conversation as resolved.
Show resolved Hide resolved
djangocms-googlemap = "2.0.0"
djangocms-icon = "2.0.0"
djangocms-link = "3.0.0"
Expand Down
115 changes: 115 additions & 0 deletions taccsite_cms/_settings/form_plugin.py
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
]
30 changes: 8 additions & 22 deletions taccsite_cms/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
import ldap
from django_auth_ldap.config import LDAPSearch, GroupOfNamesType

from taccsite_cms._settings.form_plugin import *
from taccsite_cms._settings.form_plugin import (
_INSTALLED_APPS as form_plugin_INSTALLED_APPS
)
wesleyboar marked this conversation as resolved.
Show resolved Hide resolved

SECRET_KEY = 'CHANGE_ME'
def gettext(s): return s

Expand Down Expand Up @@ -91,16 +96,6 @@ def gettext(s): return s
GOOGLE_ANALYTICS_PROPERTY_ID = "UA-123ABC@%$&-#"
GOOGLE_ANALYTICS_PRELOAD = True

########################
# CMS FORMS
########################

# Create CMS Forms
# SEE: https://pypi.org/project/djangocms-forms/
# SEE: https://www.google.com/recaptcha/admin/create
DJANGOCMS_FORMS_RECAPTCHA_PUBLIC_KEY = ""
DJANGOCMS_FORMS_RECAPTCHA_SECRET_KEY = ""

########################
# ELASTICSEARCH
########################
Expand Down Expand Up @@ -318,6 +313,9 @@ def gettext(s): return s
'haystack',
'aldryn_apphooks_config',
'test_without_migrations',

] + form_plugin_INSTALLED_APPS + [

'taccsite_cms',
'taccsite_cms.contrib.bootstrap4_djangocms_link',
'taccsite_cms.contrib.bootstrap4_djangocms_picture',
Expand Down Expand Up @@ -415,18 +413,6 @@ def get_subdirs_as_module_names(path):

DJANGOCMS_AUDIO_ALLOWED_EXTENSIONS = ['mp3', 'ogg', 'wav']

# Djangocms Forms Settings.
# SEE: https://github.com/mishbahr/djangocms-forms#configuration
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 = False

DJANGOCMS_FORMS_REDIRECT_DELAY = 1

# Elasticsearch Indexing
HAYSTACK_ROUTERS = ['aldryn_search.router.LanguageRouter', ]
HAYSTACK_SIGNAL_PROCESSOR = 'taccsite_cms.signal_processor.RealtimeSignalProcessor'
Expand Down
3 changes: 3 additions & 0 deletions taccsite_cms/static/css/djangocms_forms/djangocms_forms.css
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 */
Loading