Skip to content

Commit

Permalink
django-crispy-forms#118: Added missing "disabled" attribute to select…
Browse files Browse the repository at this point in the history
… template (django-crispy-forms#146)

* django-crispy-forms#118: Added missing "disabled" attribute to select template

* django-crispy-forms#118: Changed indentations to reduce git diff

* django-crispy-forms#118: Updated docs action

* django-crispy-forms#118: Updated CHANGELOG.md
  • Loading branch information
GitRon authored Jan 4, 2024
1 parent 4422619 commit 37a88b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* Dropped support for Python 3.6 (#116)
* Dropped support for Python 3.7 (#135)
* Increased minimum supported django-crispy-forms version to 2.0 (#135)
* Added docs about Tailwind CLI template discovery management command (#144)
* Fixed bug with select template and disabled property (#118)

## 0.5 (2021-04-21)
* Added support for custom widgets (#92)
Expand Down
5 changes: 3 additions & 2 deletions crispy_tailwind/templates/tailwind/layout/select.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
{% load l10n %}

<div class="relative">
<select class="{% if field.errors %}border border-red-500 {% endif %}bg-white focus:outline-none border border-gray-300 rounded-lg py-2 px-4 block w-full appearance-none leading-normal text-gray-700" name="{{ field.html_name }}" {{ field.field.widget.attrs|flatatt }}>
<select class="{% if field.errors %}border border-red-500 {% endif %}{% if field.field.disabled %}bg-gray-100{% else %}bg-white{% endif %} focus:outline-none border border-gray-300 rounded-lg py-2 px-4 block w-full appearance-none leading-normal text-gray-700"
name="{{ field.html_name }}" {{ field.field.widget.attrs|flatatt }}
{% if field.field.disabled %}disabled{% endif %}>
{% for value, label in field.field.choices %}
{% include "tailwind/layout/select_option.html" with value=value label=label %}
{% endfor %}
</select>
<div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/></svg>
</div>
</div>
</div>

0 comments on commit 37a88b6

Please sign in to comment.