mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-25 01:58:54 +02:00
feat: automated replacement
This commit is contained in:
9
app/templates/crispy-daisyui/accordion-group.html
Normal file
9
app/templates/crispy-daisyui/accordion-group.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<div class="tw:collapse tw:collapse-arrow tw:bg-base-100 tw:border tw:border-base-300{% if div.css_class %} {{div.css_class}}{% endif %}">
|
||||
<input type="radio" name="{{ div.data_parent }}" {% if div.active %}checked="checked"{% endif %} />
|
||||
<div class="tw:collapse-title tw:font-semibold">
|
||||
{{ div.name }}
|
||||
</div>
|
||||
<div class="tw:collapse-content">
|
||||
{{ fields|safe }}
|
||||
</div>
|
||||
</div>
|
||||
3
app/templates/crispy-daisyui/accordion.html
Normal file
3
app/templates/crispy-daisyui/accordion.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="tw:join tw:join-vertical tw:w-full{% if accordion.css_class %} {{accordion.css_class}}{% endif %}" id="{{ accordion.css_id }}">
|
||||
{{ content|safe }}
|
||||
</div>
|
||||
22
app/templates/crispy-daisyui/betterform.html
Normal file
22
app/templates/crispy-daisyui/betterform.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{% for fieldset in form.fieldsets %}
|
||||
<fieldset class="tw:fieldset fieldset-{{ forloop.counter }} {{ fieldset.classes }}">
|
||||
{% if fieldset.legend %}
|
||||
<legend class="tw:fieldset-legend">{{ fieldset.legend }}</legend>
|
||||
{% endif %}
|
||||
|
||||
{% if fieldset.description %}
|
||||
<p class="tw:text-sm tw:text-base-content/60">{{ fieldset.description }}</p>
|
||||
{% endif %}
|
||||
|
||||
{% for field in fieldset %}
|
||||
{% if field.is_hidden %}
|
||||
{{ field }}
|
||||
{% else %}
|
||||
{% include "crispy-daisyui/field.html" %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if not forloop.last or not fieldset_open %}
|
||||
</fieldset>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
9
app/templates/crispy-daisyui/display_form.html
Normal file
9
app/templates/crispy-daisyui/display_form.html
Normal file
@@ -0,0 +1,9 @@
|
||||
{% if form.form_html %}
|
||||
{% if include_media %}{{ form.media }}{% endif %}
|
||||
{% if form_show_errors %}
|
||||
{% include "crispy-daisyui/errors.html" %}
|
||||
{% endif %}
|
||||
{{ form.form_html }}
|
||||
{% else %}
|
||||
{% include "crispy-daisyui/uni_form.html" %}
|
||||
{% endif %}
|
||||
8
app/templates/crispy-daisyui/errors.html
Normal file
8
app/templates/crispy-daisyui/errors.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{% if form.non_field_errors %}
|
||||
<div class="tw:alert tw:alert-error">
|
||||
{% if form_error_title %}<h4 class="tw:font-bold">{{ form_error_title }}</h4>{% endif %}
|
||||
<ul class="tw:m-0 tw:list-disc tw:list-inside">
|
||||
{{ form.non_field_errors|unordered_list }}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
9
app/templates/crispy-daisyui/errors_formset.html
Normal file
9
app/templates/crispy-daisyui/errors_formset.html
Normal file
@@ -0,0 +1,9 @@
|
||||
{% if formset.non_form_errors %}
|
||||
<div class="tw:alert tw:alert-error">
|
||||
{% if formset_error_title %}<h4 class="tw:font-bold">{{ formset_error_title }}</h4>{% endif %}
|
||||
<ul class="tw:m-0 tw:list-disc tw:list-inside">
|
||||
{{ formset.non_form_errors|unordered_list }}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
71
app/templates/crispy-daisyui/field.html
Normal file
71
app/templates/crispy-daisyui/field.html
Normal file
@@ -0,0 +1,71 @@
|
||||
{% load crispy_forms_field %}
|
||||
|
||||
{% if field.is_hidden %}
|
||||
{{ field }}
|
||||
{% else %}
|
||||
{% if field|is_checkbox and tag != "td" %}
|
||||
<div class="tw:mb-3">
|
||||
{% if label_class %}
|
||||
<div class="{{ field_class }}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" class="{% if field|is_checkbox and form_show_labels %}tw:form-control{% else %}tw:mb-3{% endif %}{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
|
||||
{% if field.label and not field|is_checkbox and form_show_labels %}
|
||||
{% if field.use_fieldset %}<fieldset class="tw:fieldset"{% if field.aria_describedby %} aria-describedby="{{ field.aria_describedby }}"{% endif %}>{% endif %}
|
||||
<{% if field.use_fieldset %}legend{% else %}label{% endif %}
|
||||
{% if field.id_for_label %}for="{{ field.id_for_label }}"{% endif %} class="tw:label{% if label_class %} {{ label_class }}{% endif %}{% if field.field.required %} requiredField{% endif %}">
|
||||
{{ field.label }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
|
||||
</{% if field.use_fieldset %}legend{% else %}label{% endif %}>
|
||||
{% endif %}
|
||||
|
||||
{% if field|is_checkboxselectmultiple or field|is_radioselect %}
|
||||
{% include 'crispy-daisyui/layout/radio_checkbox_select.html' %}
|
||||
{% endif %}
|
||||
|
||||
{% if not field|is_checkboxselectmultiple and not field|is_radioselect %}
|
||||
{% if field|is_checkbox and form_show_labels %}
|
||||
{% if field.errors %}
|
||||
{% crispy_field field 'class' 'tw:checkbox tw:checkbox-error' %}
|
||||
{% else %}
|
||||
{% crispy_field field 'class' 'tw:checkbox' %}
|
||||
{% endif %}
|
||||
<label for="{{ field.id_for_label }}" class="tw:label{% if field.field.required %} requiredField{% endif %}">
|
||||
{{ field.label }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
|
||||
</label>
|
||||
{% include 'crispy-daisyui/layout/help_text_and_errors.html' %}
|
||||
{% else %}
|
||||
{% if field_class %}<div class="{{ field_class }}">{% endif %}
|
||||
{% if field|is_file %}
|
||||
{% include 'crispy-daisyui/layout/field_file.html' %}
|
||||
{% elif field|is_select %}
|
||||
{% if field.errors %}
|
||||
{% crispy_field field 'class' 'tw:select tw:select-bordered tw:select-error tw:w-full' %}
|
||||
{% else %}
|
||||
{% crispy_field field 'class' 'tw:select tw:select-bordered tw:w-full' %}
|
||||
{% endif %}
|
||||
{% elif field|is_checkbox %}
|
||||
{% if field.errors %}
|
||||
{% crispy_field field 'class' 'tw:checkbox tw:checkbox-error' %}
|
||||
{% else %}
|
||||
{% crispy_field field 'class' 'tw:checkbox' %}
|
||||
{% endif %}
|
||||
{% elif field.errors %}
|
||||
{% crispy_field field 'class' 'tw:input tw:input-bordered tw:input-error tw:w-full' %}
|
||||
{% else %}
|
||||
{% crispy_field field 'class' 'tw:input tw:input-bordered tw:w-full' %}
|
||||
{% endif %}
|
||||
{% if not field|is_file %}
|
||||
{% include 'crispy-daisyui/layout/help_text_and_errors.html' %}
|
||||
{% endif %}
|
||||
{% if field_class %}</div>{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if field.use_fieldset and field.label and form_show_labels %}</fieldset>{% endif %}
|
||||
</{% if tag %}{{ tag }}{% else %}div{% endif %}>
|
||||
{% if field|is_checkbox and tag != "td" %}
|
||||
{% if label_class %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
13
app/templates/crispy-daisyui/inputs.html
Normal file
13
app/templates/crispy-daisyui/inputs.html
Normal file
@@ -0,0 +1,13 @@
|
||||
{% if inputs %}
|
||||
<div class="tw:mb-3">
|
||||
{% if label_class %}
|
||||
<div class="aab {{ label_class }}"></div>
|
||||
{% endif %}
|
||||
|
||||
<div class="{{ field_class }}">
|
||||
{% for input in inputs %}
|
||||
{% include "crispy-daisyui/layout/baseinput.html" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
4
app/templates/crispy-daisyui/layout/alert.html
Normal file
4
app/templates/crispy-daisyui/layout/alert.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<div class="tw:alert {{ alert.css_class }}" role="alert"{% if alert.css_id %} id="{{ alert.css_id }}"{% endif %}>
|
||||
{{ content|safe }}
|
||||
{% if dismiss %}<button type="button" class="tw:btn tw:btn-sm tw:btn-circle tw:btn-ghost" data-bs-dismiss="alert" aria-label="Close">✕</button>{% endif %}
|
||||
</div>
|
||||
1
app/templates/crispy-daisyui/layout/attrs.html
Normal file
1
app/templates/crispy-daisyui/layout/attrs.html
Normal file
@@ -0,0 +1 @@
|
||||
{% for name, value in widget.attrs.items %}{% if value is not False %} {{ name }}{% if value is not True %}="{{ value|stringformat:'s' }}"{% endif %}{% endif %}{% endfor %}
|
||||
9
app/templates/crispy-daisyui/layout/baseinput.html
Normal file
9
app/templates/crispy-daisyui/layout/baseinput.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<input type="{{ input.input_type }}"
|
||||
name="{% if input.name|wordcount > 1 %}{{ input.name|slugify }}{% else %}{{ input.name }}{% endif %}"
|
||||
value="{{ input.value }}"
|
||||
{% if input.input_type != "hidden" %}
|
||||
class="tw:btn {{ input.field_classes }}"
|
||||
id="{% if input.id %}{{ input.id }}{% else %}{{ input.input_type }}-id-{{ input.name|slugify }}{% endif %}"
|
||||
{% endif %}
|
||||
{{ input.flat_attrs }}
|
||||
/>
|
||||
1
app/templates/crispy-daisyui/layout/button.html
Normal file
1
app/templates/crispy-daisyui/layout/button.html
Normal file
@@ -0,0 +1 @@
|
||||
<button class="tw:btn" {{ button.flat_attrs }}>{{ button.content|safe }}</button>
|
||||
4
app/templates/crispy-daisyui/layout/buttonholder.html
Normal file
4
app/templates/crispy-daisyui/layout/buttonholder.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<div {% if buttonholder.css_id %}id="{{ buttonholder.css_id }}"{% endif %}
|
||||
class="tw:flex tw:gap-2{% if buttonholder.css_class %} {{ buttonholder.css_class }}{% endif %}">
|
||||
{{ fields_output|safe }}
|
||||
</div>
|
||||
@@ -0,0 +1,16 @@
|
||||
{% if field.is_hidden %}
|
||||
{{ field }}
|
||||
{% else %}
|
||||
<div id="div_{{ field.auto_id }}" class="tw:mb-3{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
|
||||
|
||||
{% if field.label %}
|
||||
<fieldset class="tw:fieldset"{% if field.aria_describedby %} aria-describedby="{{ field.aria_describedby }}"{% endif %}>
|
||||
<legend for="{{ field.id_for_label }}" class="tw:fieldset-legend {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
|
||||
{{ field.label }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
|
||||
</legend>
|
||||
{% endif %}
|
||||
|
||||
{% include 'crispy-daisyui/layout/radio_checkbox_select.html' %}
|
||||
{% if field.label %}</fieldset>{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
6
app/templates/crispy-daisyui/layout/column.html
Normal file
6
app/templates/crispy-daisyui/layout/column.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<div {% if div.css_id %}id="{{ div.css_id }}"{% endif %}
|
||||
class="tw:col-span-12 {{ div.css_class|default:'' }}" {{ div.flat_attrs }}>
|
||||
{{ fields|safe }}
|
||||
</div>
|
||||
|
||||
|
||||
4
app/templates/crispy-daisyui/layout/div.html
Normal file
4
app/templates/crispy-daisyui/layout/div.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<div {% if div.css_id %}id="{{ div.css_id }}"{% endif %}
|
||||
{% if div.css_class %}class="{{ div.css_class }}"{% endif %} {{ div.flat_attrs }}>
|
||||
{{ fields|safe }}
|
||||
</div>
|
||||
12
app/templates/crispy-daisyui/layout/field_errors.html
Normal file
12
app/templates/crispy-daisyui/layout/field_errors.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% if form_show_errors and field.errors %}
|
||||
{% if field.errors.field_id %}
|
||||
{# Django 5.2+ #}
|
||||
<div id="{{field.errors.field_id}}_error" class="tw:text-error tw:text-sm tw:mt-1">
|
||||
{% else %}
|
||||
<div id="{{field.auto_id}}_error" class="tw:text-error tw:text-sm tw:mt-1">
|
||||
{% endif %}
|
||||
{% for error in field.errors %}
|
||||
<span id="error_{{ forloop.counter }}_{{ field.auto_id }}"><strong>{{ error }}</strong></span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
12
app/templates/crispy-daisyui/layout/field_errors_block.html
Normal file
12
app/templates/crispy-daisyui/layout/field_errors_block.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% if form_show_errors and field.errors %}
|
||||
{% if field.errors.field_id %}
|
||||
{# Django 5.2+ #}
|
||||
<div id="{{field.errors.field_id}}_error" class="tw:text-error tw:text-sm tw:mt-1">
|
||||
{% else %}
|
||||
<div id="{{field.auto_id}}_error" class="tw:text-error tw:text-sm tw:mt-1">
|
||||
{% endif %}
|
||||
{% for error in field.errors %}
|
||||
<p id="error_{{ forloop.counter }}_{{ field.auto_id }}"><strong>{{ error }}</strong></p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
26
app/templates/crispy-daisyui/layout/field_file.html
Normal file
26
app/templates/crispy-daisyui/layout/field_file.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{% load crispy_forms_field %}
|
||||
|
||||
{% for widget in field.subwidgets %}
|
||||
{% if widget.data.is_initial %}
|
||||
<div class="tw:join tw:mb-2 tw:w-full">
|
||||
<span class="tw:btn tw:btn-disabled tw:join-item">{{ widget.data.initial_text }}</span>
|
||||
<div class="tw:input tw:input-bordered tw:join-item tw:flex tw:items-center tw:flex-grow">
|
||||
<span class="tw:break-all tw:flex-grow">
|
||||
<a href="{{ field.value.url }}" class="tw:link">{{ field.value.name }}</a>
|
||||
</span>
|
||||
{% if not widget.data.required %}
|
||||
<span class="tw:ml-2">
|
||||
<label class="tw:label tw:cursor-pointer tw:gap-2">
|
||||
<input type="checkbox" name="{{ widget.data.checkbox_name }}" id="{{ widget.data.checkbox_id }}" class="tw:checkbox"{% if field.field.disabled %} disabled{% endif %} >
|
||||
<span class="tw:label-text">{{ widget.data.clear_checkbox_label }}</span>
|
||||
</label>
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div{% if field.errors %} class="tw:input-error"{%endif%}>
|
||||
<input type="{{ widget.data.type }}" name="{{ widget.data.name }}" class="tw:file-input tw:file-input-bordered tw:w-full{% if widget.data.attrs.class %} {{ widget.data.attrs.class }}{% endif %}{% if field.errors %} tw:input-error{%endif%}"{% if field.field.disabled %} disabled{% endif %}{% for name, value in widget.data.attrs.items %}{% if value is not False and name != 'class' %} {{ name }}{% if value is not True %}="{{ value|stringformat:'s' }}"{% endif %}{% endif %}{% endfor %}>
|
||||
{% include 'crispy-daisyui/layout/help_text_and_errors.html' %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
39
app/templates/crispy-daisyui/layout/field_with_buttons.html
Normal file
39
app/templates/crispy-daisyui/layout/field_with_buttons.html
Normal file
@@ -0,0 +1,39 @@
|
||||
{% load crispy_forms_field %}
|
||||
|
||||
<div{% if div.css_id %} id="{{ div.css_id }}"{% endif %} class="tw:mb-3{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}{% if div.css_class %} {{ div.css_class }}{% endif %}" {{ div.flat_attrs }}>
|
||||
{% if field.label and form_show_labels %}
|
||||
<label for="{{ field.id_for_label }}" class="tw:label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
|
||||
<span class="tw:label-text">{{ field.label }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}</span>
|
||||
</label>
|
||||
{% endif %}
|
||||
|
||||
<div{% if field_class %} class="{{ field_class }}"{% endif %}>
|
||||
<div class="tw:join tw:w-full{% if input_size %} {{ input_size }}{% endif %}">
|
||||
{% if field|is_select %}
|
||||
{% if field.errors %}
|
||||
{% crispy_field field 'class' 'tw:select tw:select-bordered tw:select-error tw:join-item tw:flex-grow' %}
|
||||
{% else %}
|
||||
{% crispy_field field 'class' 'tw:select tw:select-bordered tw:join-item tw:flex-grow' %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if field.errors %}
|
||||
{% crispy_field field 'class' 'tw:input tw:input-bordered tw:input-error tw:join-item tw:flex-grow' %}
|
||||
{% else %}
|
||||
{% crispy_field field 'class' 'tw:input tw:input-bordered tw:join-item tw:flex-grow' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{{ buttons|safe }}
|
||||
</div>
|
||||
{% if field.errors.field_id %}
|
||||
{# Django 5.2+ #}
|
||||
<div id="{{field.errors.field_id}}_error" class="tw:text-error tw:text-sm tw:mt-1">
|
||||
{% else %}
|
||||
<div id="{{field.auto_id}}_error" class="tw:text-error tw:text-sm tw:mt-1">
|
||||
{% endif %}
|
||||
{% for error in field.errors %}
|
||||
<p id="error_{{ forloop.counter }}_{{ field.auto_id }}"><small><strong>{{ error }}</strong></small></p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% include 'crispy-daisyui/layout/help_text.html' %}
|
||||
</div>
|
||||
</div>
|
||||
6
app/templates/crispy-daisyui/layout/fieldset.html
Normal file
6
app/templates/crispy-daisyui/layout/fieldset.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<fieldset {% if fieldset.css_id %}id="{{ fieldset.css_id }}"{% endif %}
|
||||
class="tw:fieldset{% if fieldset.css_class %} {{ fieldset.css_class }}{% endif %}"
|
||||
{{ fieldset.flat_attrs }}>
|
||||
{% if legend %}<legend class="tw:fieldset-legend">{{ legend|safe }}</legend>{% endif %}
|
||||
{{ fields|safe }}
|
||||
</fieldset>
|
||||
28
app/templates/crispy-daisyui/layout/floating_field.html
Normal file
28
app/templates/crispy-daisyui/layout/floating_field.html
Normal file
@@ -0,0 +1,28 @@
|
||||
{% load crispy_forms_field %}
|
||||
|
||||
{% if field.is_hidden %}
|
||||
{{ field }}
|
||||
{% else %}
|
||||
<{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" class="tw:mb-3{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
|
||||
|
||||
<label class="tw:input tw:input-bordered tw:flex tw:items-center tw:gap-2" {% if field.id_for_label %}for="{{ field.id_for_label }}"{% endif %}{% if label_class %} {{ label_class }}{% endif %}>
|
||||
{{ field.label }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
|
||||
{% if field|is_select %}
|
||||
{%if field.errors %}
|
||||
{% crispy_field field 'class' 'tw:select tw:select-bordered tw:select-error tw:grow' 'placeholder' field.name %}
|
||||
{% else %}
|
||||
{% crispy_field field 'class' 'tw:select tw:select-bordered tw:grow' 'placeholder' field.name %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if field.errors %}
|
||||
{% crispy_field field 'class' 'tw:grow' 'placeholder' field.name %}
|
||||
{% else %}
|
||||
{% crispy_field field 'class' 'tw:grow' 'placeholder' field.name %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</label>
|
||||
|
||||
{% include 'crispy-daisyui/layout/help_text_and_errors.html' %}
|
||||
|
||||
</{% if tag %}{{ tag }}{% else %}div{% endif %}>
|
||||
{% endif %}
|
||||
11
app/templates/crispy-daisyui/layout/formactions.html
Normal file
11
app/templates/crispy-daisyui/layout/formactions.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<div
|
||||
{% if formactions.flat_attrs %}{{ formactions.flat_attrs }}{% endif %}
|
||||
class="tw:mb-3 tw:flex tw:gap-2 {{ formactions.css_class|default:'' }} {{ field_class }}"
|
||||
{% if formactions.id %} id="{{ formactions.id }}"{% endif %}>
|
||||
{% if label_class %}
|
||||
<div class="aab {{ label_class }}"></div>
|
||||
{% endif %}
|
||||
<div class="{{ field_class }}">
|
||||
{{ fields_output|safe }}
|
||||
</div>
|
||||
</div>
|
||||
7
app/templates/crispy-daisyui/layout/help_text.html
Normal file
7
app/templates/crispy-daisyui/layout/help_text.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{% if field.help_text %}
|
||||
{% if help_text_inline %}
|
||||
<span id="{{ field.auto_id }}_helptext" class="tw:text-sm tw:text-base-content/60">{{ field.help_text|safe}}</span>
|
||||
{% else %}
|
||||
<div {% if field.auto_id %}id="{{ field.auto_id }}_helptext" {% endif %}class="tw:text-sm tw:text-base-content/60 tw:mt-1">{{ field.help_text|safe }}</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@@ -0,0 +1,13 @@
|
||||
{% if help_text_inline and not error_text_inline %}
|
||||
{% include 'bootstrap5/layout/help_text.html' %}
|
||||
{% endif %}
|
||||
|
||||
{% if error_text_inline %}
|
||||
{% include 'bootstrap5/layout/field_errors.html' %}
|
||||
{% else %}
|
||||
{% include 'bootstrap5/layout/field_errors_block.html' %}
|
||||
{% endif %}
|
||||
|
||||
{% if not help_text_inline %}
|
||||
{% include 'bootstrap5/layout/help_text.html' %}
|
||||
{% endif %}
|
||||
26
app/templates/crispy-daisyui/layout/inline_field.html
Normal file
26
app/templates/crispy-daisyui/layout/inline_field.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{% load crispy_forms_field %}
|
||||
|
||||
{% if field.is_hidden %}
|
||||
{{ field }}
|
||||
{% else %}
|
||||
{% if field|is_checkbox %}
|
||||
<div id="div_{{ field.auto_id }}" class="tw:form-control tw:inline-flex{% if wrapper_class %} {{ wrapper_class }}{% endif %}">
|
||||
<label class="tw:label tw:cursor-pointer tw:gap-2">
|
||||
{% crispy_field field 'class' 'tw:checkbox' %}
|
||||
<span class="tw:label-text">{{ field.label }}</span>
|
||||
</label>
|
||||
</div>
|
||||
{% else %}
|
||||
<div id="div_{{ field.auto_id }}"{% if wrapper_class %} class="{{ wrapper_class }}"{% endif %}>
|
||||
<label for="{{ field.id_for_label }}" class="tw:sr-only">
|
||||
{{ field.label }}
|
||||
</label>
|
||||
{% if field.errors %}
|
||||
{% crispy_field field 'class' 'tw:input tw:input-bordered tw:input-error' 'placeholder' field.label %}
|
||||
{% else %}
|
||||
{% crispy_field field 'class' 'tw:input tw:input-bordered' 'placeholder' field.label %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
11
app/templates/crispy-daisyui/layout/modal.html
Normal file
11
app/templates/crispy-daisyui/layout/modal.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<div id="{{ modal.css_id }}" class="tw:modal {{ modal.css_class }}" {{ modal.flat_attrs }}>
|
||||
<div class="tw:modal-box" role="document">
|
||||
<form method="dialog">
|
||||
<button class="tw:btn tw:btn-sm tw:btn-circle tw:btn-ghost tw:absolute tw:right-2 tw:top-2" aria-label="Close">✕</button>
|
||||
</form>
|
||||
<h3 class="tw:font-bold tw:text-lg {{ modal.title_class }}" id="{{ modal.title_id }}-label">{{ modal.title }}</h3>
|
||||
<div class="tw:py-4">
|
||||
{{ fields }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
27
app/templates/crispy-daisyui/layout/multifield.html
Normal file
27
app/templates/crispy-daisyui/layout/multifield.html
Normal file
@@ -0,0 +1,27 @@
|
||||
{% load crispy_forms_field %}
|
||||
|
||||
{% if field.is_hidden %}
|
||||
{{ field }}
|
||||
{% else %}
|
||||
|
||||
{% if field.label %}
|
||||
<label for="{{ field.id_for_label }}" class="tw:label{% if labelclass %} {{ labelclass }}{% endif %}">
|
||||
{% endif %}
|
||||
|
||||
{% if field|is_checkbox %}
|
||||
{% crispy_field field %}
|
||||
{% endif %}
|
||||
|
||||
{% if field.label %}
|
||||
<span class="tw:label-text">{{ field.label }}</span>
|
||||
{% endif %}
|
||||
|
||||
{% if not field|is_checkbox %}
|
||||
{% crispy_field field %}
|
||||
{% endif %}
|
||||
|
||||
{% if field.label %}
|
||||
</label>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
@@ -0,0 +1,50 @@
|
||||
{% load crispy_forms_field %}
|
||||
|
||||
{% if field.is_hidden %}
|
||||
{{ field }}
|
||||
{% else %}
|
||||
<div id="div_{{ field.auto_id }}" class="tw:mb-3{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_group_wrapper_class %} {{ form_group_wrapper_class }}{% endif %}{% if form_show_errors and field.errors %} tw:has-error{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
|
||||
|
||||
{% if field.label and form_show_labels %}
|
||||
<label for="{{ field.id_for_label }}" class="tw:label{{ label_class }}{% if field.field.required %} requiredField{% endif %}">
|
||||
<span class="tw:label-text">{{ field.label }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}</span>
|
||||
</label>
|
||||
{% endif %}
|
||||
|
||||
<div {% if field_class %}class="{{ field_class }}"{% endif %}>
|
||||
<label class="tw:input tw:input-bordered tw:flex tw:items-center tw:gap-2{% if input_size %} {{ input_size }}{% endif %}{% if field.errors %} tw:input-error{% endif %}">
|
||||
{# prepend #}
|
||||
{% if crispy_prepended_text %}
|
||||
<span>{{ crispy_prepended_text }}</span>
|
||||
{% endif %}
|
||||
|
||||
{# input #}
|
||||
{% if field|is_select %}
|
||||
{% if field.errors %}
|
||||
{% crispy_field field 'class' 'tw:select tw:select-bordered tw:select-error tw:w-full' %}
|
||||
{% else %}
|
||||
{% crispy_field field 'class' 'tw:select tw:select-bordered tw:w-full' %}
|
||||
{% endif %}
|
||||
{% elif field.errors %}
|
||||
{% crispy_field field 'class' 'tw:grow' %}
|
||||
{% else %}
|
||||
{% crispy_field field 'class' 'tw:grow' %}
|
||||
{% endif %}
|
||||
|
||||
{# append #}
|
||||
{% if crispy_appended_text %}
|
||||
<span>{{ crispy_appended_text }}</span>
|
||||
{% endif %}
|
||||
</label>
|
||||
{% if error_text_inline %}
|
||||
{% include 'crispy-daisyui/layout/field_errors.html' %}
|
||||
{% else %}
|
||||
{% include 'crispy-daisyui/layout/field_errors_block.html' %}
|
||||
{% endif %}
|
||||
{% if not help_text_inline %}
|
||||
{% include 'crispy-daisyui/layout/help_text.html' %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,34 @@
|
||||
{% load crispy_forms_filters %}
|
||||
{% load l10n %}
|
||||
|
||||
<div {% if field_class %}class="{{ field_class }}"{% endif %}{% if flat_attrs %} {{ flat_attrs }}{% endif %}>
|
||||
|
||||
{% for group, options, index in field|optgroups %}
|
||||
{% if group %}<strong class="tw:font-bold tw:mb-2 tw:block">{{ group }}</strong>{% endif %}
|
||||
{% for option in options %}
|
||||
<div class="tw:form-control{% if inline_class %} tw:inline-flex{% endif %}">
|
||||
<label class="tw:label tw:cursor-pointer{% if inline_class %} tw:inline-flex{% endif %}">
|
||||
<input type="{{option.type}}" class="{% if option.type == 'radio' %}tw:radio{% else %}tw:checkbox{% endif %}{% if field.errors %} tw:{% if option.type == 'radio' %}radio{% else %}checkbox{% endif %}-error{% endif %} tw:me-2" name="{{ field.html_name }}" value="{{ option.value|unlocalize }}" {% include "crispy-daisyui/layout/attrs.html" with widget=option %}>
|
||||
<span class="tw:label-text">{{ option.label|unlocalize }}</span>
|
||||
</label>
|
||||
{% if field.errors and forloop.last and not inline_class and forloop.parentloop.last %}
|
||||
{% include 'crispy-daisyui/layout/field_errors_block.html' %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
{% if field.errors and inline_class %}
|
||||
{% if field.errors.field_id %}
|
||||
{# Django 5.2+ #}
|
||||
<div id="{{field.errors.field_id}}_error" class="tw:text-error tw:text-sm tw:mt-1">
|
||||
{% else %}
|
||||
<div id="{{field.auto_id}}_error" class="tw:text-error tw:text-sm tw:mt-1">
|
||||
{% endif %}
|
||||
{% for error in field.errors %}
|
||||
<p id="error_{{ forloop.counter }}_{{ field.auto_id }}"><strong>{{ error }}</strong></p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% include 'crispy-daisyui/layout/help_text.html' %}
|
||||
16
app/templates/crispy-daisyui/layout/radioselect_inline.html
Normal file
16
app/templates/crispy-daisyui/layout/radioselect_inline.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{% if field.is_hidden %}
|
||||
{{ field }}
|
||||
{% else %}
|
||||
<div id="div_{{ field.auto_id }}" class="tw:mb-3{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
|
||||
|
||||
{% if field.label %}
|
||||
<fieldset class="tw:fieldset"{% if field.aria_describedby %} aria-describedby="{{ field.aria_describedby }}"{% endif %}>
|
||||
<legend for="{{ field.id_for_label }}" class="tw:fieldset-legend {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
|
||||
{{ field.label }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
|
||||
</legend>
|
||||
{% endif %}
|
||||
|
||||
{% include 'crispy-daisyui/layout/radio_checkbox_select.html' %}
|
||||
{% if field.label %}</fieldset>{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
3
app/templates/crispy-daisyui/layout/row.html
Normal file
3
app/templates/crispy-daisyui/layout/row.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<div {% if div.css_id %}id="{{ div.css_id }}"{% endif %} class="tw:grid tw:grid-cols-12 tw:gap-4 {{ div.css_class|default:'' }}" {{ div.flat_attrs }}>
|
||||
{{ fields|safe }}
|
||||
</div>
|
||||
19
app/templates/crispy-daisyui/layout/switch.html
Normal file
19
app/templates/crispy-daisyui/layout/switch.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{% load crispy_forms_field %}
|
||||
|
||||
{% if field.is_hidden %}
|
||||
{{ field }}
|
||||
{% else %}
|
||||
<{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" class="tw:form-control tw:mb-3{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
|
||||
<div class="{{ field_class }}">
|
||||
{% if field.errors %}
|
||||
{% crispy_field field 'class' 'tw:toggle tw:toggle-error' 'role' 'switch' %}
|
||||
{% else %}
|
||||
{% crispy_field field 'class' 'tw:toggle' 'role' 'switch' %}
|
||||
{% endif %}
|
||||
<label for="{{ field.id_for_label }}" class="tw:label{% if field.field.required %} requiredField{% endif %}">
|
||||
{{ field.label }}
|
||||
</label>
|
||||
{% include 'crispy-daisyui/layout/help_text_and_errors.html' %}
|
||||
</div>
|
||||
</{% if tag %}{{ tag }}{% else %}div{% endif %}>
|
||||
{% endif %}
|
||||
1
app/templates/crispy-daisyui/layout/tab-link.html
Normal file
1
app/templates/crispy-daisyui/layout/tab-link.html
Normal file
@@ -0,0 +1 @@
|
||||
<input type="radio" name="{{ link.css_id }}_tabs" role="tab" class="tw:tab{% if 'active' in link.css_class %} tw:tab-active{% endif %}" aria-label="{{ link.name|capfirst }}{% if tab.errors %}!{% endif %}" {% if 'active' in link.css_class %}checked="checked"{% endif %} />
|
||||
4
app/templates/crispy-daisyui/layout/tab.html
Normal file
4
app/templates/crispy-daisyui/layout/tab.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<div role="tablist" class="tw:tabs tw:tabs-lifted{% if tabs.css_class %} {{ tabs.css_class }}{% endif %}"{% if tabs.css_id %} id="{{ tabs.css_id }}"{% endif %}>
|
||||
{{ links|safe }}
|
||||
{{ content|safe }}
|
||||
</div>
|
||||
12
app/templates/crispy-daisyui/layout/uneditable_input.html
Normal file
12
app/templates/crispy-daisyui/layout/uneditable_input.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% load crispy_forms_field %}
|
||||
|
||||
|
||||
<div id="div_{{ field.auto_id }}" class="tw:mb-3{% if form_show_errors and field.errors %} tw:error{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
|
||||
<label class="tw:label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
|
||||
<span class="tw:label-text">{{ field.label }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}</span>
|
||||
</label>
|
||||
<div class="{{ field_class }}">
|
||||
{% crispy_field field 'disabled' 'disabled' %}
|
||||
{% include 'crispy-daisyui/layout/help_text.html' %}
|
||||
</div>
|
||||
</div>
|
||||
57
app/templates/crispy-daisyui/table_inline_formset.html
Normal file
57
app/templates/crispy-daisyui/table_inline_formset.html
Normal file
@@ -0,0 +1,57 @@
|
||||
{% load crispy_forms_tags %}
|
||||
{% load crispy_forms_utils %}
|
||||
{% load crispy_forms_field %}
|
||||
|
||||
{% specialspaceless %}
|
||||
{% if formset_tag %}
|
||||
<form {{ flat_attrs }} method="{{ form_method }}" {% if formset.is_multipart %} enctype="multipart/form-data"{% endif %}>
|
||||
{% endif %}
|
||||
{% if formset_method|lower == 'post' and not disable_csrf %}
|
||||
{% csrf_token %}
|
||||
{% endif %}
|
||||
|
||||
<div>
|
||||
{{ formset.management_form|crispy }}
|
||||
</div>
|
||||
|
||||
<table{% if form_id %} id="{{ form_id }}_table"{% endif%} class="tw:table tw:table-zebra tw:table-sm">
|
||||
<thead>
|
||||
{% if formset.readonly and not formset.queryset.exists %}
|
||||
{% else %}
|
||||
<tr>
|
||||
{% for field in formset.forms.0 %}
|
||||
{% if field.label and not field.is_hidden %}
|
||||
<th for="{{ field.auto_id }}" class="{% if field.field.required %}requiredField{% endif %}">
|
||||
{{ field.label }}{% if field.field.required and not field|is_checkbox %}<span class="asteriskField">*</span>{% endif %}
|
||||
</th>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr class="tw:hidden empty-form">
|
||||
{% for field in formset.empty_form %}
|
||||
{% include 'crispy-daisyui/field.html' with tag="td" form_show_labels=False %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
||||
{% for form in formset %}
|
||||
{% if form_show_errors and not form.is_extra %}
|
||||
{% include "crispy-daisyui/errors.html" %}
|
||||
{% endif %}
|
||||
|
||||
<tr>
|
||||
{% for field in form %}
|
||||
{% include 'crispy-daisyui/field.html' with tag="td" form_show_labels=False %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% include "crispy-daisyui/inputs.html" %}
|
||||
|
||||
{% if formset_tag %}</form>{% endif %}
|
||||
{% endspecialspaceless %}
|
||||
11
app/templates/crispy-daisyui/uni_form.html
Normal file
11
app/templates/crispy-daisyui/uni_form.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{% load crispy_forms_utils %}
|
||||
|
||||
{% specialspaceless %}
|
||||
{% if include_media %}{{ form.media }}{% endif %}
|
||||
{% if form_show_errors %}
|
||||
{% include "crispy-daisyui/errors.html" %}
|
||||
{% endif %}
|
||||
{% for field in form %}
|
||||
{% include field_template %}
|
||||
{% endfor %}
|
||||
{% endspecialspaceless %}
|
||||
8
app/templates/crispy-daisyui/uni_formset.html
Normal file
8
app/templates/crispy-daisyui/uni_formset.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{% with formset.management_form as form %}
|
||||
{% include 'crispy-daisyui/uni_form.html' %}
|
||||
{% endwith %}
|
||||
{% for form in formset %}
|
||||
<div class="tw:mb-4">
|
||||
{% include 'crispy-daisyui/uni_form.html' %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
14
app/templates/crispy-daisyui/whole_uni_form.html
Normal file
14
app/templates/crispy-daisyui/whole_uni_form.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{% load crispy_forms_utils %}
|
||||
|
||||
{% specialspaceless %}
|
||||
{% if form_tag %}<form {{ flat_attrs }} method="{{ form_method }}" {% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>{% endif %}
|
||||
{% if form_method|lower == 'post' and not disable_csrf %}
|
||||
{% csrf_token %}
|
||||
{% endif %}
|
||||
|
||||
{% include "crispy-daisyui/display_form.html" %}
|
||||
|
||||
{% include "crispy-daisyui/inputs.html" %}
|
||||
|
||||
{% if form_tag %}</form>{% endif %}
|
||||
{% endspecialspaceless %}
|
||||
30
app/templates/crispy-daisyui/whole_uni_formset.html
Normal file
30
app/templates/crispy-daisyui/whole_uni_formset.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{% load crispy_forms_tags %}
|
||||
{% load crispy_forms_utils %}
|
||||
|
||||
{% specialspaceless %}
|
||||
{% if formset_tag %}
|
||||
<form {{ flat_attrs }} method="{{ form_method }}" {% if formset.is_multipart %} enctype="multipart/form-data"{% endif %}>
|
||||
{% endif %}
|
||||
{% if formset_method|lower == 'post' and not disable_csrf %}
|
||||
{% csrf_token %}
|
||||
{% endif %}
|
||||
|
||||
<div>
|
||||
{{ formset.management_form|crispy }}
|
||||
</div>
|
||||
|
||||
{% include "crispy-daisyui/errors_formset.html" %}
|
||||
|
||||
{% for form in formset %}
|
||||
{% include "crispy-daisyui/display_form.html" %}
|
||||
{% endfor %}
|
||||
|
||||
{% if inputs %}
|
||||
<div class="tw:flex tw:gap-2 tw:mt-4">
|
||||
{% for input in inputs %}
|
||||
{% include "crispy-daisyui/layout/baseinput.html" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if formset_tag %}</form>{% endif %}
|
||||
{% endspecialspaceless %}
|
||||
Reference in New Issue
Block a user