Skip to content

The Unified and Autonomous Development Platform

Add comment permalink

robin shinea9a9d8b4b7b7
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/markdownviewer/markdown-viewer.css b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/markdownviewer/markdown-viewer.css
index 4a3e1985bf..7d006e8752 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/markdownviewer/markdown-viewer.css
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/markdownviewer/markdown-viewer.css
@@ -46,44 +46,44 @@
.md-preview .task-list-item input {
margin-right: 8px;
}
-.md-preview .anchored-h {
+.md-preview .permalinked {
position: relative;
margin-left: -20px;
padding-left: 20px;
}
-.md-preview .anchored-h a.anchor {
+.md-preview .permalinked a.permalink {
position: absolute;
display: none;
}
-.md-preview .anchored-h:hover a.anchor {
+.md-preview .permalinked:hover a.permalink {
display: inherit;
}
-.md-preview h1.anchored-h a.anchor {
+.md-preview h1.permalinked a.permalink {
font-size: 16px;
- left: 4px;
+ left: 3px;
top: 11px;
}
-.md-preview h2.anchored-h a.anchor {
+.md-preview h2.permalinked a.permalink {
font-size: 15px;
- left: 4px;
+ left: 3px;
top: 8px;
}
-.md-preview h3.anchored-h a.anchor {
+.md-preview h3.permalinked a.permalink {
font-size: 14px;
top: 6px;
- left: 4px;
+ left: 3px;
}
-.md-preview h4.anchored-h a.anchor {
+.md-preview h4.permalinked a.permalink {
font-size: 13px;
top: 3px;
- left: 5px;
+ left: 4px;
}
-.md-preview h5.anchored-h a.anchor {
+.md-preview h5.permalinked a.permalink {
font-size: 12px;
top: 2px;
- left: 6px;
+ left: 5px;
}
-.md-preview h6.anchored-h a.anchor {
+.md-preview h6.permalinked a.permalink {
font-size: 11px;
- left: 6px;
+ left: 5px;
}
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/markdownviewer/markdown-viewer.js b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/markdownviewer/markdown-viewer.js
index 4f5d0c3bad..4311e10f17 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/markdownviewer/markdown-viewer.js
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/markdownviewer/markdown-viewer.js
@@ -13,13 +13,13 @@ pmease.commons.initMarkdownViewer = function($preview, taskCallback) {
var $this = $(this);
var $anchor = $this.find(">a[name]");
if ($anchor.length != 0) {
- $this.addClass("anchored-h").append($anchor.html());
+ $this.addClass("permalinked").append($anchor.html());
$anchor.empty();
- $this.prepend("<a href='#" + $anchor.attr("name") + "' class='anchor'><i class='fa fa-link'></i></a>");
+ $this.prepend("<a href='#" + $anchor.attr("name") + "' class='permalink'><i class='fa fa-link'></i></a>");
} else {
var anchorName = encodeURIComponent($this.text());
- $this.addClass("anchored-h").prepend("<a name='" + anchorName + "'></a>");
- $this.prepend("<a href='#" + anchorName + "' class='anchor'><i class='fa fa-link'></i></a>");
+ $this.addClass("permalinked").prepend("<a name='" + anchorName + "'></a>");
+ $this.prepend("<a href='#" + anchorName + "' class='permalink'><i class='fa fa-link'></i></a>");
}
});
}
\ No newline at end of file
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 2ac96cd977..fe0ee5d8fb 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
@@ -1,7 +1,7 @@
<wicket:panel>
+ <a wicket:id="anchor"></a>
<div class="comment">
<div wicket:id="head" class="head activity-summary clearfix">
- <a wicket:id="anchor"></a>
<div class="pull-left">
<span wicket:id="user" class="user"></span> <span wicket:id="action"></span> <span wicket:id="age"></span>
</div>
@@ -9,6 +9,7 @@
<a wicket:id="edit" title="Edit comment"><span class="fa fa-pencil"></span></a>
<a wicket:id="delete" title="Delete comment"><span class="fa fa-times"></span></a>
<span wicket:id="additionalOperations"></span>
+ <a wicket:id="permalink" title="Permalink"><i class="fa fa-link"></i></a>
</div>
</div>
<div wicket:id="body" class="body"></div>
@@ -20,8 +21,8 @@
<div wicket:id="avatar"></div>
</td>
<td class="detail">
+ <a wicket:id="anchor"></a>
<div wicket:id="head" class="head activity-summary clearfix">
- <a wicket:id="anchor"></a>
<div class="pull-left">
<span wicket:id="user" class="user"></span> replied <span wicket:id="age"></span>
</div>
@@ -29,6 +30,7 @@
<a wicket:id="edit" title="Edit reply"><span class="fa fa-pencil"></span></a>
<a wicket:id="delete" title="Delete reply"><span class="fa fa-times"></span></a>
<span wicket:id="additionalOperations"></span>
+ <a wicket:id="permalink" title="Permalink"><i class="fa fa-link"></i></a>
</div>
</div>
<div wicket:id="body" class="body"></div>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CommentPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CommentPanel.java
index 37b1a1b962..635a04abe9 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CommentPanel.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CommentPanel.java
@@ -194,6 +194,9 @@ public class CommentPanel extends GenericPanel<Comment> {
protected void onInitialize() {
super.onInitialize();
+ String anchorName = "gp-comment" + getComment().getId();
+ add(new WebMarkupContainer("anchor").add(AttributeModifier.replace("name", anchorName)));
+
final WebMarkupContainer head = new WebMarkupContainer(HEAD_ID);
head.setOutputMarkupId(true);
add(head);
@@ -317,7 +320,7 @@ public class CommentPanel extends GenericPanel<Comment> {
}));
- head.add(new WebMarkupContainer("anchor").add(AttributeModifier.replace("name", "comment" + getComment().getId())));
+ head.add(new WebMarkupContainer("permalink").add(AttributeAppender.append("href", "#"+anchorName)));
add(renderComment());
@@ -483,6 +486,9 @@ public class CommentPanel extends GenericPanel<Comment> {
});
row.setOutputMarkupId(true);
+ String anchorName = "gp-comment-reply" + reply.getId();
+ row.add(new WebMarkupContainer("anchor").add(AttributeModifier.append("name", anchorName)));
+
WebMarkupContainer avatarColumn = new WebMarkupContainer("avatar");
avatarColumn.add(new UserLink("avatar", new UserModel(reply.getUser()), AvatarMode.AVATAR));
row.add(avatarColumn);
@@ -606,7 +612,7 @@ public class CommentPanel extends GenericPanel<Comment> {
}.add(new ConfirmBehavior("Do you really want to delete this reply?")));
head.add(newAdditionalReplyOperations("additionalOperations", (CommentReply) row.getDefaultModelObject()));
- head.add(new WebMarkupContainer("anchor").add(AttributeModifier.replace("name", "reply" + reply.getId())));
+ head.add(new WebMarkupContainer("permalink").add(AttributeAppender.append("href", "#"+anchorName)));
row.add(renderReply(reply));
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/overview/request-overview.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/overview/request-overview.css
index 65e8403c88..3e14a55f37 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/overview/request-overview.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/overview/request-overview.css
@@ -57,7 +57,7 @@
}
#request-detail .activities>table>tbody>tr.discussion>td.detail>div>.body,
#request-detail .activities>table>tbody>tr.discussion>td.detail>div>.comment>.body {
- padding: 10px;
+ padding: 10px 24px;
}
#request-detail .activities .comment .replies {
padding: 0 10px 10px 10px;
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/repository.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/repository.css
index a6ae57ff54..8c1934c104 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/repository.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/repository.css
@@ -11,6 +11,7 @@
}
#repository-head>.clone>label {
font-weight: normal;
+ margin-right: 4px;
}
#repository-head>.clone>input {
background: #666;