mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-23 16:11:08 -05:00
Update website to use new reusable components for common elements
Refactor HTML templates to incorporate Django Cotton components for buttons, forms, and other UI elements. Replit-Commit-Author: Agent Replit-Commit-Session-Id: eff39de1-3afa-446d-a965-acaf61837fc7 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d6d61dac-164d-45dd-929f-7dcdfd771b64/eff39de1-3afa-446d-a965-acaf61837fc7/55dLPZG
This commit is contained in:
36
backend/templates/cotton/auth/turnstile_widget.html
Normal file
36
backend/templates/cotton/auth/turnstile_widget.html
Normal file
@@ -0,0 +1,36 @@
|
||||
{% comment %}
|
||||
Cotton Turnstile Widget Component
|
||||
Converts existing Cloudflare Turnstile widget to use Django Cotton's component system
|
||||
{% endcomment %}
|
||||
|
||||
<!-- Cotton Turnstile Widget Component -->
|
||||
<c-vars
|
||||
site_key="site_key"
|
||||
widget_classes="widget_classes|default:'turnstile'"
|
||||
widget_id="widget_id|default:'turnstile-widget'"
|
||||
theme="theme|default:'auto'"
|
||||
/>
|
||||
|
||||
<script
|
||||
src="https://challenges.cloudflare.com/turnstile/v0/api.js"
|
||||
async
|
||||
defer
|
||||
></script>
|
||||
|
||||
<div class="{{ widget_classes }}">
|
||||
<div
|
||||
id="{{ widget_id }}"
|
||||
class="cf-turnstile"
|
||||
data-sitekey="{{ site_key }}"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Apply theme to the Turnstile widget based on the retrieved theme
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const turnstileWidget = document.getElementById("{{ widget_id }}");
|
||||
if (turnstileWidget) {
|
||||
turnstileWidget.setAttribute("data-theme", "{{ theme }}");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user