mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-22 17:51:08 -05:00
- Added migration to convert unique_together constraints to UniqueConstraint for RideModel. - Introduced RideFormMixin for handling entity suggestions in ride forms. - Created comprehensive code standards documentation outlining formatting, docstring requirements, complexity guidelines, and testing requirements. - Established error handling guidelines with a structured exception hierarchy and best practices for API and view error handling. - Documented view pattern guidelines, emphasizing the use of CBVs, FBVs, and ViewSets with examples. - Implemented a benchmarking script for query performance analysis and optimization. - Developed security documentation detailing measures, configurations, and a security checklist. - Compiled a database optimization guide covering indexing strategies, query optimization patterns, and computed fields.
63 lines
3.6 KiB
HTML
63 lines
3.6 KiB
HTML
{% load widget_tweaks safe_html %}
|
|
{# Security: Icon SVGs are sanitized to prevent XSS. Only trusted SVG elements are allowed. #}
|
|
|
|
{% if type == 'button' or type == 'submit' or type == 'reset' %}
|
|
<button
|
|
type="{{ type|default:'button' }}"
|
|
{% if id %}id="{{ id }}"{% endif %}
|
|
class="inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50
|
|
{% if variant == 'destructive' %}bg-destructive text-destructive-foreground hover:bg-destructive/90
|
|
{% elif variant == 'outline' %}border border-input bg-background hover:bg-accent hover:text-accent-foreground
|
|
{% elif variant == 'secondary' %}bg-secondary text-secondary-foreground hover:bg-secondary/80
|
|
{% elif variant == 'ghost' %}hover:bg-accent hover:text-accent-foreground
|
|
{% elif variant == 'link' %}text-primary underline-offset-4 hover:underline
|
|
{% else %}bg-primary text-primary-foreground hover:bg-primary/90{% endif %}
|
|
{% if size == 'sm' %}h-9 rounded-md px-3
|
|
{% elif size == 'lg' %}h-11 rounded-md px-8
|
|
{% elif size == 'icon' %}h-10 w-10
|
|
{% else %}h-10 px-4 py-2{% endif %}
|
|
{{ class }}"
|
|
{% if disabled %}disabled{% endif %}
|
|
{% if onclick %}onclick="{{ onclick }}"{% endif %}
|
|
{% if hx_get %}hx-get="{{ hx_get }}"{% endif %}
|
|
{% if hx_post %}hx-post="{{ hx_post }}"{% endif %}
|
|
{% if hx_target %}hx-target="{{ hx_target }}"{% endif %}
|
|
{% if hx_swap %}hx-swap="{{ hx_swap }}"{% endif %}
|
|
{% if hx_indicator %}hx-indicator="{{ hx_indicator }}"{% endif %}
|
|
{% if x_data %}x-data="{{ x_data }}"{% endif %}
|
|
{% if x_on_click %}@click="{{ x_on_click }}"{% endif %}>
|
|
{% if icon %}
|
|
{{ icon|sanitize_svg }}
|
|
{% if label %}<span class="ml-2">{{ label }}</span>{% endif %}
|
|
{% else %}
|
|
{{ label|default:content }}
|
|
{% endif %}
|
|
{% block button_content %}{% endblock %}
|
|
</button>
|
|
{% else %}
|
|
<a
|
|
href="{{ href }}"
|
|
class="inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50
|
|
{% if variant == 'destructive' %}bg-destructive text-destructive-foreground hover:bg-destructive/90
|
|
{% elif variant == 'outline' %}border border-input bg-background hover:bg-accent hover:text-accent-foreground
|
|
{% elif variant == 'secondary' %}bg-secondary text-secondary-foreground hover:bg-secondary/80
|
|
{% elif variant == 'ghost' %}hover:bg-accent hover:text-accent-foreground
|
|
{% elif variant == 'link' %}text-primary underline-offset-4 hover:underline
|
|
{% else %}bg-primary text-primary-foreground hover:bg-primary/90{% endif %}
|
|
{% if size == 'sm' %}h-9 rounded-md px-3
|
|
{% elif size == 'lg' %}h-11 rounded-md px-8
|
|
{% elif size == 'icon' %}h-10 w-10
|
|
{% else %}h-10 px-4 py-2{% endif %}
|
|
{{ class }}"
|
|
{% if x_data %}x-data="{{ x_data }}"{% endif %}
|
|
{% if x_on_click %}@click="{{ x_on_click }}"{% endif %}>
|
|
{% if icon %}
|
|
{{ icon|sanitize_svg }}
|
|
{% if label %}<span class="ml-2">{{ label }}</span>{% endif %}
|
|
{% else %}
|
|
{{ label|default:content }}
|
|
{% endif %}
|
|
{% block link_content %}{% endblock %}
|
|
</a>
|
|
{% endif %}
|