Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/main/java/uk/ac/cam/cl/dtg/isaac/dos/content/Media.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
public abstract class Media extends Content {
protected String src;
protected String altText;
protected Boolean decorative;

/**
* Gets the src.
Expand Down Expand Up @@ -65,4 +66,23 @@ public void setAltText(final String altText) {
this.altText = altText;
}

/**
* Gets whether the media is decorative.
*
* @return whether the media is decorative
*/
public Boolean getDecorative() {
return decorative;
}

/**
* Sets whether the media is decorative.
*
* @param decorative
* whether the media is decorative
*/
public void setDecorative(final Boolean decorative) {
this.decorative = decorative;
}

}
5 changes: 3 additions & 2 deletions src/main/java/uk/ac/cam/cl/dtg/segue/etl/ContentIndexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,9 @@ public void recordContentTypeSpecificError(final String sha, final Content conte
}
}

// check that there is some alt text.
if (f.getAltText() == null || f.getAltText().isEmpty()) {
// Check that there is some alt text. Decorative images should have empty alt text.
boolean isDecorative = null != f.getDecorative() && f.getDecorative();
if (f.getAltText() == null || (f.getAltText().isEmpty() && !isDecorative)) {
if (!(f instanceof Video) && !f.getId().equals("eventThumbnail")) {
// Videos probably don't need alt text unless there is a good reason. It's not important that event
// thumbnails have alt text, so we don't record errors for those either.
Expand Down
Loading