The Unified and Autonomous Development Platform
Group commits by date in commits page.
robin shine408cea40b417
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.htmlindex 027fa3cfbd..1437921008 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.html@@ -4,7 +4,7 @@<div class="body"><svg class="lane"></svg><ul class="list list-unstyled">- <li wicket:id="commits" class="commit clearfix"></li>+ <li wicket:id="commits"></li></ul></div><div wicket:id="foot" class="foot">@@ -28,6 +28,6 @@</div></wicket:fragment><wicket:fragment wicket:id="dateFrag">- <div wicket:id="date"></div>+ <i class="fa fa-calendar"></i> <span wicket:id="date"></span></wicket:fragment></wicket:extend>diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.javaindex e2317d191e..5ea1313114 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitsPage.java@@ -12,6 +12,7 @@ import java.util.Stack;import org.apache.wicket.Component;import org.apache.wicket.ajax.AjaxRequestTarget;import org.apache.wicket.ajax.markup.html.AjaxLink;+import org.apache.wicket.behavior.AttributeAppender;import org.apache.wicket.markup.head.CssHeaderItem;import org.apache.wicket.markup.head.IHeaderResponse;import org.apache.wicket.markup.head.JavaScriptHeaderItem;@@ -202,6 +203,7 @@ public class RepoCommitsPage extends RepositoryPage {LastAndCurrentCommits commits = lastAndCurrentCommitsModel.getObject();int commitIndex = 0;+ int lastCommitIndex = 0;for (int i=0; i<commits.last.size(); i++) {Commit lastCommit = commits.last.get(i);Commit currentCommit = commits.current.get(i);@@ -210,19 +212,18 @@ public class RepoCommitsPage extends RepositoryPage {if (!commits.last.get(i+1).getHash().equals(commits.current.get(i+1).getHash()))replaceItem(target, i);} else {-+ addCommitClass(replaceItem(target, i), commitIndex);}} else {if (currentCommit == null) {- } else {+ replaceItem(target, i);+ } else if (commitIndex != lastCommitIndex+ || !lastCommit.getHash().equals(currentCommit.getHash())){+ addCommitClass(replaceItem(target, i), commitIndex);}}- if (!lastCommit.getHash().equals(currentCommit.getHash())) {- Component item = commitsView.get(i);- Component newItem = newCommitItem(item.getId(), i);- item.replaceWith(newItem);- target.add(newItem);- }+ if (lastCommit != null)+ lastCommitIndex++;if (currentCommit != null)commitIndex++;}@@ -230,6 +231,8 @@ public class RepoCommitsPage extends RepositoryPage {StringBuilder builder = new StringBuilder();for (int i=commits.last.size(); i<commits.current.size(); i++) {Component item = newCommitItem(commitsView.newChildId(), i);+ if (commits.current.get(i) != null)+ addCommitClass(item, commitIndex++);commitsView.add(item);target.add(item);builder.append(String.format("$('#repo-commits>.body>.list').append(\"<li id='%s'></li>\");",@@ -239,7 +242,6 @@ public class RepoCommitsPage extends RepositoryPage {target.add(foot);String script = String.format("gitplex.repocommits.renderCommitLane(%s);", getCommitsJson());target.appendJavaScript(script);-pushState(target);}@@ -276,13 +278,17 @@ public class RepoCommitsPage extends RepositoryPage {for (int i=0; i<commits.size(); i++) {Component item = newCommitItem(commitsView.newChildId(), i);if (commits.get(i) != null)- item.setMarkupId("commitindex-" + commitIndex++);+ addCommitClass(item, commitIndex++);commitsView.add(item);}return commitsView;}+ private void addCommitClass(Component item, int commitIndex) {+ item.add(AttributeAppender.append("class", " commitindex-" + commitIndex));+ }+private Component newCommitItem(String itemId, final int index) {List<Commit> current = lastAndCurrentCommitsModel.getObject().current;Commit commit = current.get(index);@@ -310,10 +316,12 @@ public class RepoCommitsPage extends RepositoryPage {state.blobIdent.revision = commit.getHash();item.add(new BookmarkablePageLink<Void>("codeLink", RepoFilePage.class,RepoFilePage.paramsOf(repoModel.getObject(), state)));+ item.add(AttributeAppender.append("class", "commit clearfix"));} else {item = new Fragment(itemId, "dateFrag", this);DateTime dateTime = new DateTime(current.get(index+1).getCommitter().getWhen());item.add(new Label("date", dateFormatter.print(dateTime)));+ item.add(AttributeAppender.append("class", "date"));}item.setOutputMarkupId(true);@@ -409,7 +417,7 @@ public class RepoCommitsPage extends RepositoryPage {new CssResourceReference(RepoCommitsPage.class, "repo-commits.css")));String script = String.format("gitplex.repocommits.init(%s);", getCommitsJson());- //response.render(OnDomReadyHeaderItem.forScript(script));+ response.render(OnDomReadyHeaderItem.forScript(script));}/*diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commits.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commits.cssindex c78224247c..22bde5f44d 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commits.css+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commits.css@@ -32,7 +32,7 @@#repo-commits>.body .commit-hash {font-family: monospace;}-#repo-commits>.body li:hover {+#repo-commits>.body li.commit:hover {background: #F7ECB9;}#repo-commits>.body .commit-message>.full {@@ -50,10 +50,15 @@#repo-commits>.foot {text-align: center;}-#repo-commits>.foot>.alert, #repo-commits>.footer>.btn {+#repo-commits>.foot>.alert, #repo-commits>.foot>.btn {margin-top: 8px;margin-bottom: 0;}+#repo-commits li.date {+ font-size: 18px;+ margin-top: 12px;+ text-align: left;+}.commit-lane-dot {fill: #53a8fd;diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commits.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commits.jsindex 63528f5812..ad1e1e5ce4 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commits.js+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commits.js@@ -12,7 +12,7 @@ gitplex.repocommits = {* list of parent indexes*/renderCommitLane: function(commits) {- var columnsLimit = 20;+ var columnsLimit = 12;var colorsLimit = 12;@@ -253,7 +253,7 @@ gitplex.repocommits = {drawCommitLane: function() {var columnWidth = 12;var topOffset = 22;- var rightOffset = 16;+ var rightOffset = 4;var commitSize = 4;var commitClass = "commit-lane-dot";@@ -284,7 +284,7 @@ gitplex.repocommits = {var bodyTop = $("#repo-commits>.body").offset().top - topOffset;function getTop(row) {- return $("#commitindex-"+row).offset().top - bodyTop;+ return $(".commitindex-"+row).offset().top - bodyTop;}function getLeft(column) {@@ -292,6 +292,7 @@ gitplex.repocommits = {}var $list = $("#repo-commits>.body>.list");+ $list.css("margin-left", maxColumns*columnWidth+rightOffset);var $lane = $("#repo-commits>.body>.lane");$lane.empty();@@ -302,8 +303,6 @@ gitplex.repocommits = {for (var i=0; i<commits.length; i++) {var parents = commits[i];var row = rows[i];- var columns = Object.keys(rows[i]).length;- $("#commitindex-"+i).css("margin-left", columns*columnWidth+rightOffset);var column = row[toKey([i, i])];var left = getLeft(column);