fix: Fix Incorrect link of user info page
When to use context root feature (eg. application.context at conf file), user info page link guide to wrong path. Fix this problem.
@b4388e0dbab3343ac7d631a9ff1ec70aed87e67f
--- app/utils/Config.java
+++ app/utils/Config.java
... | ... | @@ -61,6 +61,10 @@ |
61 | 61 |
play.Configuration.root().getString("application.siteName"), "Yona"); |
62 | 62 |
} |
63 | 63 |
|
64 |
+ public static String getContextRoot(){ |
|
65 |
+ return play.Configuration.root().getString("application.context", "/"); |
|
66 |
+ } |
|
67 |
+ |
|
64 | 68 |
public static String getHostport(String defaultValue) { |
65 | 69 |
String hostname = play.Configuration.root().getString("application.hostname"); |
66 | 70 |
|
--- app/utils/TemplateHelper.scala
+++ app/utils/TemplateHelper.scala
... | ... | @@ -587,4 +587,8 @@ |
587 | 587 |
private def extractHeaderWordsInBrackets(title: String): Array[String] = { |
588 | 588 |
return title.split("(=\\[)|(?<=\\])") |
589 | 589 |
} |
590 |
+ |
|
591 |
+ def userInfo(loginId: String) = { |
|
592 |
+ Config.getContextRoot() + loginId |
|
593 |
+ } |
|
590 | 594 |
} |
--- app/views/issue/partial_comments.scala.html
+++ app/views/issue/partial_comments.scala.html
... | ... | @@ -28,7 +28,7 @@ |
28 | 28 |
@import utils.Markdown |
29 | 29 |
|
30 | 30 |
@avatarByLoginId(loginId: String, loginName: String) = { |
31 |
- <a href="@routes.UserApp.userInfo(loginId)" class="usf-group" data-toggle="tooltip" data-placement="top" title="@loginName"> |
|
31 |
+ <a href="@userInfo(loginId)" class="usf-group" data-toggle="tooltip" data-placement="top" title="@loginName"> |
|
32 | 32 |
<img src="@User.findByLoginId(loginId).avatarUrl" class="avatar-wrap small"> |
33 | 33 |
</a> |
34 | 34 |
} |
... | ... | @@ -37,7 +37,7 @@ |
37 | 37 |
@loginId match { |
38 | 38 |
case (loginId: String) => { |
39 | 39 |
@if(showAvatar){ @avatarByLoginId(loginId, loginName) } |
40 |
- <a href="@routes.UserApp.userInfo(loginId)" class="usf-group" data-toggle="tooltip" data-placement="top" title="@loginId"> |
|
40 |
+ <a href="@userInfo(loginId)" class="usf-group" data-toggle="tooltip" data-placement="top" title="@loginId"> |
|
41 | 41 |
<strong>@loginName</strong> |
42 | 42 |
</a> |
43 | 43 |
} |
... | ... | @@ -77,14 +77,14 @@ |
77 | 77 |
case (comment: Comment) => { |
78 | 78 |
<li class="comment @isAuthorComment(comment.authorLoginId)" id="comment-@comment.id"> |
79 | 79 |
<div class="comment-avatar"> |
80 |
- <a href="@routes.UserApp.userInfo(comment.authorLoginId)" class="avatar-wrap" data-toggle="tooltip" data-placement="top" title="@comment.authorName"> |
|
80 |
+ <a href="@userInfo(comment.authorLoginId)" class="avatar-wrap" data-toggle="tooltip" data-placement="top" title="@comment.authorName"> |
|
81 | 81 |
<img src="@User.findByLoginId(comment.authorLoginId).avatarUrl" width="32" height="32" alt="@comment.authorLoginId"> |
82 | 82 |
</a> |
83 | 83 |
</div> |
84 | 84 |
<div class="media-body"> |
85 | 85 |
<div class="meta-info"> |
86 | 86 |
<span class="comment_author pull-left"> |
87 |
- <a href="@routes.UserApp.userInfo(comment.authorLoginId)" data-toggle="tooltip" data-placement="top" title="@comment.authorName"> |
|
87 |
+ <a href="@userInfo(comment.authorLoginId)" data-toggle="tooltip" data-placement="top" title="@comment.authorName"> |
|
88 | 88 |
<strong>@comment.authorLoginId </strong> |
89 | 89 |
</a> |
90 | 90 |
</span> |
... | ... | @@ -112,7 +112,7 @@ |
112 | 112 |
@partial_voter_list("voters-" + issueComment.id, issueComment.voters) |
113 | 113 |
} else { |
114 | 114 |
@for(voter <- issueComment.voters){ |
115 |
- <a href="@routes.UserApp.userInfo(voter.loginId)" class="avatar-wrap smaller" data-toggle="tooltip" data-placement="top" title="@voter.name" style="margin-right:3px;"> |
|
115 |
+ <a href="@userInfo(voter.loginId)" class="avatar-wrap smaller" data-toggle="tooltip" data-placement="top" title="@voter.name" style="margin-right:3px;"> |
|
116 | 116 |
<img src="@User.findByLoginId(voter.loginId).avatarUrl"> |
117 | 117 |
</a> |
118 | 118 |
} |
--- app/views/issue/partial_voter_list.scala.html
+++ app/views/issue/partial_voter_list.scala.html
... | ... | @@ -20,6 +20,7 @@ |
20 | 20 |
**@ |
21 | 21 |
|
22 | 22 |
@(id:String, voters:Collection[User]) |
23 |
+@import utils.TemplateHelper._ |
|
23 | 24 |
|
24 | 25 |
<div id="@id" class="modal hide voters-dialog"> |
25 | 26 |
<div class="modal-header"> |
... | ... | @@ -30,7 +31,7 @@ |
30 | 31 |
<ul class="unstyled"> |
31 | 32 |
@for(voter <- voters){ |
32 | 33 |
<li> |
33 |
- <a href="@routes.UserApp.userInfo(voter.loginId)" class="usf-group" target="_blank"> |
|
34 |
+ <a href="@userInfo(voter.loginId)" class="usf-group" target="_blank"> |
|
34 | 35 |
<span class="avatar-wrap mlarge"> |
35 | 36 |
<img src="@voter.avatarUrl" width="40" height="40"> |
36 | 37 |
</span> |
--- app/views/issue/view.scala.html
+++ app/views/issue/view.scala.html
... | ... | @@ -84,7 +84,7 @@ |
84 | 84 |
<div class="board-body row-fluid"> |
85 | 85 |
<div class="span9"> |
86 | 86 |
<div class="author-info"> |
87 |
- <a href="@routes.UserApp.userInfo(issue.authorLoginId)" class="usf-group"> |
|
87 |
+ <a href="@userInfo(issue.authorLoginId)" class="usf-group"> |
|
88 | 88 |
<span class="avatar-wrap smaller"> |
89 | 89 |
<img src="@User.findByLoginId(issue.authorLoginId).avatarUrl" width="20" height="20"> |
90 | 90 |
</span> |
... | ... | @@ -184,7 +184,7 @@ |
184 | 184 |
@partial_assignee(project, issue) |
185 | 185 |
} else { |
186 | 186 |
@if(isAssigned){ |
187 |
- <a href="@routes.UserApp.userInfo(issue.assignee.user.loginId)" class="usf-group"> |
|
187 |
+ <a href="@userInfo(issue.assignee.user.loginId)" class="usf-group"> |
|
188 | 188 |
<span class="avatar-wrap smaller"> |
189 | 189 |
<img src="@User.findByLoginId(issue.assignee.user.loginId).avatarUrl" width="20" height="20"> |
190 | 190 |
</span> |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?