Skip to content

The Unified and Autonomous Development Platform

Leave prompt for unsaved comments.

robin shine1226e35fd512
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/asset/common.js b/commons.wicket/src/main/java/com/pmease/commons/wicket/asset/common.js
index 5fffb090ce..475e05649b 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/asset/common.js
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/asset/common.js
@@ -421,7 +421,7 @@ pmease.commons = {
$dirtyAware.attr("disabled", "disabled");
$form.areYouSure({
- "silent": true,
+ "silent": !$dirtyAware.hasClass("leave-confirm"),
"addRemoveFieldsMarksDirty": true,
change: function() {
if ($(this).hasClass("dirty")) {
@@ -752,8 +752,15 @@ pmease.commons = {
// Request to render via web socket right away after a web socket is opened
// in case we missed the message sent by WebSocketRender.requestToRender
// at Java side if web socket connection is not established at that time
- for (var i in pmease.commons.websocket.renderTraits)
- Wicket.WebSocket.send(JSON.stringify(pmease.commons.websocket.renderTraits[i]));
+ var messages = [];
+ for (var i in pmease.commons.websocket.renderTraits) {
+ var message = JSON.stringify(pmease.commons.websocket.renderTraits[i]);
+ // filter out duplicate messages
+ if (messages.indexOf(message) == -1)
+ messages.push(message);
+ }
+ for (var i in messages)
+ Wicket.WebSocket.send(messages[i]);
});
},
renderTraits:[]
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/StickyBehavior.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/StickyBehavior.java
index 4541897d74..523476c1c5 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/StickyBehavior.java
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/StickyBehavior.java
@@ -3,6 +3,7 @@ package com.pmease.commons.wicket.behavior;
import javax.annotation.Nullable;
import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.behavior.Behavior;
import org.apache.wicket.markup.head.IHeaderResponse;
@@ -11,6 +12,8 @@ import org.apache.wicket.markup.head.OnLoadHeaderItem;
@SuppressWarnings("serial")
public class StickyBehavior extends Behavior {
+ private Component component;
+
private final Component parent;
public StickyBehavior(@Nullable Component parent) {
@@ -28,12 +31,16 @@ public class StickyBehavior extends Behavior {
super.bind(component);
component.add(AttributeAppender.append("class", " sticky"));
component.setOutputMarkupId(true);
+
+ this.component = component;
}
- @Override
- public void renderHead(Component component, IHeaderResponse response) {
- super.renderHead(component, response);
-
+ public void restick(AjaxRequestTarget target) {
+ target.prependJavaScript(String.format("$('#%s').trigger('sticky_kit:detach');", component.getMarkupId()));
+ target.appendJavaScript(getStickScript());
+ }
+
+ private String getStickScript() {
String script;
if (parent != null) {
script = String.format("pmease.commons.stick('#%s', '#%s');",
@@ -42,9 +49,16 @@ public class StickyBehavior extends Behavior {
script = String.format("pmease.commons.stick('#%s', undefined);",
component.getMarkupId());
}
+ return script;
+ }
+
+ @Override
+ public void renderHead(Component component, IHeaderResponse response) {
+ super.renderHead(component, response);
+
// execute this script OnLoad instead of OnDomReady here, as sticky
// calculation will not be accurate if images are not loaded
- response.render(OnLoadHeaderItem.forScript(script));
+ response.render(OnLoadHeaderItem.forScript(getStickScript()));
}
}
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/websocket/WebSocketRenderBehavior.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/websocket/WebSocketRenderBehavior.java
index 779725244e..472b026bb7 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/websocket/WebSocketRenderBehavior.java
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/websocket/WebSocketRenderBehavior.java
@@ -28,7 +28,13 @@ public abstract class WebSocketRenderBehavior extends WebSocketBehavior {
new MapMaker().concurrencyLevel(16).weakKeys().makeMap();
private Component component;
+
+ private final boolean renderOnConnect;
+ public WebSocketRenderBehavior(boolean renderOnConnect) {
+ this.renderOnConnect = renderOnConnect;
+ }
+
@Override
public void bind(Component component) {
super.bind(component);
@@ -40,8 +46,10 @@ public abstract class WebSocketRenderBehavior extends WebSocketBehavior {
@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
- String script = String.format("pmease.commons.websocket.renderTraits.push(%s);", asMessage(getTrait()));
- response.render(OnDomReadyHeaderItem.forScript(script));
+ if (renderOnConnect) {
+ String script = String.format("pmease.commons.websocket.renderTraits.push(%s);", asMessage(getTrait()));
+ response.render(OnDomReadyHeaderItem.forScript(script));
+ }
}
@Override
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/comment/InlineComment.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/comment/InlineComment.java
index 996bfde13c..af4057a20e 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/comment/InlineComment.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/comment/InlineComment.java
@@ -5,7 +5,7 @@ import com.pmease.commons.util.diff.AroundContext;
public interface InlineComment extends Comment {
- int CONTEXT_SIZE = 10;
+ int CONTEXT_SIZE = 7;
BlobInfo getBlobInfo();
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/css/page.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/css/page.css
index db83bf7b98..54067d58f1 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/css/page.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/css/page.css
@@ -652,7 +652,7 @@ table.table-blob { width: 100%; }
.branches>.body>.options>div.search input {width: 240px;}
.branches>.body>.options .pagination {margin: 0;}
table.branches td {white-space: nowrap;}
-table.branches td.watch {width: 160px;}
+table.branches td.watch {width: 60px;}
table.branches td.actions {width: 1px;}
table.branches td.behind-ahead {width: 25%;}
table.branches td.behind {padding-right: 0;}
@@ -714,7 +714,7 @@ table.branches td.summary>div, table.branches td.summary>div .name a {font-size:
/* COMPARE RESULT */
.compare-result {width: 100%;}
.compare-result>tbody>tr>td {border: 1px solid #DDD; vertical-align: top;}
-.compare-result>tbody>tr>td.nav {width: 20%; padding: 8px; white-space: nowrap;}
+.compare-result>tbody>tr>td.nav {width: 20%; padding: 12px; white-space: nowrap;}
.compare-result>tbody>tr>td.nav a.active {background: #0F89E7; color: white; border-radius: 2px; padding: 2px;}
.compare-result>tbody>tr>td.content>div>div.error {padding: 20px; font-size: 24px; font-style: italic;}
@@ -797,13 +797,13 @@ ul.diff-alerts {margin: 0 0 0 8px; padding: 4px 8px 4px 12px;}
.comment-input>.tab-pane>.preview {display: none;}
div.replies {padding-top: 8px;}
-div.replies>table>tbody>tr>td {vertical-align: top; border-top: 1px dashed #CCC; padding: 8px 0 8px 0;}
+div.replies>table>tbody>tr>td {vertical-align: top; border-top: 1px dashed #DDD; padding: 8px 0 8px 0;}
div.replies>table>tbody>tr>td.avatar {width: 1px; padding: 10px 12px 0 0;}
div.replies>table>tbody>tr>td.avatar img {width: 26px; height: 26px;}
div.replies>table>tbody>tr.add-reply>td {padding-top: 12px;}
table.comments>tbody>tr>td.avatar {width: 1px; padding-right: 16px;}
table.comments>tbody>tr>td.avatar img {width: 36px; height: 36px;}
-table.comments>tbody>tr>td {border-top: 1px solid #DDD; padding: 12px 0 12px 0;}
+table.comments>tbody>tr>td {border-top: 1px solid #E5E5E5; padding: 12px 0 12px 0;}
table.comments>tbody>tr:first-child>td {border-top: none;}
ul.threads li {border-left: 4px solid #E5E5E5; padding-left: 8px;}
@@ -865,14 +865,14 @@ ul.status-help li:last-child .description {border-bottom: none;}
.request-detail>.title>div {margin-right: 8px;}
.request-detail>.title>.id {color: #999;}
-.request-detail>.overview>.panel-body>div {padding: 12px 0; border-bottom: 1px dotted #BBB;}
-.request-detail>.overview>.panel-body>div:last-child {padding: 8px 0 0 0; border-bottom: none;}
-.request-detail>.overview>.panel-body>div:first-child {padding: 0 0 8px 0;}
+.request-detail>.overview>.panel-body>div {padding: 16px 0; border-bottom: 1px dotted #BBB;}
+.request-detail>.overview>.panel-body>div:last-child {padding: 12px 0 0 0; border-bottom: none;}
+.request-detail>.overview>.panel-body>div:first-child {padding: 0 0 12px 0;}
.request-detail>.overview>.panel-body>div:first-child:last-child {padding: 0; border-bottom: none;}
.request-detail>.overview>.panel-heading {padding: 8px 12px;}
-.request-detail>.overview>.panel-body {padding: 12px;}
-.request-detail>.overview>.panel-heading>span:before {font-family: "ponticons"; margin-right: 8px; font-size: 18px;}
+.request-detail>.overview>.panel-body {padding: 16px;}
+.request-detail>.overview>.panel-heading>span:before {font-family: "ponticons"; margin-right: 12px; font-size: 18px;}
.request-detail>.overview.panel-success, .request-detail>.overview.panel-success>.panel-heading {border-color: #5EC01C;}
.request-detail>.overview.panel-danger, .request-detail>.overview.panel-danger>.panel-heading {border-color: #E67E7E;}
.request-detail>.overview.integrated>.panel-heading>span:before {content: "\f52A";}
@@ -882,21 +882,21 @@ ul.status-help li:last-child .description {border-bottom: none;}
.request-detail>.overview.pending-update>.panel-heading>span:before {content: "\f455";}
.request-detail>.overview>.panel-body>.status>.reasons>.reason .fa {font-size: 10px; vertical-align: middle;}
-.request-detail>.overview>.panel-body>.integration>.preview>div {padding: 8px; margin: 8px 0 0 0;
+.request-detail>.overview>.panel-body>.integration>.preview>div {padding: 8px; margin: 12px 0 0 0;
border: none; box-shadow: none;}
.request-detail>.overview>.panel-body>.integration>.preview>.well img {width: 20px; height: 20px; vertical-align: bottom;}
.request-detail>.overview>.panel-body>.operations>.buttons>a,
-.request-detail>.overview>.panel-body>.operations>.confirm>form>input {margin-right: 8px;}
-.request-detail>.overview>.panel-body>.operations>.confirm>form>div>textarea {margin-bottom: 12px;}
+.request-detail>.overview>.panel-body>.operations>.confirm>form>input {margin-right: 12px;}
+.request-detail>.overview>.panel-body>.operations>.confirm>form>div>textarea {margin-bottom: 16px;}
-.request-detail>.activities {margin-bottom: 20px; border-bottom: 1px solid #DDD;}
-.request-detail>.activities>tbody>tr.discussion>td {border-top: 1px solid #DDD; padding: 12px 0;}
+.request-detail>.activities {margin-bottom: 20px; border-bottom: 1px solid #E5E5E5;}
+.request-detail>.activities>tbody>tr.discussion>td {border-top: 1px solid #E5E5E5; padding: 12px 0;}
.request-detail>.activities>tbody>tr.discussion.collapsed>td {padding: 8px 0;}
.request-detail>.activities>tbody>tr.discussion>td.avatar {width: 1px; padding-right: 12px;}
.request-detail>.activities>tbody>tr.discussion>td.activity {padding-left: 12px;}
-.request-detail>.activities>tbody>tr.activity>td.avatar {border-right: 1px dashed #CCC;}
-.request-detail>.activities>tbody>tr.discussion+.non-discussion>td {border-top: 1px solid #DDD;}
+.request-detail>.activities>tbody>tr.activity>td.avatar {border-right: 1px dashed #DDD;}
+.request-detail>.activities>tbody>tr.discussion+.non-discussion>td {border-top: 1px solid #E5E5E5;}
.request-detail>.activities>tbody>tr.discussion>.avatar img {width: 40px; height: 40px;}
.request-detail>.activities>tbody>tr.non-discussion>td {padding-left: 6px;}
.request-detail>.activities>tbody>tr.non-discussion.non-update>td {padding: 6px;}
@@ -954,6 +954,8 @@ ul.status-help li:last-child .description {border-bottom: none;}
.request-detail .compare>.head {background: #F2F2F2; z-index: 90; padding: 8px;
border: 1px solid #DDD;}
+.request-detail .compare>.head>.changed-toggle {margin-right: 12px; padding-top: 4px;}
+.request-detail .compare>.head>.outdated-alert {padding-top: 2px; color: #CF9115; font-size: 16px;}
.request-detail .compare>.head>.pull-left:FIRST-CHILD {margin-right: 16px;}
.request-detail .compare>.head>.pull-left:LAST-CHILD {margin-top: 3px;}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/js/page.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/js/page.js
index 4a947f60d5..417ba85c32 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/js/page.js
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/assets/js/page.js
@@ -136,12 +136,14 @@ var gitplex = {
$("#comments-placeholder").append($("#add-comment"));
var $line = $("#diffline-" + index);
$line.next().find("td").append($("#comment-diffline-" + index));
+ $("#add-comment").areYouSure({"silent": "true"});
},
cancelAdd: function(index) {
$("#comments-placeholder").append($("#add-comment"));
var $line = $("#diffline-" + index);
$line.next().remove();
$line.find("a.add-comment").show();
+ $("#add-comment").areYouSure({"silent": "true"});
},
afterRemove: function(index) {
$("#comment-diffline-" + index).closest("tr").remove();
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CommentPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CommentPanel.html
index d12759cc9e..472311509f 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CommentPanel.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CommentPanel.html
@@ -42,7 +42,7 @@
<form wicket:id="form">
<div wicket:id="input"></div>
<div class="actions">
- <button wicket:id="save" class="btn btn-sm btn-primary">Save</button>
+ <button wicket:id="save" class="btn btn-sm btn-primary dirty-aware leave-confirm">Save</button>
&nbsp;&nbsp;
<button wicket:id="cancel" class="btn btn-sm btn-default">Cancel</button>
</div>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/TextDiffPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/TextDiffPanel.html
index 675321c2a9..64f8f97936 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/TextDiffPanel.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/TextDiffPanel.html
@@ -56,7 +56,7 @@
<form wicket:id="addComment" id="add-comment">
<div wicket:id="input"></div>
<div class="actions">
- <button wicket:id="save" class="btn btn-sm btn-primary dirty-aware">Comment on this line</button>
+ <button wicket:id="save" class="btn btn-sm btn-primary dirty-aware leave-confirm">Comment on this line</button>
&nbsp;&nbsp;&nbsp;&nbsp;
<button wicket:id="cancel" class="btn btn-sm btn-default">Close form</button>
</div>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/TestPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/TestPage.html
index 53dd9cc14a..f14e7f5454 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/TestPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/TestPage.html
@@ -1,6 +1,9 @@
<wicket:extend>
- <div class="notice" style="display:none;">Notice</div>
+ <form wicket:id="form" id="test">
+ <input wicket:id="name"></input>
+ <input wicket:id="save" type="button" value="save"></input>
+ </form>
<script type="text/javascript">
- $(".notice").highlight();
+ $("#test").areYouSure();
</script>
</wicket:extend>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/TestPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/TestPage.java
index c2faf6eb4d..7ab6b98465 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/TestPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/TestPage.java
@@ -1,10 +1,16 @@
package com.pmease.gitplex.web.page;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.SubmitLink;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
@SuppressWarnings("serial")
public class TestPage extends BasePage {
+ private String name;
+
public TestPage(PageParameters params) {
super(params);
}
@@ -12,6 +18,33 @@ public class TestPage extends BasePage {
@Override
protected void onInitialize() {
super.onInitialize();
+
+ add(new Form<Void>("form") {
+
+ @Override
+ protected void onInitialize() {
+ super.onInitialize();
+
+ add(new TextField<String>("name", new PropertyModel<String>(TestPage.this, "name")));
+
+ add(new SubmitLink("save") {
+
+ @Override
+ public void onSubmit() {
+ super.onSubmit();
+ System.out.println(name);
+ }
+
+ });
+ }
+
+ @Override
+ protected void onSubmit() {
+ super.onSubmit();
+ System.out.println(name);
+ }
+
+ });
}
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestActivitiesPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestActivitiesPage.html
index 8480ff4ff9..983755dd1d 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestActivitiesPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestActivitiesPage.html
@@ -8,7 +8,7 @@
<div wicket:id="addComment" class="add-comment">
<form wicket:id="form">
<div wicket:id="input" class="nofocus"></div>
- <button wicket:id="comment" class="btn btn-primary">Comment</button>
+ <button wicket:id="comment" class="dirty-aware leave-confirm btn btn-primary">Comment</button>
</form>
</div>
<wicket:fragment wicket:id="collapsedCommentFrag">
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestComparePage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestComparePage.html
index b7a227996f..7189fdd369 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestComparePage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestComparePage.html
@@ -15,9 +15,12 @@
<div wicket:id="oldChoices"></div>
<div wicket:id="newChoices"></div>
<div wicket:id="comparisonChoices"></div>
- <div class="pull-left">
+ <div class="pull-left changed-toggle">
<input wicket:id="changedOnly" type="checkbox"> Show changed files only</input>
</div>
+ <a wicket:id="refresh" class="pull-left outdated-alert">
+ <i class="fa fa-alert"></i> This page is out dated, click to refresh
+ </a>
</div>
<div wicket:id="compareResult" class="body"></div>
</div>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestComparePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestComparePage.java
index 1178d6e36e..e75572a5ca 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestComparePage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestComparePage.java
@@ -23,7 +23,10 @@ import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.protocol.ws.api.WebSocketRequestHandler;
import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.util.visit.IVisit;
+import org.apache.wicket.util.visit.IVisitor;
import com.google.common.base.Preconditions;
import com.pmease.commons.git.BlobInfo;
@@ -64,6 +67,14 @@ public class RequestComparePage extends RequestDetailPage {
private static final String TARGET_BRANCH_HEAD = "Head of Target Branch";
private static final String INTEGRATION_PREVIEW = "Integration Preview";
+
+ private static final String COMMENT_PARAM = "comment";
+
+ private static final String ORIGINAL_PARAM = "original";
+
+ private static final String REVISED_PARAM = "revised";
+
+ private static final String FILE_PARAM = "file";
private String file;
@@ -124,7 +135,7 @@ public class RequestComparePage extends RequestDetailPage {
@Override
protected PullRequestInlineComment load() {
- Long commentId = params.get("comment").toOptionalLong();
+ Long commentId = params.get(COMMENT_PARAM).toOptionalLong();
if (commentId != null)
return GitPlex.getInstance(Dao.class).load(PullRequestInlineComment.class, commentId);
else
@@ -133,20 +144,21 @@ public class RequestComparePage extends RequestDetailPage {
};
- oldCommitHash = params.get("original").toString();
- newCommitHash = params.get("revised").toString();
- file = params.get("file").toString();
+ oldCommitHash = params.get(ORIGINAL_PARAM).toString();
+ newCommitHash = params.get(REVISED_PARAM).toString();
+ file = params.get(FILE_PARAM).toString();
PullRequestInlineComment comment = getComment();
if (comment != null) {
- if (oldCommitHash != null || newCommitHash != null || file != null) {
- throw new IllegalArgumentException("Parameter 'original', 'revised', and 'file' "
+ if (oldCommitHash != null || newCommitHash != null) {
+ throw new IllegalArgumentException("Parameter 'original' or 'revised' "
+ "should not be specified if parameter 'comment' is specified.");
}
oldCommitHash = comment.getOldCommitHash();
newCommitHash = comment.getNewCommitHash();
- file = comment.getBlobInfo().getPath();
+ if (file == null)
+ file = comment.getBlobInfo().getPath();
} else {
if (oldCommitHash == null)
oldCommitHash = getPullRequest().getBaseCommitHash();
@@ -166,7 +178,6 @@ public class RequestComparePage extends RequestDetailPage {
WebMarkupContainer optionsContainer = new WebMarkupContainer("compareOptions");
optionsContainer.add(new StickyBehavior());
- optionsContainer.add(new PullRequestChangeBehavior(getPullRequest().getId()));
add(optionsContainer);
@@ -324,6 +335,48 @@ public class RequestComparePage extends RequestDetailPage {
}
}));
+ optionsContainer.add(new Link<Void>("refresh") {
+
+ @Override
+ protected void onInitialize() {
+ super.onInitialize();
+
+ add(new PullRequestChangeBehavior(getPullRequest().getId()) {
+
+ @Override
+ protected void onRender(final WebSocketRequestHandler handler) {
+ PageParameters params = getPageParameters();
+ if (params.get(COMMENT_PARAM).toOptionalLong() != null || getPageParameters().get(REVISED_PARAM).toString() == null) {
+ setVisible(true);
+ super.onRender(handler);
+
+ compareResult.visitChildren(new IVisitor<Component, Void>() {
+
+ @Override
+ public void component(Component object, IVisit<Void> visit) {
+ for (StickyBehavior behavior: object.getBehaviors(StickyBehavior.class))
+ behavior.restick(handler);
+ }
+
+ });
+ }
+ }
+
+ });
+
+ setVisible(false);
+ setOutputMarkupPlaceholderTag(true);
+ }
+
+ @Override
+ public void onClick() {
+ PageParameters params = getPageParameters();
+ if (file != null)
+ params.set(FILE_PARAM, file);
+ setResponsePage(RequestComparePage.class, params);
+ }
+
+ });
add(compareResult = new CompareResultPanel("compareResult", repoModel, oldCommitHash, newCommitHash, file) {
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestDetailPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestDetailPage.html
index 370419fa8c..4985fc2644 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestDetailPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestDetailPage.html
@@ -5,7 +5,7 @@
<div wicket:id="id" class="id pull-left"></div>
<a wicket:id="editLink" title="Edit title" class="edit"><i class="fa fa-pencil"></i></a>
<form wicket:id="editForm" class="pull-left form-inline">
- <input wicket:id="title" type="text" placeholder="Input title" class="form-control input-sm"></input>
+ <input wicket:id="title" type="text" placeholder="Input title" class="form-control input-sm focusable"></input>
<input wicket:id="save" type="submit" value="Save" class="btn btn-sm btn-primary"/>
<input wicket:id="cancel" type="button" value="Cancel" class="btn btn-sm btn-default"/>
</form>
@@ -109,7 +109,7 @@
<div wicket:id="backToTop"></div>
</div>
<wicket:fragment wicket:id="commitMessageFrag">
- <textarea wicket:id="commitMessage" class="form-control" placeholder="Commit message"></textarea>
+ <textarea wicket:id="commitMessage" class="form-control focusable" placeholder="Commit message"></textarea>
</wicket:fragment>
<wicket:fragment wicket:id="operationConfirmFrag">
<form wicket:id="form">
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestDetailPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestDetailPage.java
index 1b2aff9e12..8dfeeadfde 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestDetailPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/RequestDetailPage.java
@@ -294,7 +294,7 @@ public abstract class RequestDetailPage extends RepositoryPage {
overviewContainer.add(newIntegrationContainer());
overviewContainer.add(newOperationsContainer());
- overviewContainer.add(new WebSocketRenderBehavior() {
+ overviewContainer.add(new WebSocketRenderBehavior(true) {
@Override
protected Object getTrait() {
@@ -949,6 +949,8 @@ public abstract class RequestDetailPage extends RepositoryPage {
private final Long requestId;
public PullRequestChangeBehavior(Long requestId) {
+ super(false);
+
this.requestId = requestId;
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/activity/OpenActivityPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/activity/OpenActivityPanel.html
index f63ecf36f7..59a9a32c62 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/activity/OpenActivityPanel.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/activity/OpenActivityPanel.html
@@ -13,7 +13,7 @@
<form wicket:id="form">
<div wicket:id="input"></div>
<div class="actions">
- <button wicket:id="save" class="btn btn-sm btn-primary">Save</button>
+ <button wicket:id="save" class="btn btn-sm btn-primary dirty-aware leave-confirm">Save</button>
&nbsp;&nbsp;
<button wicket:id="cancel" class="btn btn-sm btn-default">Cancel</button>
</div>