Skip to content

Commit

Permalink
fix(settings): tup-308, new form templates by #500
Browse files Browse the repository at this point in the history
Not a straight clone of #500.

I added a little CSS and a small document to avoid cloning one template.

See:
- default.html.md
- django.cms.forms.css
  • Loading branch information
wesleyboar committed Jul 6, 2022
1 parent d813bee commit 8a46a21
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Reference:
Styleguide Components.DjangoCMS.Blog.App
*/
@import url("@tacc/core-styles/src/lib/_imports/components/c-button.css");



Expand Down Expand Up @@ -94,3 +95,12 @@ ul.checkboxselectmultiple {
.button-wrapper {
margin-top: 35px;
}



/* Button */

.button-wrapper button {
@extend .c-button;
@extend .c-button--primary;
}
19 changes: 19 additions & 0 deletions taccsite_cms/templates/captcha/widget_v2_checkbox.custom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{# https://github.com/torchbox/django-recaptcha/blob/4921a6c/captcha/templates/captcha/widget_v2_checkbox.html #}
{# https://developers.google.com/recaptcha/docs/display#config #}
{% load static %}

{% include "captcha/includes/js_v2_checkbox.html" %}
<noscript>Never mind. We assume you are not a robot.</noscript>
<button
class="g-recaptcha c-button c-button--secondary"
id="tacc-spam-toggle-{{ widget_uuid }}"
data-sitekey="{% for name, value in widget.attrs.items %}{% ifequal name 'data-sitekey' %}{{ value }}{% endifequal %}{% endfor %}"
data-callback="onSubmit_{{ widget_uuid }}"
data-badge="bottomright"
hidden
>
I am not a robot
</button>
<script>
document.getElementById('tacc-spam-toggle-{{ widget_uuid }}').hidden = false;
</script>
7 changes: 7 additions & 0 deletions taccsite_cms/templates/captcha/widget_v2_checkbox.custom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# TACC CMS - Templates - Custom Captcha

Default captcha (`django-recaptcha` via `django-forms-maintained`) is limited.

You can use the `.custom` template to create a custom captcha interface.

To use, clone the `.custom` file and remove `.custom` from the new file's name.
85 changes: 0 additions & 85 deletions taccsite_cms/templates/djangocms_forms/form_template/default.html

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# TACC CMS - Templates - Default Form

The [original template] could have been cloned and edited.

But, to avoid that[^1], the two changes have been performed other ways:

1. [Remove redundant load of `google.com/recaptcha/api.js`.][1]
2. [Add `c-button` class styles to form submit button via CSS not markup.][2]

[^1]: Avoid editing the template because it does not use `block`s (which means we need to clone the whole template; which means if the [original template] changes, and we update form plugin, ours will become out of date).

[original template]: https://github.com/avryhof/djangocms-forms/blob/30f4643/djangocms_forms/templates/djangocms_forms/form_template/default.html
[1]: https://github.com/avryhof/djangocms-forms/pull/12
[2]: ../../../static/site_cms/css/src/_imports/components/django.cms.forms.css#L103

0 comments on commit 8a46a21

Please sign in to comment.