Skip to content

Commit 3a88edd

Browse files
committed
Fix for #1076
New feature to allow users to collapse and expand long revision messages on the history page.
1 parent 218e04f commit 3a88edd

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

web/default/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,10 @@ table#revisions tbody tr td p {
493493
margin: 1ex 0;
494494
}
495495

496+
.rev-message-hidden {
497+
display: none;
498+
}
499+
496500

497501
/* *** diff page *** */
498502
#diffbar { /* diff navbar: contains the tabs to select diff format */

web/history.jsp

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,10 @@ revision2 = revision2 >= hist.getHistoryEntries().size() ? hist.getHistoryEntrie
279279
%><%= author %><%
280280
}
281281
%></td>
282-
<td><a name="<%= rev %>"></a><p><%
282+
<td><a name="<%= rev %>"></a><%
283+
int summaryLength = 200;
283284
String cout = Util.htmlize(entry.getMessage());
285+
284286
if (bugPage != null && bugPage.length() > 0) {
285287
cout = bugPattern.matcher(cout).replaceAll("<a href=\""
286288
+ bugPage + "$1\">$1</a>");
@@ -289,7 +291,26 @@ revision2 = revision2 >= hist.getHistoryEntries().size() ? hist.getHistoryEntrie
289291
cout = reviewPattern.matcher(cout).replaceAll("<a href=\""
290292
+ reviewPage + "$1\">$1</a>");
291293
}
292-
%><%= cout %></p><%
294+
295+
boolean showSummary = false;
296+
String coutSummary = entry.getMessage();
297+
if (coutSummary.length() > summaryLength) {
298+
showSummary = true;
299+
coutSummary = coutSummary.substring(0, summaryLength - 1);
300+
coutSummary = Util.htmlize(coutSummary);
301+
}
302+
303+
if (showSummary) {
304+
%>
305+
<p class="rev-message-summary"><%= coutSummary %></p>
306+
<p class="rev-message-full rev-message-hidden"><%= cout %></p>
307+
<p class="rev-message-toggle" data-toggle-state="less"><a class="rev-toggle-a" href="#">show more ... </a></p>
308+
<%
309+
}
310+
else {
311+
%><p class="rev-message-full"><%= cout %></p><%
312+
}
313+
293314
Set<String> files = entry.getFiles();
294315
if (files != null) {
295316
%><div class="filelist-hidden"><br/><%

web/utils.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,28 @@ function togglediffs() {
854854
);
855855
}
856856

857+
$(document).ready(function() {
858+
$(".rev-toggle-a").click(function() {
859+
var toggleState = $(this).closest("p").attr("data-toggle-state");
860+
var thisCell = $(this).closest("td");
861+
862+
if (toggleState == "less") {
863+
$(this).closest("p").attr("data-toggle-state", "more");
864+
thisCell.find(".rev-message-summary").addClass("rev-message-hidden");
865+
thisCell.find(".rev-message-full").removeClass("rev-message-hidden");
866+
$(this).html("... show less");
867+
}
868+
else if (toggleState == "more") {
869+
$(this).closest("p").attr("data-toggle-state", "less");
870+
thisCell.find(".rev-message-full").addClass("rev-message-hidden");
871+
thisCell.find(".rev-message-summary").removeClass("rev-message-hidden");
872+
$(this).html("show more ...");
873+
}
874+
875+
return false;
876+
});
877+
});
878+
857879
function selectAllProjects() {
858880
$("#project *").attr("selected", "selected");
859881
}

0 commit comments

Comments
 (0)