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(tup-308): working form plugin (aka tup-230) #498

Merged
merged 33 commits into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
07ecf23
feat(tup-230): working form plugin
wesleyboar Jun 9, 2022
41fa43f
docs(tup-230): clarify form submission failure
wesleyboar Jun 9, 2022
9f887ee
Merge branch 'main' into task/tup-230-make-form-plugin-work
wesleyboar Jun 10, 2022
3b8c090
feat(tup-230): use jquery version that has ajax
wesleyboar Jun 10, 2022
2ee8f4f
feat(tup-230): make spam protection available
wesleyboar Jun 10, 2022
166a1e7
feat(tup-230): e-mail template (when e-mail works)
wesleyboar Jun 10, 2022
526695e
docs(tup-230): tweak comment in settings
wesleyboar Jun 13, 2022
5485447
fix(tup-230): comments & semantic html in template
wesleyboar Jun 13, 2022
29ff02a
fix(tup-230): revert and make some html changes
wesleyboar Jun 14, 2022
0b2899a
feat(tup-230): style form (no design review yet)
wesleyboar Jun 14, 2022
924bf72
chore(tup-230): rename css file, add pointer file
wesleyboar Jun 14, 2022
79a039a
Merge branch 'main' into task/tup-230-make-form-plugin-work
wesleyboar Jul 6, 2022
09ccb52
chore(settings): tup-308, how to set captcha keys
wesleyboar Jul 6, 2022
eec0d4a
noop(settings): tup-308, add new line
wesleyboar Jul 6, 2022
d813bee
fix(settings): tup-308, use new form css from #500
wesleyboar Jul 6, 2022
8a46a21
fix(settings): tup-308, new form templates by #500
wesleyboar Jul 6, 2022
b362906
noop(settings): tup-308, form settings from #501
wesleyboar Jul 6, 2022
229428d
fix(settings): tup-308, css changes from #501
wesleyboar Jul 6, 2022
03db17a
fix(settings): tup-308, "*" to "(required)"
wesleyboar Jul 6, 2022
ba992c8
fix(css): tup-308, small form style issues
wesleyboar Jul 6, 2022
803c354
fix(css): tup-308, small form style issues
wesleyboar Jul 6, 2022
c481c53
Merge branch 'task/tup-230-make-form-plugin-work' of github.com:TACC/…
wesleyboar Jul 7, 2022
d0e4b0a
docs(styles): typo fix for KSS comment
wesleyboar Jul 7, 2022
64dca2d
fix(form): tup-308 only working export formats
wesleyboar Jul 8, 2022
07e1fab
fix(form): delete unnecessary cloned template
wesleyboar Jul 8, 2022
f3178f6
fix(form): tup-308, clean up templates
wesleyboar Jul 8, 2022
9fd84b4
fix(form): tup-308, move form export settings
wesleyboar Jul 8, 2022
f81e10e
fix(form): tup-308, remove unused file
wesleyboar Jul 8, 2022
b7679f1
fix(form): tup-308, remove redundant script
wesleyboar Jul 8, 2022
9c18214
chore(core-styles): v0.7.0-beta
wesleyboar Jul 13, 2022
f41239a
Merge branch 'main' into task/tup-230-make-form-plugin-work
wesleyboar Jul 13, 2022
1b59a11
fix(taccsite_custom): get main relevant PRs merged
wesleyboar Jul 13, 2022
062ba78
docs(form): no commented settings
wesleyboar Jul 14, 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
12 changes: 6 additions & 6 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": "^0.6.0",
"@tacc/core-styles": "https://gitpkg.now.sh/TACC/tup-ui/libs/core-styles?task/tup-308-what-forms-should-get-from-core",
wesleyboar marked this conversation as resolved.
Show resolved Hide resolved
wesleyboar marked this conversation as resolved.
Show resolved Hide resolved
"minimist": "^1.2.6"
},
"repository": "git@github.com:TACC/Core-CMS.git",
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
123 changes: 123 additions & 0 deletions taccsite_cms/_settings/form_plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
"""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

########################
# DJANGO_RECAPTCHA
# https://github.com/avryhof/django-recaptcha/
########################

# To properly avoid client error about using test keys
# RECAPTCHA_PUBLIC_KEY = '__this_must_be_on_server_not_here__'
# RECAPTCHA_SECRET_KEY = '__this_must_be_on_server_not_here__'

# To silence server error about using test keys
# SILENCED_SYSTEM_CHECKS = ['captcha.recaptcha_test_key_error']

########################
# DJANGOCMS_FORMS
# https://github.com/avryhof/djangocms-forms/
########################

# DJANGOCMS_FORMS_PLUGIN_MODULE = ('Generic')
wesleyboar marked this conversation as resolved.
Show resolved Hide resolved
# 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

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
]
29 changes: 7 additions & 22 deletions taccsite_cms/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

from django.utils.translation import gettext_lazy as _

from taccsite_cms._settings.form_plugin import *
from taccsite_cms._settings.form_plugin import (
_INSTALLED_APPS as form_plugin_INSTALLED_APPS
)

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

Expand Down Expand Up @@ -93,16 +98,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 @@ -352,6 +347,8 @@ def gettext(s): return s
'aldryn_apphooks_config', # search index & django CMS Blog
'test_without_migrations', # run tests faster

] + form_plugin_INSTALLED_APPS + [

# core TACC CMS
# HELP: If this were top of list, would TACC/Core-CMS/pull/169 fix break?
'taccsite_cms',
Expand Down Expand Up @@ -461,18 +458,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/djangocms_forms/css/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 uses future syntax that must be processed to work in the present;
and the process does not support outputting files to this directory */
wesleyboar marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@import url("@tacc/core-styles/src/lib/_imports/components/c-button.css");
wesleyboar marked this conversation as resolved.
Show resolved Hide resolved

.c-button {
--max-width: unset;

font-size: 1.6rem;
}
Loading