admin: fix rendering of FileInput
This commit is contained in:
parent
0a2c0464df
commit
5c5adfcccc
|
@ -31,6 +31,7 @@ class ApplicationForm(forms.ModelForm):
|
||||||
"name": forms.TextInput(),
|
"name": forms.TextInput(),
|
||||||
"meta_launch_url": forms.TextInput(),
|
"meta_launch_url": forms.TextInput(),
|
||||||
"meta_publisher": forms.TextInput(),
|
"meta_publisher": forms.TextInput(),
|
||||||
|
"meta_icon": forms.FileInput(),
|
||||||
}
|
}
|
||||||
help_texts = {
|
help_texts = {
|
||||||
"meta_launch_url": _(
|
"meta_launch_url": _(
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% elif field.field.widget|fieldtype == "ClearableFileInput" %}
|
{% elif field.field.widget|fieldtype == "FileInput" %}
|
||||||
<div class="pf-c-form__group-label">
|
<div class="pf-c-form__group-label">
|
||||||
<label class="pf-c-form__label" for="{{ field.name }}-{{ forloop.counter0 }}">
|
<label class="pf-c-form__label" for="{{ field.name }}-{{ forloop.counter0 }}">
|
||||||
<span class="pf-c-form__label-text">{{ field.label }}</span>
|
<span class="pf-c-form__label-text">{{ field.label }}</span>
|
||||||
|
@ -68,13 +68,17 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="pf-c-form__group-control">
|
<div class="pf-c-form__group-control">
|
||||||
<div class="c-form__horizontal-group">
|
<div class="c-form__horizontal-group">
|
||||||
<div class="pf-c-file-upload">
|
{{ field|css_class:"pf-c-form-control" }}
|
||||||
<div class="pf-c-file-upload__file-select">
|
{% if field.help_text %}
|
||||||
<div class="pf-c-input-group">
|
<p class="pf-c-form__helper-text">{{ field.help_text|safe }}</p>
|
||||||
{{ field|css_class:"pf-c-form-control" }}
|
{% endif %}
|
||||||
</div>
|
{% if field.value %}
|
||||||
</div>
|
<a target="_blank" href="{{ field.value.url }}" class="pf-c-form__helper-text">
|
||||||
</div>
|
{% blocktrans with current=field.value %}
|
||||||
|
Currently set to {{current}}.
|
||||||
|
{% endblocktrans %}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -95,13 +95,6 @@ def form_verbose_name(obj) -> str:
|
||||||
return verbose_name(obj._meta.model)
|
return verbose_name(obj._meta.model)
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
|
||||||
def debug(obj) -> str:
|
|
||||||
"""Output object to logger"""
|
|
||||||
LOGGER.debug(obj)
|
|
||||||
return ""
|
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def doc(obj) -> str:
|
def doc(obj) -> str:
|
||||||
"""Return docstring of object"""
|
"""Return docstring of object"""
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -52,6 +52,9 @@ export class ModalButton extends LitElement {
|
||||||
updateHandlers() {
|
updateHandlers() {
|
||||||
// Ensure links close the modal
|
// Ensure links close the modal
|
||||||
this.querySelectorAll<HTMLAnchorElement>("[slot=modal] a").forEach((a) => {
|
this.querySelectorAll<HTMLAnchorElement>("[slot=modal] a").forEach((a) => {
|
||||||
|
if (a.target == "_blank") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Make click on a close the modal
|
// Make click on a close the modal
|
||||||
a.addEventListener("click", (e) => {
|
a.addEventListener("click", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
Reference in New Issue