In the UI we occasionally have objects with no valid signature i.e. ddr-densho-142-213. We don't want the app to crash[1] but we also don't want to show nothing at all. Ideally we'd show some sort of content-appropriate icon. There are lots of different approaches.
[1] See https://github.com/denshoproject/ddr-public/issues/178
OPTION 0. (vetoed) Modify DDR.signature chooser code to ignore transcript File objects when choosing signatures.
OPTION 1. Modify ddr-cmdln's ddrindex publishDDR.models.common.to_esobject to . The code would have to consider the object's format, genre, and/or mimetype. We could put something in object.signature_id like icon-transcript or icon-audio. Or we could add a new field to the Elasticsearch record. Requires modifications to front-end ddr-public code. We would have to reindex everything.
OPTION 2. Mod ddr-publicformat_object_detail function (used to enrich elasticsearch documents so they can be inserted into templates). Look at the object's format, genre, and/or mimetype and insert an icon link if the object's signature_id field is blank.
OPTION 3. (vetoed) Mod ddr-public to specify a default image if sorl-thumbnail cannot make a thumbnail. Choose the icon by looking at the object's format, genre, and/or mimetype. This ensures that some sort of image is always displayed if the image is missing from dori. Does not require a reindex.
OPTION 4. Mod ddr-publicformat_object_detail function to always look at the object's format, genre, and/or mimetype and choose an icon. Display icon with a low CSS z-index and the object's signature image with a higher z-index. The icon will be displayed if there is no signature image, or if the signature image is missing from dori. Does not require a reindex.
@GeoffFroh the more I think about your comment that it's desirable that we not add more logic to the front-end ddr-public, the more I agree.
Taking a step back here, what is the root problem we're trying to solve?
Entities should always display some sort of image, regardless of whether they have a signature image, whether the signature has an image, or whether any signature image is present.
Entities with signature Files that don't have images (i.e. transcripts) should display an icon instead.
Transcript (or non-image) Files should never be chosen as signatures in the first place.
In the UI we occasionally have objects with no valid signature i.e. ddr-densho-142-213. We don't want the app to crash[1] but we also don't want to show nothing at all. Ideally we'd show some sort of content-appropriate icon. There are lots of different approaches. [1] See https://github.com/denshoproject/ddr-public/issues/178
OPTION 0. (vetoed) Modify
DDR.signature
chooser code to ignore transcriptFile
objects when choosing signatures.OPTION 1. Modify
ddr-cmdln
'sddrindex publish
DDR.models.common.to_esobject
to . The code would have to consider the object'sformat
,genre
, and/ormimetype
. We could put something inobject.signature_id
likeicon-transcript
oricon-audio
. Or we could add a new field to the Elasticsearch record. Requires modifications to front-endddr-public
code. We would have to reindex everything.OPTION 2. Mod
ddr-public
format_object_detail
function (used to enrich elasticsearch documents so they can be inserted into templates). Look at the object'sformat
,genre
, and/ormimetype
and insert an icon link if the object'ssignature_id
field is blank.OPTION 3. (vetoed) Mod
ddr-public
to specify a default image ifsorl-thumbnail
cannot make a thumbnail. Choose the icon by looking at the object'sformat
,genre
, and/ormimetype
. This ensures that some sort of image is always displayed if the image is missing fromdori
. Does not require a reindex.OPTION 4. Mod
ddr-public
format_object_detail
function to always look at the object'sformat
,genre
, and/ormimetype
and choose an icon. Display icon with a low CSSz-index
and the object's signature image with a higherz-index
. The icon will be displayed if there is no signature image, or if the signature image is missing fromdori
. Does not require a reindex.