@@ -201,6 +201,16 @@ class WorkPage(ColourThemeMixin, ContactMixin, SocialFields, NavigationFields, P
201
201
on_delete = models .SET_NULL ,
202
202
related_name = "+" ,
203
203
)
204
+ header_image_is_decorative = models .BooleanField (
205
+ help_text = "If checked, this will make the alt text empty." ,
206
+ default = False ,
207
+ )
208
+ header_alt_text = models .CharField (
209
+ blank = True ,
210
+ max_length = 255 ,
211
+ help_text = "By default the image title (shown above) is used as the alt text. "
212
+ "Use this field to provide more specific alt text if required." ,
213
+ )
204
214
205
215
header_caption = models .CharField ("caption" , max_length = 255 , blank = True )
206
216
header_attribution = models .CharField ("attribution" , max_length = 255 , blank = True )
@@ -226,6 +236,8 @@ class WorkPage(ColourThemeMixin, ContactMixin, SocialFields, NavigationFields, P
226
236
MultiFieldPanel (
227
237
[
228
238
FieldPanel ("header_image" ),
239
+ FieldPanel ("header_alt_text" ),
240
+ FieldPanel ("header_image_is_decorative" ),
229
241
FieldPanel ("header_caption" ),
230
242
FieldPanel ("header_attribution" ),
231
243
],
@@ -277,6 +289,12 @@ def first_author(self):
277
289
return author .author
278
290
return None
279
291
292
+ @cached_property
293
+ def header_image_alt_text (self ):
294
+ if header_alt_text := self .header_alt_text :
295
+ return header_alt_text
296
+ return self .header_image .title
297
+
280
298
@property
281
299
def related_works (self ):
282
300
prefetch_listing_images = models .Prefetch (
0 commit comments