THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

mention: Colorize mention link

tags/v1.11.0
Suwon Chae 1 year ago
parent
commit
a40084e25f
6 changed files with 45 additions and 40 deletions
  1. +27
    -3
      app/assets/stylesheets/less/_page.less
  2. +2
    -2
      app/utils/AutoLinkRenderer.java
  3. +1
    -0
      app/views/board/view.scala.html
  4. +7
    -17
      app/views/git/view.scala.html
  5. +1
    -0
      app/views/issue/view.scala.html
  6. +7
    -18
      app/views/milestone/view.scala.html

+ 27
- 3
app/assets/stylesheets/less/_page.less View File

@@ -3072,14 +3072,14 @@ label.inline-list {
&.mentioned {
.media-body {
&:before {
background-color: #C5EBFD;
background-color: #e1f5fe;
border-color: #56C5F7;
}
border: 1px solid #56C5F7;
}

.meta-info {
background-color: #C5EBFD;
background-color: #e1f5fe;
}
}

@@ -6652,7 +6652,8 @@ div.diff-body[data-outdated="true"] tr:hover .icon-comment {
color: white;

&.me {
background-color: #4FC3F7;
background-color: #BA68C8;
border: 1px solid #BA68C8;
}

&:hover {
@@ -6666,6 +6667,29 @@ div.diff-body[data-outdated="true"] tr:hover .icon-comment {
}
}

.project-link, .org-link {
-webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: 100%;
-webkit-font-feature-settings: "kern" 1;
-moz-font-feature-settings: "kern" 1;
-o-font-feature-settings: "kern" 1;
font-feature-settings: "kern" 1;
font-kerning: normal;
border: 1px solid #9741ff;
border-radius: 3px;
margin-right: 3px;
padding-left: 2px;
padding-right: 2px;
background-color: #9741ff;
font-weight: 600;
color: white;

&:hover {
color: white;
background-color: #9741ff !important;
}
}

.ago-date {
vertical-align: middle;
}


+ 2
- 2
app/utils/AutoLinkRenderer.java View File

@@ -305,7 +305,7 @@ public class AutoLinkRenderer {
Organization org = Organization.findByName(userId);

if(org != null) {
return new Link(RouteUtil.getUrl(org), "@" + org.name);
return new Link(RouteUtil.getUrl(org), "<span class='org-link'>@" + org.name + "</span>");
}

if (user.isAnonymous() ) {
@@ -333,7 +333,7 @@ public class AutoLinkRenderer {
Project project = Project.findByOwnerAndProjectName(ownerName, projectName);

if (project != null) {
return new Link(RouteUtil.getUrl(project), "@" + project.toString());
return new Link(RouteUtil.getUrl(project), "<span class='project-link'>@" + project.toString() + "</span>");
} else {
return Link.EMPTY_LINK;
}


+ 1
- 0
app/views/board/view.scala.html View File

@@ -251,6 +251,7 @@

// detect comment which contains mention at me
$(".comment-body:contains('@UserApp.currentUser().getPureNameOnly')").closest(".comment").addClass("mentioned");
$(".user-link:contains('@UserApp.currentUser().getPureNameOnly')").addClass("me");

$('#translate').one('click', function (e) {
var data = {


+ 7
- 17
app/views/git/view.scala.html View File

@@ -1,22 +1,8 @@
@**
* Yobi, Project Hosting SW
* Yona, 21st Century Project Hosting SW
*
* Copyright 2013 NAVER Corp.
* http://yobi.io
*
* @author Keesun Baik
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright Yona & Yobi Authors & NAVER Corp. & NAVER LABS Corp.
* https://yona.io
**@
@(project: Project, pull: PullRequest, canDeleteBranch: Boolean, canRestoreBranch: Boolean)

@@ -144,6 +130,10 @@
$("button.moreBtn").on("click", function(){
$(this).next("pre.commitMsg.desc").toggleClass("hidden");
});

// detect comment which contains mention at me
$(".comment-body:contains('@UserApp.currentUser().getPureNameOnly')").closest(".comment").addClass("mentioned");
$(".user-link:contains('@UserApp.currentUser().getPureNameOnly')").addClass("me");
});
</script>
}

+ 1
- 0
app/views/issue/view.scala.html View File

@@ -500,6 +500,7 @@

// detect comment which contains mention at me
$(".comment-body:contains('@UserApp.currentUser().getPureNameOnly')").closest(".comment").addClass("mentioned");
$(".user-link:contains('@UserApp.currentUser().getPureNameOnly')").addClass("me");
});

$(function () {


+ 7
- 18
app/views/milestone/view.scala.html View File

@@ -1,24 +1,10 @@
@**
* Yobi, Project Hosting SW
* Yona, 21st Century Project Hosting SW
*
* Copyright 2013 NAVER Corp.
* http://yobi.io
*
* @author Keesun Baik
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright Yona & Yobi Authors & NAVER Corp. & NAVER LABS Corp.
* https://yona.io
**@
@(title: String, milestone: models.Milestone, project: Project, issueState:State)
@(title: String, milestone: Milestone, project: Project, issueState:State)
@import scala.collection.immutable._
@import org.apache.commons.lang.StringUtils
@import utils.TemplateHelper._
@@ -155,6 +141,9 @@
"sMilestoneId" : "@milestone.id",
"sURLLabels" : "@routes.IssueApp.issues(project.owner, project.name)"
});

// detect links contains mention at me
$(".user-link:contains('@UserApp.currentUser().getPureNameOnly')").addClass("me");
});
</script>
}

Loading…
Cancel
Save