kopia lustrzana https://github.com/wagtail/wagtail
Make image chooser "Select format" fields translatable
- Add explanatory comment - Make form labels translatablepull/6740/head
rodzic
5682aea460
commit
479855b27c
|
@ -95,11 +95,12 @@ class ImageInsertionForm(forms.Form):
|
|||
into a rich text area
|
||||
"""
|
||||
format = forms.ChoiceField(
|
||||
label=_("Format"),
|
||||
choices=[(format.name, format.label) for format in get_image_formats()],
|
||||
widget=forms.RadioSelect
|
||||
)
|
||||
image_is_decorative = forms.BooleanField(required=False)
|
||||
alt_text = forms.CharField(required=False)
|
||||
image_is_decorative = forms.BooleanField(required=False, label=_("Image is decorative"))
|
||||
alt_text = forms.CharField(required=False, label=_("Alt text"))
|
||||
|
||||
def clean_alt_text(self):
|
||||
alt_text = self.cleaned_data['alt_text']
|
||||
|
|
|
@ -241,6 +241,8 @@ def chooser_select_format(request, image_id):
|
|||
else:
|
||||
initial = {'alt_text': image.default_alt_text}
|
||||
initial.update(request.GET.dict())
|
||||
# If you edit an existing image, and there is no alt text, ensure that
|
||||
# "image is decorative" is ticked when you open the form
|
||||
initial['image_is_decorative'] = initial['alt_text'] == ''
|
||||
form = ImageInsertionForm(initial=initial, prefix='image-chooser-insertion')
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue