Skip to content

Commit

Permalink
Add CID to CSV export (#1938)
Browse files Browse the repository at this point in the history
  • Loading branch information
nya-elimu authored Nov 8, 2024
2 parents ed71e21 + e5b47a6 commit 49031fc
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,22 @@ public void handleRequest(
"content_license",
"attribution_url",
"title",
"cid",
"download_url",
"image_format"
);
StringWriter stringWriter = new StringWriter();
CSVPrinter csvPrinter = new CSVPrinter(stringWriter, csvFormat);

for (Image image : images) {
String downloadUrl = "/image/" + image.getId() + "." + image.getImageFormat().toString().toLowerCase();

csvPrinter.printRecord(
image.getId(),
image.getContentType(),
image.getContentLicense(),
image.getAttributionUrl(),
image.getTitle(),
downloadUrl,
image.getCid(),
image.getUrl(),
image.getImageFormat()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<form:hidden path="dominantColor" value="${image.dominantColor}" />
<input type="hidden" name="timeStart" value="${timeStart}" />

<img
<img class="cid-${image.cid != null}"
src="<spring:url value='${image.url}' />"
alt="${image.title}" />
<script>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/jsp/content/storybook/create.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</select>
<label for="coverImage"><fmt:message key="cover.image" /></label>
<c:if test="${not empty storyBook.coverImage}">
<img src="<spring:url value='/image/${storyBook.coverImage.id}_r${storyBook.coverImage.revisionNumber}.${fn:toLowerCase(storyBook.coverImage.imageFormat)}' />" alt="${storyBook.title}" />
<img src="<spring:url value='${storyBook.coverImage.url}' />" alt="${storyBook.title}" />
</c:if>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/WEB-INF/jsp/content/storybook/edit.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<label for="coverImage"><fmt:message key="cover.image" /></label>
<c:if test="${not empty storyBook.coverImage}">
<a href="<spring:url value='/content/multimedia/image/edit/${storyBook.coverImage.id}' />">
<img src="<spring:url value='/image/${storyBook.coverImage.id}_r${storyBook.coverImage.revisionNumber}.${fn:toLowerCase(storyBook.coverImage.imageFormat)}' />" alt="${storyBook.title}" />
<img class="cid-${storyBook.coverImage.cid != null}" src="<spring:url value='${storyBook.coverImage.url}' />" alt="${storyBook.title}" />
</a>
</c:if>
</div>
Expand Down Expand Up @@ -103,7 +103,7 @@
<div class="card-panel storyBookChapter">
<c:if test="${not empty storyBookChapter.image}">
<a href="<spring:url value='/content/multimedia/image/edit/${storyBookChapter.image.id}' />">
<img src="<spring:url value='${storyBookChapter.image.url}' />" alt="${storyBook.title}" />
<img class="cid-${storyBookChapter.image.cid != null}" src="<spring:url value='${storyBookChapter.image.url}' />" alt="${storyBook.title}" />
</a>
</c:if>

Expand Down
20 changes: 10 additions & 10 deletions src/main/webapp/WEB-INF/jsp/content/storybook/list.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
<div class="headband"></div>
<c:set var="coverImageUrl" value="" />
<c:if test="${not empty storyBook.coverImage}">
<c:set var="coverImageUrl" value="/image/${storyBook.coverImage.id}_r${storyBook.coverImage.revisionNumber}.${fn:toLowerCase(storyBook.coverImage.imageFormat)}" />
<c:set var="coverImageUrl" value="${storyBook.coverImage.url}" />
</c:if>
<a href="<spring:url value='/content/storybook/edit/${storyBook.id}' />">
<div class="card-image" style="background-image: url(<spring:url value='${coverImageUrl}' />); background-color: #DDD;">
<div class="card-image cid-${storyBook.coverImage.cid != null}" style="background-image: url(<spring:url value='${coverImageUrl}' />); background-color: #DDD;">
<span class="card-title"><c:out value="${storyBook.title}" /></span>
</div>
</a>
Expand Down Expand Up @@ -82,10 +82,10 @@
<div class="headband"></div>
<c:set var="coverImageUrl" value="" />
<c:if test="${not empty storyBook.coverImage}">
<c:set var="coverImageUrl" value="/image/${storyBook.coverImage.id}_r${storyBook.coverImage.revisionNumber}.${fn:toLowerCase(storyBook.coverImage.imageFormat)}" />
<c:set var="coverImageUrl" value="${storyBook.coverImage.url}" />
</c:if>
<a href="<spring:url value='/content/storybook/edit/${storyBook.id}' />">
<div class="card-image" style="background-image: url(<spring:url value='${coverImageUrl}' />); background-color: #DDD;">
<div class="card-image cid-${storyBook.coverImage.cid != null}" style="background-image: url(<spring:url value='${coverImageUrl}' />); background-color: #DDD;">
<span class="card-title"><c:out value="${storyBook.title}" /></span>
</div>
</a>
Expand Down Expand Up @@ -130,10 +130,10 @@
<div class="headband"></div>
<c:set var="coverImageUrl" value="" />
<c:if test="${not empty storyBook.coverImage}">
<c:set var="coverImageUrl" value="/image/${storyBook.coverImage.id}_r${storyBook.coverImage.revisionNumber}.${fn:toLowerCase(storyBook.coverImage.imageFormat)}" />
<c:set var="coverImageUrl" value="${storyBook.coverImage.url}" />
</c:if>
<a href="<spring:url value='/content/storybook/edit/${storyBook.id}' />">
<div class="card-image" style="background-image: url(<spring:url value='${coverImageUrl}' />); background-color: #DDD;">
<div class="card-image cid-${storyBook.coverImage.cid != null}" style="background-image: url(<spring:url value='${coverImageUrl}' />); background-color: #DDD;">
<span class="card-title"><c:out value="${storyBook.title}" /></span>
</div>
</a>
Expand Down Expand Up @@ -178,10 +178,10 @@
<div class="headband"></div>
<c:set var="coverImageUrl" value="" />
<c:if test="${not empty storyBook.coverImage}">
<c:set var="coverImageUrl" value="/image/${storyBook.coverImage.id}_r${storyBook.coverImage.revisionNumber}.${fn:toLowerCase(storyBook.coverImage.imageFormat)}" />
<c:set var="coverImageUrl" value="${storyBook.coverImage.url}" />
</c:if>
<a href="<spring:url value='/content/storybook/edit/${storyBook.id}' />">
<div class="card-image" style="background-image: url(<spring:url value='${coverImageUrl}' />); background-color: #DDD;">
<div class="card-image cid-${storyBook.coverImage.cid != null}" style="background-image: url(<spring:url value='${coverImageUrl}' />); background-color: #DDD;">
<span class="card-title"><c:out value="${storyBook.title}" /></span>
</div>
</a>
Expand Down Expand Up @@ -224,10 +224,10 @@
<div class="headband"></div>
<c:set var="coverImageUrl" value="" />
<c:if test="${not empty storyBook.coverImage}">
<c:set var="coverImageUrl" value="/image/${storyBook.coverImage.id}_r${storyBook.coverImage.revisionNumber}.${fn:toLowerCase(storyBook.coverImage.imageFormat)}" />
<c:set var="coverImageUrl" value="${storyBook.coverImage.url}" />
</c:if>
<a href="<spring:url value='/content/storybook/edit/${storyBook.id}' />">
<div class="card-image" style="background-image: url(<spring:url value='${coverImageUrl}' />); background-color: #DDD;">
<div class="card-image cid-${storyBook.coverImage.cid != null}" style="background-image: url(<spring:url value='${coverImageUrl}' />); background-color: #DDD;">
<span class="card-title"><c:out value="${storyBook.title}" /></span>
</div>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<td>
<c:set var="coverImageUrl" value="/static/img/placeholder.png" />
<c:if test="${not empty storyBook.coverImage}">
<c:set var="coverImageUrl" value="/image/${storyBook.coverImage.id}_r${storyBook.coverImage.revisionNumber}.${fn:toLowerCase(storyBook.coverImage.imageFormat)}" />
<c:set var="coverImageUrl" value="${storyBook.coverImage.url}" />
</c:if>
<a href="<spring:url value='/content/storybook/edit/${storyBook.id}#peer-review' />" target="_blank">
<img
Expand Down
7 changes: 4 additions & 3 deletions src/main/webapp/static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ main .card-panel img {
border-width: 1px;
box-shadow: 2px 2px rgba(103,58,183, 0.15); /* deep-purple */
}
.cid-false,
main .card-panel img.cid-false {
border-top: 8px solid orangered;
}
main .card .card-image img {
border-radius: 8px 8px 0 0;
border-width: 0;
Expand Down Expand Up @@ -115,9 +119,6 @@ footer.page-footer .footer-copyright {
background-position: 50% 50%;
background-color: #ede7f6; /* deep-purple lighten-5 */
}
.card.image .card-image.cid-false {
border-top: 8px solid orangered;
}
.card.image .card-content > p,
.card.storyBook .card-content > p {
white-space: nowrap;
Expand Down

0 comments on commit 49031fc

Please sign in to comment.