The Unified and Autonomous Development Platform
midwork
robin shineee5616306e78
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/oneline/OnelineResourceReference.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/oneline/OnelineResourceReference.javaindex 286c54ae01..07c0a7ee5e 100644--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/oneline/OnelineResourceReference.java+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/oneline/OnelineResourceReference.java@@ -1,11 +1,5 @@package com.pmease.commons.wicket.assets.oneline;-import java.util.ArrayList;-import java.util.List;--import org.apache.wicket.markup.head.CssHeaderItem;-import org.apache.wicket.markup.head.HeaderItem;-import org.apache.wicket.request.resource.CssResourceReference;import org.apache.wicket.request.resource.JavaScriptResourceReference;public class OnelineResourceReference extends JavaScriptResourceReference {@@ -18,12 +12,4 @@ public class OnelineResourceReference extends JavaScriptResourceReference {super(OnelineResourceReference.class, "jquery.oneline.js");}- @Override- public Iterable<? extends HeaderItem> getDependencies() {- List<HeaderItem> dependencies = new ArrayList<>();- dependencies.add(CssHeaderItem.forReference(new CssResourceReference(- OnelineResourceReference.class, "jquery.oneline.css")));- return dependencies;- }-}diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/oneline/jquery.oneline.css b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/oneline/jquery.oneline.cssdeleted file mode 100644index e69de29bb2..0000000000diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/oneline/jquery.oneline.js b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/oneline/jquery.oneline.jsindex e9283e08b8..0d7992925f 100644--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/oneline/jquery.oneline.js+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/oneline/jquery.oneline.js@@ -1,9 +1,6 @@(function ( $ ) {- var ellipsisWidth = 64;- var topTolerance = 10;-- $.fn.oneline = function(alignment) {+ $.fn.oneline = function(expanderSelector, topMargin, rightMargin) {this.css("white-space", "normal");var children = this.children();var thisRight = this.offset().left + this.width();@@ -13,19 +10,22 @@var $child = $(children[i]);if (hide) {$child.hide();- } else if ($child.offset().left + $child.outerWidth() + ellipsisWidth > thisRight- || $child.offset().top - thisTop > topTolerance) {+ } else if ($child.offset().left + $child.outerWidth() + rightMargin > thisRight+ || $child.offset().top - thisTop > topMargin) {hide = true;}}+ var $expander = jQuery(expanderSelector);if (hide) {- var $ellipsis = jQuery("<a class='ellipis'>...</a>");- this.append($ellipsis);+ $expander.show();+ this.append($expander);var $container = this;- $ellipsis.click(function() {+ $expander.click(function() {$container.children().show();- $ellipsis.remove();+ $expander.hide();});+ } else {+ $expander.hide();}return this;};diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commithash/commit-hash.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commithash/commit-hash.cssindex 023319167a..717e30ce5c 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commithash/commit-hash.css+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commithash/commit-hash.css@@ -1,10 +1,11 @@-.commit-hash {- font-size: 13px;- width: 62px;- border: none;- border-radius: 3px;- padding-left: 3px;- padding-right: 3px;- height: 22px;- font-family: monospace;-}+.commit-hash {+ font-size: 13px;+ width: 65px;+ color: #666;+ border: none;+ border-radius: 3px;+ padding-left: 3px;+ padding-right: 3px;+ height: 22px;+ font-family: monospace;+}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/CommitMessagePanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/CommitMessagePanel.htmlindex 73fb56acc3..63a98a81a8 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/CommitMessagePanel.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/CommitMessagePanel.html@@ -1,11 +1,11 @@-<html xmlns:wicket>-<wicket:panel>- <span class="commit-message">- <a wicket:id="link" class="summary"><span wicket:id="label"></span></a>- <a class="toggle" href="javascript:void(0);" title="Toggle detail message" onclick="$(this).next().toggle(); $(window).resize();" wicket:id="toggle">- <i class="fa fa-ellipsis-h"></i>- </a>- <div wicket:id="detail" class="detail"></div>- </span>-</wicket:panel>+<html xmlns:wicket>+<wicket:panel>+ <span class="commit-message">+ <a wicket:id="link" class="summary"><span wicket:id="label"></span></a>+ <a class="ellipsis-expander" href="javascript:void(0);" title="Toggle detail message" onclick="$(this).next().toggle(); $(window).resize();" wicket:id="toggle">+ <i class="fa fa-ellipsis-h"></i>+ </a>+ <div wicket:id="detail" class="detail"></div>+ </span>+</wicket:panel></html>\ No newline at end of filediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/commit-message.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/commit-message.cssindex ffdea60c5c..cf7feece39 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/commit-message.css+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commitmessage/commit-message.css@@ -1,23 +1,9 @@-.commit-message>a {- color: #444;-}-.commit-message>.detail {- display: none;- margin-top: 8px;- color: #666;- font-size: 12px;-}-.commit-message>.toggle {- display: inline-block;- background: #DDD;- padding: 0px 6px;- border-radius: 2px;- color: #777;- line-height: 16px;-}-.commit-message>.toggle:hover {- background: #888;-}-.commit-message>.toggle:hover .fa {- color: white;-}+.commit-message>a {+ color: #444;+}+.commit-message>.detail {+ display: none;+ margin-top: 8px;+ color: #666;+ font-size: 12px;+}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/HashAndCodePanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/HashAndCodePanel.htmlnew file mode 100644index 0000000000..b51db3c102--- /dev/null+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/HashAndCodePanel.html@@ -0,0 +1,6 @@+<wicket:panel>+ <span class="hash-and-code">+ <span wicket:id="hash"></span>+ <a wicket:id="code" title="Browse code at this point" class="browse-code btn btn-xs btn-default"><span class="fa fa-code"></span></a>+ </span>+</wicket:panel>\ No newline at end of filediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/HashAndCodePanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/HashAndCodePanel.javanew file mode 100644index 0000000000..6b002fa7ea--- /dev/null+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/HashAndCodePanel.java@@ -0,0 +1,56 @@+package com.pmease.gitplex.web.component.hashandcode;++import org.apache.wicket.markup.head.CssHeaderItem;+import org.apache.wicket.markup.head.IHeaderResponse;+import org.apache.wicket.markup.html.link.BookmarkablePageLink;+import org.apache.wicket.markup.html.panel.Panel;+import org.apache.wicket.model.IModel;+import org.apache.wicket.model.Model;+import org.apache.wicket.request.resource.CssResourceReference;++import com.pmease.gitplex.core.model.Repository;+import com.pmease.gitplex.web.component.commithash.CommitHashPanel;+import com.pmease.gitplex.web.page.repository.file.RepoFilePage;+import com.pmease.gitplex.web.page.repository.file.RepoFileState;++@SuppressWarnings("serial")+public class HashAndCodePanel extends Panel {++ private final IModel<Repository> repoModel;++ private final String hash;++ public HashAndCodePanel(String id, IModel<Repository> repoModel, String hash) {+ super(id);++ this.repoModel = repoModel;+ this.hash = hash;+ }++ @Override+ protected void onInitialize() {+ super.onInitialize();++ add(new CommitHashPanel("hash", Model.of(hash)));++ RepoFileState state = new RepoFileState();+ state.blobIdent.revision = hash;+ add(new BookmarkablePageLink<Void>("code", RepoFilePage.class,+ RepoFilePage.paramsOf(repoModel.getObject(), state)));+ }++ @Override+ public void renderHead(IHeaderResponse response) {+ super.renderHead(response);+ response.render(CssHeaderItem.forReference(new CssResourceReference(+ HashAndCodePanel.class, "hash-and-code.css")));+ }++ @Override+ protected void onDetach() {+ repoModel.detach();++ super.onDetach();+ }++}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/hash-and-code.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/hash-and-code.cssnew file mode 100644index 0000000000..80961fe5c5--- /dev/null+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/hash-and-code.css@@ -0,0 +1,11 @@+.hash-and-code .commit-hash {+ border: 1px solid #CCC;+ font-size: 13px;+ height: 22px;+ border-radius: 3px 0 0 3px;+ margin-right: -5px;+}+.hash-and-code .browse-code {+ border-radius: 0 3px 3px 0 !important;+ margin-top: -1px;+}\ No newline at end of filediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionselector/RevisionSelector.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionselector/RevisionSelector.javaindex 2c00553fc8..972b1a6e6e 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionselector/RevisionSelector.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/revisionselector/RevisionSelector.java@@ -109,7 +109,6 @@ public abstract class RevisionSelector extends Panel {for (Ref ref: refs)names.add(GitUtils.ref2branch(ref.getName()));} else {- long time = System.currentTimeMillis();for (Ref ref: repo.getTagRefs()) {if (repo.getCommit(ref.getObjectId()) != null)refs.add(ref);@@ -117,7 +116,6 @@ public abstract class RevisionSelector extends Panel {Collections.sort(refs, repo.newTagDateComparator());for (Ref ref: refs)names.add(GitUtils.ref2tag(ref.getName()));- System.out.println(System.currentTimeMillis()-time);}return names;}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/base/base.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/base/base.cssindex 2bf7fb060d..1f2f21fd83 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/base/base.css+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/base/base.css@@ -1,100 +1,115 @@-html, body {- background: white;-}--.center-box {- padding: 50px;- width: 600px;- margin: 0 auto;- background: #F5F5F5;- border: 8px solid #DDD;- margin-top: 100px;- margin-bottom: 20px;- color: #333;-}--/* COMMON STYLES */-a {- cursor: pointer;-}-a.fa {- text-decoration: none;- color: #666;-}-table {- width: 100%;-}-table>tbody>tr>td {- vertical-align: top;-}-table.table>thead>tr>th>a {- color: black;- text-decoration: underline;-}--textarea {- resize: vertical;-}-form>.actions {- margin-top: 20px;-}-form>.actions>.btn {- margin-right: 8px;-}-form>.actions>:last-child {- margin-right: 0;-}-.actions>a {margin-right: 8px;}--.nav-tabs>li>a {- color: #777;-}--.input-group>.form-control+.btn.input-group-addon {- border-radius: 0 4px 4px 0;- border-left: none;-}--li.selectable a, a.selectable {- border: 1px solid white;- text-decoration: none;- display: block;- padding: 2px 4px;- color: #333;-}-li.selectable:hover a, a.selectable:hover {- background-color: #E0F0FC;- border-color: #BBDFF9;-}-li.selectable.active a, a.selectable.active {- background-color: #CBE8FB;- border-color: #8BC8F9;-}--.activity-summary, .activity-summary a {- color: #999;-}-.activity-summary .operations {- margin-left: 8px;-}-.activity-summary .operations>a, .activity-summary .operations>span {- margin-right: 6px;- color: #DDD;-}-.activity-summary .operations a, .activity-summary .operations span {- color: #DDD;-}-.activity-summary:hover .operations a, .activity-summary:hover .operations span {- color: #999;-}-.activity-summary .user a, .activity-summary em {- color: #666;- font-weight: bold;- font-style: normal;-}--img.avatar {- border-radius: 3px;- height: 24px;- width: 24px;-}+html, body {+ background: white;+}++.center-box {+ padding: 50px;+ width: 600px;+ margin: 0 auto;+ background: #F5F5F5;+ border: 8px solid #DDD;+ margin-top: 100px;+ margin-bottom: 20px;+ color: #333;+}++/* COMMON STYLES */+a {+ cursor: pointer;+}+a.fa {+ text-decoration: none;+ color: #666;+}+table {+ width: 100%;+}+table>tbody>tr>td {+ vertical-align: top;+}+table.table>thead>tr>th>a {+ color: black;+ text-decoration: underline;+}++textarea {+ resize: vertical;+}+form>.actions {+ margin-top: 20px;+}+form>.actions>.btn {+ margin-right: 8px;+}+form>.actions>:last-child {+ margin-right: 0;+}+.actions>a {margin-right: 8px;}++.nav-tabs>li>a {+ color: #777;+}++.input-group>.form-control+.btn.input-group-addon {+ border-radius: 0 4px 4px 0;+ border-left: none;+}++li.selectable a, a.selectable {+ border: 1px solid white;+ text-decoration: none;+ display: block;+ padding: 2px 4px;+ color: #333;+}+li.selectable:hover a, a.selectable:hover {+ background-color: #E0F0FC;+ border-color: #BBDFF9;+}+li.selectable.active a, a.selectable.active {+ background-color: #CBE8FB;+ border-color: #8BC8F9;+}++.activity-summary, .activity-summary a {+ color: #999;+}+.activity-summary .operations {+ margin-left: 8px;+}+.activity-summary .operations>a, .activity-summary .operations>span {+ margin-right: 6px;+ color: #DDD;+}+.activity-summary .operations a, .activity-summary .operations span {+ color: #DDD;+}+.activity-summary:hover .operations a, .activity-summary:hover .operations span {+ color: #999;+}+.activity-summary .user a, .activity-summary em {+ color: #666;+ font-weight: bold;+ font-style: normal;+}++img.avatar {+ border-radius: 3px;+ height: 24px;+ width: 24px;+}++.ellipsis-expander {+ display: inline-block;+ background: #DDD;+ padding: 0px 6px;+ border-radius: 2px;+ color: #777;+ line-height: 16px;+}+.ellipsis-expander:hover {+ background: #888;+}+.ellipsis-expander:hover .fa {+ color: white;+}diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitPage.htmlindex 49bc8bafe3..e2991d6518 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitPage.html+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitPage.html@@ -1,35 +1,33 @@<wicket:extend><div id="repo-commit">- <div class="summary clearfix">- <div wicket:id="title" class="pull-left"></div>- <div class="pull-right">- <span wicket:id="hash"></span>- <a wicket:id="code" title="Browse code at this point" class="btn btn-xs btn-default"><span class="fa fa-code"></span></a>+ <div class="head">+ <div class="summary clearfix">+ <div wicket:id="title" class="title pull-left"></div>+ <div wicket:id="hashAndCode" class="pull-right"></div></div>- </div>- <div wicket:id="detailMessage" class="detail"></div>- <div wicket:id="refs" class="refs"></div>- <div class="origin-and-parents clearfix">- <div class="origin pull-left">- <span wicket:id="author" class="author"></span>- authored- <span wicket:id="age" class="age"></span>- </div>- <div class="parents pull-right">- parents:- <wicket:container wicket:id="parents">- <a wicket:id="link" class="parent"><span wicket:id="label"></span></a>- </wicket:container>- </div>- </div>- <div class="compare-options clearfix">- <div wicket:id="diffOption" class="pull-left"></div>- <wicket:enclosure child="parentChoice">- <div class="pull-right">- Parent to compare: <select wicket:id="parentChoice"></select>+ <div class="detail">+ <div wicket:id="message" class="message"></div>+ <div class="origin-and-parents clearfix">+ <div class="origin pull-left">+ <span wicket:id="author" class="author"></span>+ authored+ <span wicket:id="age" class="age"></span>+ </div>+ <div wicket:id="parents" class="parents pull-right">+ <label>Parents:</label>+ <a wicket:id="parent" class="parent"><span wicket:id="label"></span></a>+ <wicket:container wicket:id="parents">+ <div class="parent btn-group">+ <a wicket:id="link" class="commit btn btn-default btn-sm"><span wicket:id="label"></span></a>+ <a wicket:id="diff" title="Compare with this parent" class="diff btn btn-default btn-sm"><i class="fa fa-ext fa-file-diff"></i></a>+ </div>+ </wicket:container>+ </div>+ </div>+ <div wicket:id="refs" class="refs"></div></div>- </wicket:enclosure></div>+ <div wicket:id="compareOption" class="compare-option"></div><div wicket:id="compareResult"></div></div><wicket:fragment wicket:id="refsFrag">diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitPage.javaindex 759667fb56..750824192c 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitPage.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/RepoCommitPage.java@@ -11,8 +11,7 @@ import javax.annotation.Nullable;import org.apache.wicket.Component;import org.apache.wicket.ajax.AjaxRequestTarget;-import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;-import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;+import org.apache.wicket.ajax.markup.html.AjaxLink;import org.apache.wicket.behavior.AttributeAppender;import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;import org.apache.wicket.markup.head.CssHeaderItem;@@ -21,8 +20,6 @@ import org.apache.wicket.markup.head.JavaScriptHeaderItem;import org.apache.wicket.markup.head.OnDomReadyHeaderItem;import org.apache.wicket.markup.html.WebMarkupContainer;import org.apache.wicket.markup.html.basic.Label;-import org.apache.wicket.markup.html.form.DropDownChoice;-import org.apache.wicket.markup.html.form.IChoiceRenderer;import org.apache.wicket.markup.html.link.BookmarkablePageLink;import org.apache.wicket.markup.html.link.Link;import org.apache.wicket.markup.html.list.ListItem;@@ -41,19 +38,20 @@ import org.eclipse.jgit.lib.ObjectId;import org.eclipse.jgit.lib.Ref;import org.eclipse.jgit.revwalk.RevCommit;import org.eclipse.jgit.revwalk.RevWalk;+import org.unbescape.html.HtmlEscape;import com.google.common.base.Preconditions;import com.pmease.commons.git.GitUtils;-import com.pmease.commons.wicket.ajaxlistener.IndicateLoadingListener;+import com.pmease.commons.util.StringUtils;import com.pmease.commons.wicket.assets.oneline.OnelineResourceReference;import com.pmease.gitplex.core.GitPlex;import com.pmease.gitplex.core.manager.AuxiliaryManager;import com.pmease.gitplex.core.model.Comment;import com.pmease.gitplex.core.model.PullRequest;import com.pmease.gitplex.core.model.Repository;-import com.pmease.gitplex.web.component.commithash.CommitHashPanel;import com.pmease.gitplex.web.component.diff.revision.RevisionDiffPanel;import com.pmease.gitplex.web.component.diff.revision.option.DiffOptionPanel;+import com.pmease.gitplex.web.component.hashandcode.HashAndCodePanel;import com.pmease.gitplex.web.component.personlink.PersonLink;import com.pmease.gitplex.web.page.repository.RepositoryPage;import com.pmease.gitplex.web.page.repository.file.RepoFilePage;@@ -121,18 +119,17 @@ public class RepoCommitPage extends RepositoryPage {super.onInitialize();add(new Label("title", GitUtils.getShortMessage(getCommit())));- add(new CommitHashPanel("hash", Model.of(getCommit().name())));- RepoFileState state = new RepoFileState();- state.blobIdent.revision = getCommit().name();- add(new BookmarkablePageLink<Void>("code", RepoFilePage.class,- RepoFilePage.paramsOf(repoModel.getObject(), state)));-- String detailMessage = GitUtils.getDetailMessage(getCommit());- if (detailMessage != null)- add(new Label("detailMessage", detailMessage));- else- add(new WebMarkupContainer("detailMessage").setVisible(false));+ add(new HashAndCodePanel("hashAndCode", repoModel, getCommit().getId().name()));++ String message = GitUtils.getDetailMessage(getCommit());+ if (message != null) {+ message = HtmlEscape.escapeHtml5(message);+ message = StringUtils.replace(StringUtils.replace(message, "\r\n", "<br>"), "\n", "<br>");+ add(new Label("message", message).setEscapeModelStrings(false));+ } else {+ add(new WebMarkupContainer("message").setVisible(false));+ }add(new AjaxLazyLoadPanel("refs") {@@ -143,7 +140,7 @@ public class RepoCommitPage extends RepositoryPage {@Overridepublic void renderHead(IHeaderResponse response) {super.renderHead(response);- String script = String.format("$('#%s').oneline();", getMarkupId());+ String script = String.format("gitplex.repocommit.initRefs('%s');", getMarkupId());response.render(OnDomReadyHeaderItem.forScript(script));}@@ -213,77 +210,60 @@ public class RepoCommitPage extends RepositoryPage {add(new PersonLink("author", Model.of(getCommit().getAuthorIdent())));add(new Label("age", DateUtils.formatAge(getCommit().getAuthorIdent().getWhen())));-- add(new ListView<String>("parents", new LoadableDetachableModel<List<String>>() {-- @Override- protected List<String> load() {- return getParents();- }-- }) {-- @Override- protected void populateItem(ListItem<String> item) {- String parent = item.getModelObject();- Link<Void> link = new BookmarkablePageLink<Void>("link", RepoCommitPage.class,- paramsOf(repoModel.getObject(), parent));- link.add(new Label("label", GitUtils.abbreviateSHA(parent)));- item.add(link);- }-- });-- if (getCommit().getParentCount() > 1) {- add(new DropDownChoice<String>("parentChoice", new IModel<String>() {- @Override- public void detach() {- }-- @Override- public String getObject() {- return getCompareWith();- }+ final WebMarkupContainer parentsContainer = new WebMarkupContainer("parents");+ parentsContainer.setOutputMarkupId(true);+ add(parentsContainer);+ if (getParents().size() == 1) {+ String parent = getParents().get(0);+ Link<Void> link = new BookmarkablePageLink<Void>("parent", RepoCommitPage.class,+ paramsOf(repoModel.getObject(), parent));+ link.add(new Label("label", GitUtils.abbreviateSHA(parent)));+ parentsContainer.add(link);+ parentsContainer.add(new WebMarkupContainer("parents").setVisible(false));+ } else {+ parentsContainer.add(new WebMarkupContainer("parent").setVisible(false));+ parentsContainer.add(new ListView<String>("parents", new LoadableDetachableModel<List<String>>() {@Override- public void setObject(String object) {- setCompareWith(object);+ protected List<String> load() {+ return getParents();}- }, getParents(), new IChoiceRenderer<String>() {+ }) {@Override- public Object getDisplayValue(String object) {- return GitUtils.abbreviateSHA(object);- }+ protected void populateItem(ListItem<String> item) {+ final String parent = item.getModelObject();+ Link<Void> link = new BookmarkablePageLink<Void>("link", RepoCommitPage.class,+ paramsOf(repoModel.getObject(), parent));+ link.add(new Label("label", GitUtils.abbreviateSHA(parent)));+ item.add(link);++ item.add(new AjaxLink<Void>("diff") {- @Override- public String getIdValue(String object, int index) {- return object;+ @Override+ public void onClick(AjaxRequestTarget target) {+ setCompareWith(parent);+ target.add(parentsContainer);+ newCompareResult(target);+ }++ @Override+ protected void onInitialize() {+ super.onInitialize();+ if (parent.equals(getCompareWith()))+ add(AttributeAppender.append("class", "active"));+ }++ });}- }).add(new OnChangeAjaxBehavior() {-- @Override- protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {- super.updateAjaxAttributes(attributes);- attributes.getAjaxCallListeners().add(new IndicateLoadingListener());- }-- @Override- protected void onUpdate(AjaxRequestTarget target) {- newCompareResult(target);- pushState(target);- }-- }));- } else {- add(new WebMarkupContainer("parentChoice").setVisible(false));+ });}-+if (getCommit().getParentCount() != 0) {- add(diffOption = new DiffOptionPanel("diffOption", repoModel, getCommit().name()) {+ add(diffOption = new DiffOptionPanel("compareOption", repoModel, getCommit().name()) {@Overrideprotected void onSelectPath(AjaxRequestTarget target, String path) {@@ -305,7 +285,7 @@ public class RepoCommitPage extends RepositoryPage {});newCompareResult(null);} else {- add(new WebMarkupContainer("diffOption").setVisible(false));+ add(new WebMarkupContainer("compareOption").setVisible(false));add(new WebMarkupContainer("compareResult").setVisible(false));}}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 57bdd5da89..2ec9a37b5e 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@@ -1,47 +1,44 @@-<wicket:extend>- <div id="repo-commits">- <div class="head">- <form wicket:id="query" class="query">- <div class="input-group">- <input wicket:id="input" spellcheck="false" class="form-control" placeholder="Filter by branch, tag, commit id, file path, date, user or commit message"></input>- <span class="input-group-btn">- <button wicket:id="submit" type="submit" class="btn btn-default" title="Query"><i class="fa fa-search"></i></button>- </span>- </div>- </form>- <div wicket:id="feedback"></div>- </div>- <div wicket:id="body" class="body">- <svg class="lane"></svg>- <ul class="list list-unstyled">- <li wicket:id="commits"></li>- </ul>- <div wicket:id="noCommits" class="no-commits"><i class="fa fa-exclamation-triangle"></i> No commits found</div>- </div>- <div wicket:id="foot" class="foot">- <a wicket:id="more" class="btn btn-default">More commits</a>- <div wicket:id="tooMany" class="alert alert-warning">Too many commits to load</div>- </div>- </div>- <wicket:fragment wicket:id="commitFrag">- <div class="avatar pull-left">- <span wicket:id="avatar"></span>- </div>- <div class="detail pull-left">- <div class="message-and-labels clearfix">- <div wicket:id="message" class="message pull-left"></div>- <span wicket:id="labels" class="label label-default pull-left"></span>- </div>- <div class="author">- <span wicket:id="name"></span> authored <span wicket:id="age"></span>- </div>- </div>- <div class="info pull-right">- <span wicket:id="hash"></span>- <a wicket:id="codeLink" title="Browse code at this point" class="btn btn-xs btn-default"><span class="fa fa-code"></span></a>- </div>- </wicket:fragment>- <wicket:fragment wicket:id="dateFrag">- <i class="fa fa-calendar"></i> <span wicket:id="date"></span>- </wicket:fragment>-</wicket:extend>+<wicket:extend>+ <div id="repo-commits">+ <div class="head">+ <form wicket:id="query" class="query">+ <div class="input-group">+ <input wicket:id="input" spellcheck="false" class="form-control" placeholder="Filter by branch, tag, commit id, file path, date, user or commit message"></input>+ <span class="input-group-btn">+ <button wicket:id="submit" type="submit" class="btn btn-default" title="Query"><i class="fa fa-search"></i></button>+ </span>+ </div>+ </form>+ <div wicket:id="feedback"></div>+ </div>+ <div wicket:id="body" class="body">+ <svg class="lane"></svg>+ <ul class="list list-unstyled">+ <li wicket:id="commits"></li>+ </ul>+ <div wicket:id="noCommits" class="no-commits"><i class="fa fa-exclamation-triangle"></i> No commits found</div>+ </div>+ <div wicket:id="foot" class="foot">+ <a wicket:id="more" class="btn btn-default">More commits</a>+ <div wicket:id="tooMany" class="alert alert-warning">Too many commits to load</div>+ </div>+ </div>+ <wicket:fragment wicket:id="commitFrag">+ <div class="avatar pull-left">+ <span wicket:id="avatar"></span>+ </div>+ <div class="detail pull-left">+ <div class="message-and-labels clearfix">+ <div wicket:id="message" class="message pull-left"></div>+ <span wicket:id="labels" class="label label-default pull-left"></span>+ </div>+ <div class="author">+ <span wicket:id="name"></span> authored <span wicket:id="age"></span>+ </div>+ </div>+ <div wicket:id="hashAndCode" class="pull-right"></div>+ </wicket:fragment>+ <wicket:fragment wicket:id="dateFrag">+ <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 e4f6881b42..5fb72c106e 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@@ -30,7 +30,6 @@ import org.apache.wicket.markup.html.WebMarkupContainer;import org.apache.wicket.markup.html.basic.Label;import org.apache.wicket.markup.html.form.Form;import org.apache.wicket.markup.html.form.TextField;-import org.apache.wicket.markup.html.link.BookmarkablePageLink;import org.apache.wicket.markup.html.panel.Fragment;import org.apache.wicket.markup.repeater.RepeatingView;import org.apache.wicket.model.IModel;@@ -62,14 +61,12 @@ import com.pmease.gitplex.core.manager.WorkManager;import com.pmease.gitplex.core.model.Repository;import com.pmease.gitplex.web.Constants;import com.pmease.gitplex.web.component.avatar.AvatarMode;-import com.pmease.gitplex.web.component.commithash.CommitHashPanel;import com.pmease.gitplex.web.component.commitmessage.CommitMessagePanel;+import com.pmease.gitplex.web.component.hashandcode.HashAndCodePanel;import com.pmease.gitplex.web.component.personlink.PersonLink;import com.pmease.gitplex.web.page.repository.RepositoryPage;import com.pmease.gitplex.web.page.repository.commit.CommitQueryParser.CriteriaContext;import com.pmease.gitplex.web.page.repository.commit.CommitQueryParser.QueryContext;-import com.pmease.gitplex.web.page.repository.file.RepoFilePage;-import com.pmease.gitplex.web.page.repository.file.RepoFileState;import com.pmease.gitplex.web.utils.DateUtils;import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel;@@ -485,12 +482,7 @@ public class RepoCommitsPage extends RepositoryPage {item.add(new PersonLink("name", Model.of(commit.getAuthor()), AvatarMode.NAME));item.add(new Label("age", DateUtils.formatAge(commit.getAuthor().getWhen())));- item.add(new CommitHashPanel("hash", Model.of(commit.getHash())));-- RepoFileState state = new RepoFileState();- state.blobIdent.revision = commit.getHash();- item.add(new BookmarkablePageLink<Void>("codeLink", RepoFilePage.class,- RepoFilePage.paramsOf(repoModel.getObject(), state)));+ item.add(new HashAndCodePanel("hashAndCode", repoModel, commit.getHash()));item.add(AttributeAppender.append("class", "commit clearfix"));} else {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commit.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commit.cssindex 4120e9eaf6..2fa3723f40 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commit.css+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commit.css@@ -1,14 +1,57 @@#repo-commit {padding: 20px;}-#repo-commit>.refs .branch:before {+#repo-commit>div {+ margin-bottom: 16px;+}+#repo-commit>.head {+ border: 1px solid #BBB;+ border-radius: 4px;+}+#repo-commit>.head>.summary {+ background: #F0F0F0;+ border-radius: 4px 4px 0 0;+ padding: 6px 12px;+ border-bottom: 1px solid #CCC;+}+#repo-commit>.head>.summary>.title {+ font-size: 16px;+ margin-right: 16px;+}+#repo-commit>.head>.detail {+ color: #666;+ padding: 12px;+}+#repo-commit>.head>.detail>div {+ margin-bottom: 12px;+}+#repo-commit>.head>.detail>div:last-child {+ margin-bottom: 0;+}+#repo-commit>.head>.detail>.origin-and-parents a {+ color: #444;+}+#repo-commit>.head>.detail .btn-group.parent {+ margin-right: 4px;+}++#repo-commit>.head>.detail>.refs {+ border-top: 1px dotted #BBB;+ padding-top: 12px;+}+#repo-commit>.head>.detail>.refs .branch:before {font-family: FontExt;content: "\f221";+ color: #444;}-#repo-commit>.refs .tag:before {+#repo-commit>.head>.detail>.refs .tag:before {font-family: Fontawesome;content: "\f02b";+ color: #444;}-#repo-commit>.refs>div>span {+#repo-commit>.head>.detail>.refs>div>span {margin-right: 6px;+}+#repo-commit>.head>.detail>.refs a {+ color: #444;}\ No newline at end of filediff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commit.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commit.jsindex 244db7f38c..61f87fe4a3 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commit.js+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/commit/repo-commit.js@@ -1,3 +1,9 @@gitplex.repocommit = {-+ initRefs: function(refsId) {+ var $refs = $("#" + refsId);+ if ($refs.children().length != 0)+ $refs.oneline("<a class='ellipsis-expander'><i class='fa fa-ellipsis-h'></i></a>", 10, 100);+ else+ $refs.parent().remove();+ }}\ No newline at end of filediff --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 95783982fe..6a0608af64 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@@ -1,183 +1,183 @@-#repo-commits {- position: relative;- padding: 20px;-}-#repo-commits>.head>.query {- margin-bottom: 20px;-}--#repo-commits>.body .no-commits {- font-style: italic;- font-size: 16px;-}-#repo-commits>.body li {- padding: 4px 0;-}-#repo-commits>.body .avatar {- width: 40px;-}-#repo-commits>.body .avatar img {- width: 40px;- height: 40px;-}-#repo-commits>.body .label {- margin: 2px 0 0 4px;-}-#repo-commits>.body .info {- text-align: right;- margin-top: 10px;- white-space: nowrap;-}-#repo-commits>.body a {- color: #666;-}-#repo-commits>.body a.summary {- font-weight: bold;-}-#repo-commits>.body .detail {- padding-left: 8px;- padding-right: 8px;-}-#repo-commits>.body .detail .name {- color: #666;-}-#repo-commits>.body .commit-hash {- font-family: monospace;-}-#repo-commits>.body li.commit:hover, #repo-commits>.body li.commit.hover {- background: #F7ECB9;-}-#repo-commits>.body .commit-message .highlight {- background: yellow;-}-#repo-commits>.body .commit-message>.full {- margin-bottom: 4px;-}-#repo-commits>.body .commit-message .detail {- margin-bottom: 8px;-}-#repo-commits>.body>.list {- margin-bottom: 0;-}-#repo-commits>.body>.lane {- position: absolute;-}-#repo-commits>.foot {- text-align: center;-}-#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;- border-bottom: 1px solid #EEE;-}--.commit-dot {- fill: #53a8fd;- stroke: #53a8fd;-}-.commit-line {- stroke-width: 1px;- stroke: #53a8fd;- fill: none;-}--.commit-dot-color1 {- fill: #53a8fd;- stroke: #53a8fd;-}-.commit-line-color1 {- stroke: #53a8fd;-}--.commit-dot-color2 {- fill: #09c112;- stroke: #09c112;-}-.commit-line-color2 {- stroke: #09c112;-}--.commit-dot-color3 {- fill: #ff4242;- stroke: #ff4242;-}-.commit-line-color3 {- stroke: #ff4242;-}--.commit-dot-color4 {- fill: #0252a2;- stroke: #0252a2;-}-.commit-line-color4 {- stroke: #0252a2;-}--.commit-dot-color5 {- fill: #056d0b;- stroke: #056d0b;-}-.commit-line-color5 {- stroke: #056d0b;-}--.commit-dot-color6 {- fill: #b00000;- stroke: #b00000;-}-.commit-line-color6 {- stroke: #b00000;-}--.commit-dot-color7 {- fill: #af29f8;- stroke: #af29f8;-}-.commit-line-color7 {- stroke: #af29f8;-}--.commit-dot-color8 {- fill: #ee6c1e;- stroke: #ee6c1e;-}-.commit-line-color8 {- stroke: #ee6c1e;-}--.commit-dot-color9 {- fill: #ef56cd;- stroke: #ef56cd;-}-.commit-line-color9 {- stroke: #ef56cd;-}--.commit-dot-color10 {- fill: #630596;- stroke: #630596;-}-.commit-line-color10 {- stroke: #630596;-}--.commit-dot-color11 {- fill: #8e4509;- stroke: #8e4509;-}-.commit-line-color11 {- stroke: #8e4509;-}--.commit-dot-color12 {- fill: #9b0f7b;- stroke: #9b0f7b;-}-.commit-line-color12 {- stroke: #9b0f7b;-}+#repo-commits {+ position: relative;+ padding: 20px;+}+#repo-commits>.head>.query {+ margin-bottom: 20px;+}++#repo-commits>.body .no-commits {+ font-style: italic;+ font-size: 16px;+}+#repo-commits>.body li {+ padding: 4px 0;+}+#repo-commits>.body .avatar {+ width: 40px;+}+#repo-commits>.body .avatar img {+ width: 40px;+ height: 40px;+}+#repo-commits>.body .label {+ margin: 2px 0 0 4px;+}+#repo-commits>.body .hash-and-code {+ text-align: right;+ margin-top: 10px;+ white-space: nowrap;+}+#repo-commits>.body a {+ color: #666;+}+#repo-commits>.body a.summary {+ font-weight: bold;+}+#repo-commits>.body .detail {+ padding-left: 8px;+ padding-right: 8px;+}+#repo-commits>.body .detail .name {+ color: #666;+}+#repo-commits>.body .commit-hash {+ font-family: monospace;+}+#repo-commits>.body li.commit:hover, #repo-commits>.body li.commit.hover {+ background: #F7ECB9;+}+#repo-commits>.body .commit-message .highlight {+ background: yellow;+}+#repo-commits>.body .commit-message>.full {+ margin-bottom: 4px;+}+#repo-commits>.body .commit-message .detail {+ margin-bottom: 8px;+}+#repo-commits>.body>.list {+ margin-bottom: 0;+}+#repo-commits>.body>.lane {+ position: absolute;+}+#repo-commits>.foot {+ text-align: center;+}+#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;+ border-bottom: 1px solid #EEE;+}++.commit-dot {+ fill: #53a8fd;+ stroke: #53a8fd;+}+.commit-line {+ stroke-width: 1px;+ stroke: #53a8fd;+ fill: none;+}++.commit-dot-color1 {+ fill: #53a8fd;+ stroke: #53a8fd;+}+.commit-line-color1 {+ stroke: #53a8fd;+}++.commit-dot-color2 {+ fill: #09c112;+ stroke: #09c112;+}+.commit-line-color2 {+ stroke: #09c112;+}++.commit-dot-color3 {+ fill: #ff4242;+ stroke: #ff4242;+}+.commit-line-color3 {+ stroke: #ff4242;+}++.commit-dot-color4 {+ fill: #0252a2;+ stroke: #0252a2;+}+.commit-line-color4 {+ stroke: #0252a2;+}++.commit-dot-color5 {+ fill: #056d0b;+ stroke: #056d0b;+}+.commit-line-color5 {+ stroke: #056d0b;+}++.commit-dot-color6 {+ fill: #b00000;+ stroke: #b00000;+}+.commit-line-color6 {+ stroke: #b00000;+}++.commit-dot-color7 {+ fill: #af29f8;+ stroke: #af29f8;+}+.commit-line-color7 {+ stroke: #af29f8;+}++.commit-dot-color8 {+ fill: #ee6c1e;+ stroke: #ee6c1e;+}+.commit-line-color8 {+ stroke: #ee6c1e;+}++.commit-dot-color9 {+ fill: #ef56cd;+ stroke: #ef56cd;+}+.commit-line-color9 {+ stroke: #ef56cd;+}++.commit-dot-color10 {+ fill: #630596;+ stroke: #630596;+}+.commit-line-color10 {+ stroke: #630596;+}++.commit-dot-color11 {+ fill: #8e4509;+ stroke: #8e4509;+}+.commit-line-color11 {+ stroke: #8e4509;+}++.commit-dot-color12 {+ fill: #9b0f7b;+ stroke: #9b0f7b;+}+.commit-line-color12 {+ stroke: #9b0f7b;+}