Commit 471ea4dd authored by Matija Obreza's avatar Matija Obreza
Browse files

Random article banner

parent de8b9339
......@@ -20,6 +20,7 @@ import java.text.DateFormatSymbols;
import java.util.Locale;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.RandomUtils;
import org.genesys2.server.exception.UserException;
import org.genesys2.server.model.impl.Country;
import org.genesys2.server.model.impl.Crop;
......@@ -77,7 +78,7 @@ public class JspHelper {
public String toJson(Object object) throws JsonProcessingException {
return objectMapper.writer().writeValueAsString(object);
}
public String htmlToText(String html) {
return htmlConverter.toText(html);
}
......@@ -85,7 +86,7 @@ public class JspHelper {
public String htmlToText(String html, int maxLength) {
return StringUtils.abbreviate(htmlConverter.toText(html), maxLength);
}
public String abbreviate(String text, int maxLength) {
return StringUtils.abbreviate(text, maxLength);
}
......@@ -99,4 +100,8 @@ public class JspHelper {
DateFormatSymbols dfs = new DateFormatSymbols(locale);
return dfs.getShortMonths();
}
public int randomInt(int min, int max) {
return min + RandomUtils.nextInt(max - min + 1);
}
}
......@@ -10,7 +10,7 @@
<body>
<content tag="header">
<div class="hidden-xs top-image">
<img src="<c:url value="/html/images/aim/banner-1.jpg" />" title="${title}" />
<img src="<c:url value="/html/images/aim/banner-${jspHelper.randomInt(1, 4)}.jpg" />" title="${title}" />
</div>
<div class="top-title">
<div class="banner-<c:out value="${article.slug}" />"></div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment