Skip to content

Commit

Permalink
LPS-140315 Only add aria attributes when a coverImageCaption exist
Browse files Browse the repository at this point in the history
  • Loading branch information
boton committed Oct 8, 2021
1 parent bb7386e commit eaef448
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 5 deletions.
Expand Up @@ -27,7 +27,12 @@ BlogsEntry entry = (BlogsEntry)request.getAttribute(WebKeys.BLOGS_ENTRY);
%>

<c:if test="<%= Validator.isNotNull(coverImageURL) %>">
<div aria-label="<%= HtmlUtil.escapeAttribute(HtmlUtil.stripHtml(entry.getCoverImageCaption())) %>" class="aspect-ratio aspect-ratio-8-to-3 aspect-ratio-bg-cover cover-image mb-4" role="img" style="background-image: url(<%= coverImageURL %>);"></div>

<%
String coverImageCaption = HtmlUtil.escapeAttribute(HtmlUtil.stripHtml(entry.getCoverImageCaption()));
%>

<div <%= Validator.isNotNull(coverImageCaption) ? "aria-label=\"" + coverImageCaption + "\" role=\"img\"" : StringPool.BLANK %> class="aspect-ratio aspect-ratio-8-to-3 aspect-ratio-bg-cover cover-image mb-4" style="background-image: url(<%= coverImageURL %>);"></div>
</c:if>

<%
Expand Down
Expand Up @@ -40,7 +40,12 @@ String entryTitle = BlogsEntryUtil.getDisplayTitle(resourceBundle, entry);
%>

<c:if test="<%= Validator.isNotNull(coverImageURL) %>">
<div aria-label="<%= HtmlUtil.escapeAttribute(HtmlUtil.stripHtml(entry.getCoverImageCaption())) %>" class="aspect-ratio aspect-ratio-8-to-3 aspect-ratio-bg-cover cover-image" role="img" style="background-image: url(<%= coverImageURL %>);"></div>

<%
String coverImageCaption = HtmlUtil.escapeAttribute(HtmlUtil.stripHtml(entry.getCoverImageCaption()));
%>

<div <%= Validator.isNotNull(coverImageCaption) ? "aria-label=\"" + coverImageCaption + "\" role=\"img\"" : StringPool.BLANK %> class="aspect-ratio aspect-ratio-8-to-3 aspect-ratio-bg-cover cover-image" style="background-image: url(<%= coverImageURL %>);"></div>
</c:if>

<%= entry.getContent() %>
Expand Down
Expand Up @@ -31,7 +31,12 @@ String entryTitle = BlogsEntryUtil.getDisplayTitle(resourceBundle, entry);
%>

<c:if test="<%= Validator.isNotNull(coverImageURL) %>">
<div aria-label="<%= HtmlUtil.escapeAttribute(HtmlUtil.stripHtml(entry.getCoverImageCaption())) %>" class="aspect-ratio aspect-ratio-8-to-3 aspect-ratio-bg-cover cover-image" role="img" style="background-image: url(<%= coverImageURL %>);"></div>

<%
String coverImageCaption = HtmlUtil.escapeAttribute(HtmlUtil.stripHtml(entry.getCoverImageCaption()));
%>

<div <%= Validator.isNotNull(coverImageCaption) ? "aria-label=\"" + coverImageCaption + "\" role=\"img\"" : StringPool.BLANK %> class="aspect-ratio aspect-ratio-8-to-3 aspect-ratio-bg-cover cover-image" style="background-image: url(<%= coverImageURL %>);"></div>
</c:if>

<%= entry.getContent() %>
Expand Down
Expand Up @@ -24,6 +24,7 @@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ page import="com.liferay.asset.kernel.model.AssetRenderer" %><%@
page import="com.liferay.blogs.model.BlogsEntry" %><%@
page import="com.liferay.blogs.web.internal.util.BlogsEntryUtil" %><%@
page import="com.liferay.petra.string.StringPool" %><%@
page import="com.liferay.portal.kernel.util.HtmlUtil" %><%@
page import="com.liferay.portal.kernel.util.Validator" %><%@
page import="com.liferay.portal.kernel.util.WebKeys" %>
Expand Down
Expand Up @@ -140,7 +140,12 @@ BlogsPortletInstanceConfiguration blogsPortletInstanceConfiguration = BlogsPortl

<c:if test="<%= Validator.isNotNull(coverImageURL) %>">
<a href="<%= viewEntryURL.toString() %>">
<div aria-label="<%= HtmlUtil.escapeAttribute(HtmlUtil.stripHtml(entry.getCoverImageCaption())) %>" class="aspect-ratio aspect-ratio-8-to-3 aspect-ratio-bg-cover cover-image" role="img" style="background-image: url(<%= coverImageURL %>);"></div>

<%
String coverImageCaption = HtmlUtil.escapeAttribute(HtmlUtil.stripHtml(entry.getCoverImageCaption()));
%>

<div <%= Validator.isNotNull(coverImageCaption) ? "aria-label=\"" + coverImageCaption + "\" role=\"img\"" : StringPool.BLANK %> class="aspect-ratio aspect-ratio-8-to-3 aspect-ratio-bg-cover cover-image" style="background-image: url(<%= coverImageURL %>);"></div>
</a>
</c:if>

Expand Down
Expand Up @@ -178,7 +178,12 @@ BlogsPortletInstanceConfiguration blogsPortletInstanceConfiguration = BlogsPortl
%>

<c:if test="<%= Validator.isNotNull(coverImageURL) %>">
<div aria-label="<%= HtmlUtil.escapeAttribute(HtmlUtil.stripHtml(entry.getCoverImageCaption())) %>" class="aspect-ratio aspect-ratio-bg-cover cover-image" role="img" style="background-image: url(<%= coverImageURL %>);"></div>

<%
String coverImageCaption = HtmlUtil.escapeAttribute(HtmlUtil.stripHtml(entry.getCoverImageCaption()));
%>

<div <%= Validator.isNotNull(coverImageCaption) ? "aria-label=\"" + coverImageCaption + "\" role=\"img\"" : StringPool.BLANK %> class="aspect-ratio aspect-ratio-8-to-3 aspect-ratio-bg-cover cover-image" style="background-image: url(<%= coverImageURL %>);"></div>
</c:if>

<!-- text resume -->
Expand Down

0 comments on commit eaef448

Please sign in to comment.