Commit 40a9dcf2 authored by Ubbo Veentjer's avatar Ubbo Veentjer
Browse files

link to latest rev, see #45

parent 98afa616
Pipeline #138604 passed with stages
in 8 minutes and 38 seconds
......@@ -290,17 +290,19 @@ public class BrowseController {
}
private void listRevisions(Model model, String id, ResultType metadata) {
String baseUri = id.substring(0, id.indexOf("."));
Revisions revisions = tgsearchClientService.listRevisions(id);
int displayRev = metadata.getObject().getGeneric().getGenerated().getRevision();
BigInteger latestRev = Collections.max(revisions.getRevision());
if(BigInteger.valueOf(displayRev).compareTo(latestRev) < 0) {
model.addAttribute("higherRevisionAvailable", true);
model.addAttribute("latestRevision", latestRev);
model.addAttribute("latestRevisionUri", baseUri+"."+latestRev);
}
if(revisions.getRevision().size() > 0) {
TreeMap revmap = new TreeMap<BigInteger, String>();
String baseUri = id.substring(0, id.indexOf("."));
for(BigInteger rev : revisions.getRevision()) {
revmap.put(rev, baseUri + "." + rev);
}
......
......@@ -193,8 +193,9 @@
<c:if test="${higherRevisionAvailable}">
<fieldset class="tgrep advanced-search_fieldset">
<legend class="tgrep advanced-search_legend">Higher revision available</legend>
A higher revision of this document has been published.
You are now viewing revision ${metadata.object.generic.generated.revision}.
You are now viewing revision ${metadata.object.generic.generated.revision} of this document.
A higher revision of this document has been published:
<a href="/browse/${latestRevisionUri}">Revision ${latestRevision}</a>.
</fieldset>
</c:if>
......
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