The Unified and Autonomous Development Platform
Update server mark info when hit permanent link in source view
robin shinebefec23c47cc
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.js b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.jsindex bde777fd13..0b9803d183 100644--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.js+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.js@@ -463,7 +463,7 @@ pmease.commons = {"</div>");var $selectionPopup = $("#selection-popup");- $selectionPopup.data("show", function(position, permanentCallback, commentCallback, containerEl) {+ $selectionPopup.data("open", function(position, permanentCallback, commentCallback, containerEl) {var alignment = {target: {left: position.left, top: position.top, width: 0, height: 0},placement: {x: 50, y: 100, targetX: 0, targetY: 0}};diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotfile/blobview/source/SourceViewPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotfile/blobview/source/SourceViewPanel.javaindex 38443de20e..7b58b6add6 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotfile/blobview/source/SourceViewPanel.java+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotfile/blobview/source/SourceViewPanel.java@@ -310,7 +310,19 @@ public class SourceViewPanel extends BlobViewPanel {IRequestParameters params = RequestCycle.get().getRequest().getQueryParameters();switch(params.getParameterValue("action").toString()) {- case "add":+ case "mark":+ int fromLine = params.getParameterValue("param1").toInt();+ int fromCh = params.getParameterValue("param2").toInt();+ int toLine = params.getParameterValue("param3").toInt();+ int toCh = params.getParameterValue("param4").toInt();+ Mark mark = new Mark();+ mark.beginLine = fromLine;+ mark.beginChar = fromCh;+ mark.endLine = toLine;+ mark.endChar = toCh;+ context.onMark(target, mark);+ break;+ case "addComment":Preconditions.checkNotNull(SecurityUtils.getAccount());// must use commit from source view page in case we are commenting on@@ -318,10 +330,10 @@ public class SourceViewPanel extends BlobViewPanel {// displayedString commitHash = params.getParameterValue("param1").toString();- int fromLine = params.getParameterValue("param2").toInt();- int fromCh = params.getParameterValue("param3").toInt();- int toLine = params.getParameterValue("param4").toInt();- int toCh = params.getParameterValue("param5").toInt();+ fromLine = params.getParameterValue("param2").toInt();+ fromCh = params.getParameterValue("param3").toInt();+ toLine = params.getParameterValue("param4").toInt();+ toCh = params.getParameterValue("param5").toInt();Fragment fragment = new Fragment(BODY_ID, "newCommentFrag", SourceViewPanel.this);fragment.setOutputMarkupId(true);@@ -420,7 +432,7 @@ public class SourceViewPanel extends BlobViewPanel {target.add(commentContainer);target.appendJavaScript("gitplex.sourceview.onAddingComment();");break;- case "show":+ case "openComment":Long commentId = params.getParameterValue("param1").toLong();IModel<CodeComment> commentModel = new LoadableDetachableModel<CodeComment>() {diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotfile/blobview/source/source-view.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotfile/blobview/source/source-view.jsindex b5eed668da..f75cda6d7a 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotfile/blobview/source/source-view.js+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotfile/blobview/source/source-view.js@@ -126,7 +126,6 @@ gitplex.sourceview = {$permanentLink.click(function(e) {e.preventDefault();$("#selection-popup").hide();- pmease.commons.history.pushState(uri.toString());pmease.commons.codemirror.clearSelection(cm);pmease.commons.codemirror.mark(cm, {beginLine: from.line,@@ -134,6 +133,7 @@ gitplex.sourceview = {endLine: to.line,endChar: to.ch}, false);+ commentCallback("mark", from.line, from.ch, to.line, to.ch);});};var commentLinkCallback = function($commentLink) {@@ -152,13 +152,13 @@ gitplex.sourceview = {endLine: to.line,endChar: to.ch}, false);- commentCallback("add", commitHash, from.line, from.ch, to.line, to.ch);+ commentCallback("addComment", commitHash, from.line, from.ch, to.line, to.ch);});} else {$commentLink.html("Log in to comment on selection");}};- $("#selection-popup").data("show")(+ $("#selection-popup").data("open")(position, permanentLinkCallback, commentLinkCallback, $code[0]);} else {$("#selection-popup").hide();@@ -304,7 +304,7 @@ gitplex.sourceview = {return;}var commentInfo = commentInfos[$(this).index()];- commentCallback("show", commentInfo.id);+ commentCallback("openComment", commentInfo.id);});});gitplex.sourceview.highlightCommentTrigger();@@ -324,7 +324,7 @@ gitplex.sourceview = {&& !confirm("There are unsaved changes, discard and continue?")) {return;}- commentCallback("show", commentInfo.id);+ commentCallback("openComment", commentInfo.id);});}cm.setGutterMarker(parseInt(line), "CodeMirror-comments", $gutter[0]);diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.jsindex a79e882cb9..5bc74cc225 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.js+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/blob/text/text-diff.js@@ -350,7 +350,7 @@ gitplex.textdiff = {$commentLink.attr("href", invalidSelectionUrl);$commentLink.html("<i class='fa fa-comment'></i> Unable to comment this selection, see why");};- $("#selection-popup").data("show")(position, permanentCallback,+ $("#selection-popup").data("open")(position, permanentCallback,commentCallback, $container[0]);}@@ -462,7 +462,7 @@ gitplex.textdiff = {$commentLink.removeAttr("href");$commentLink.html("<i class='fa fa-comment'></i> Add comment for this selection");};- $("#selection-popup").data("show")(position, permanentCallback,+ $("#selection-popup").data("open")(position, permanentCallback,commentCallback, $container[0]);}, 100);diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/revision-diff.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/revision-diff.cssindex 165c4c14a3..f9291b3b62 100644--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/revision-diff.css+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/revision-diff.css@@ -28,7 +28,7 @@.revision-diff>.body>ul>li.diff-stat>.icon {margin-top: 2px;}-.revision-diff>.body>ul>li.diff-stat .fa-diff-modified, .revision-diff>ul>li.diff-stat .fa-diff-renamed {+.revision-diff>.body>ul>li.diff-stat .fa-diff-modified, .revision-diff>.body>ul>li.diff-stat .fa-diff-renamed {color: #D0B44C;}.revision-diff>.body>ul>li.diff-stat .fa-diff-added {