[Notice] Announcing the End of Demo Server [Read me]
codehistroy:fixed link on list button at code diff view
@190e24e3efee28444d4bfe32773e8c7068c82f3a
--- app/assets/stylesheets/less/_page.less
+++ app/assets/stylesheets/less/_page.less
... | ... | @@ -4577,8 +4577,12 @@ |
4577 | 4577 |
width: 40px; |
4578 | 4578 |
} |
4579 | 4579 |
.filename { float:left; line-height:30px; } |
4580 |
+ |
|
4581 |
+ .hide { |
|
4582 |
+ display:none; |
|
4583 |
+ } |
|
4580 | 4584 |
} |
4581 | 4585 |
|
4582 | 4586 |
div.diff-body[data-outdated="true"] tr:hover .icon-comment { |
4583 | 4587 |
visibility: hidden; |
4584 |
-} |
|
4588 |
+}(No newline at end of file) |
--- app/controllers/CodeHistoryApp.java
+++ app/controllers/CodeHistoryApp.java
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 |
import models.enumeration.Operation; |
13 | 13 |
|
14 | 14 |
import models.enumeration.ResourceType; |
15 |
+import org.apache.commons.lang.StringUtils; |
|
15 | 16 |
import org.eclipse.jgit.api.errors.GitAPIException; |
16 | 17 |
import org.eclipse.jgit.api.errors.NoHeadException; |
17 | 18 |
import org.tmatesoft.svn.core.SVNException; |
... | ... | @@ -156,6 +157,9 @@ |
156 | 157 |
List<CommitComment> comments = CommitComment.find.where().eq("commitId", |
157 | 158 |
commitId).eq("project.id", project.id).findList(); |
158 | 159 |
|
160 |
+ String selectedBranch = StringUtils.defaultIfBlank(request().getQueryString("branch"), "HEAD"); |
|
161 |
+ String path = StringUtils.defaultIfBlank(request().getQueryString("path"), ""); |
|
162 |
+ |
|
159 | 163 |
if(project.vcs.equals(RepositoryService.VCS_SUBVERSION)) { |
160 | 164 |
String patch = repository.getPatch(commitId); |
161 | 165 |
|
... | ... | @@ -163,9 +167,7 @@ |
163 | 167 |
return notFound(ErrorViews.NotFound.render("error.notfound", project)); |
164 | 168 |
} |
165 | 169 |
|
166 |
- String selectedBranch = request().getQueryString("branch"); |
|
167 |
- |
|
168 |
- return ok(svnDiff.render(project, commit, parentCommit, patch, comments, selectedBranch)); |
|
170 |
+ return ok(svnDiff.render(project, commit, parentCommit, patch, comments, selectedBranch, path)); |
|
169 | 171 |
} else { |
170 | 172 |
List<FileDiff> fileDiffs = repository.getDiff(commitId); |
171 | 173 |
|
... | ... | @@ -173,9 +175,7 @@ |
173 | 175 |
return notFound(ErrorViews.NotFound.render("error.notfound", project)); |
174 | 176 |
} |
175 | 177 |
|
176 |
- String selectedBranch = request().getQueryString("branch"); |
|
177 |
- |
|
178 |
- return ok(diff.render(project, commit, parentCommit, comments, selectedBranch, fileDiffs)); |
|
178 |
+ return ok(diff.render(project, commit, parentCommit, comments, selectedBranch, fileDiffs, path)); |
|
179 | 179 |
} |
180 | 180 |
} |
181 | 181 |
|
--- app/views/code/diff.scala.html
+++ app/views/code/diff.scala.html
... | ... | @@ -1,4 +1,4 @@ |
1 |
-@(project: Project, commit:playRepository.Commit, parentCommit:playRepository.Commit, comments:List[CommitComment], selectedBranch:String, diff: List[playRepository.FileDiff]) |
|
1 |
+@(project: Project, commit:playRepository.Commit, parentCommit:playRepository.Commit, comments:List[CommitComment], selectedBranch:String, diff: List[playRepository.FileDiff],path:String) |
|
2 | 2 |
|
3 | 3 |
@import playRepository.RepositoryService |
4 | 4 |
@import java.net.URLEncoder |
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 |
<div class="code-browse-wrap"> |
15 | 15 |
<div id="branches" class="btn-group branches pull-right" data-name="branch" data-activate="manual"> |
16 | 16 |
<button class="btn dropdown-toggle large" data-toggle="dropdown"> |
17 |
- <span class="d-label">@if(selectedBranch){ @selectedBranch } else { HEAD }</span> |
|
17 |
+ <span class="d-label">@selectedBranch</span> |
|
18 | 18 |
<span class="d-caret"><span class="caret"></span></span> |
19 | 19 |
</button> |
20 | 20 |
<ul class="dropdown-menu"> |
... | ... | @@ -129,7 +129,7 @@ |
129 | 129 |
|
130 | 130 |
<button id="watch-button" type="button" class="ybtn @if(commit.getWatchers(project).contains(UserApp.currentUser())) { active ybtn-watching }" data-toggle="button">@Messages("notification.watch")</button> |
131 | 131 |
|
132 |
- <a href="javascript: history.back();" class="ybtn pull-right">@Messages("button.list")</a> |
|
132 |
+ <a href="@routes.CodeHistoryApp.history(project.owner, project.name, selectedBranch, path)" class="ybtn pull-right">@Messages("button.list")</a> |
|
133 | 133 |
|
134 | 134 |
<div id="minimap" class="minimap-outer"> |
135 | 135 |
<div class="minimap-wrap"> |
--- app/views/code/history.scala.html
+++ app/views/code/history.scala.html
... | ... | @@ -22,9 +22,13 @@ |
22 | 22 |
routes.CodeHistoryApp.historyUntilHead(project.owner, project.name) |
23 | 23 |
} |
24 | 24 |
} |
25 |
-@getShowCommitURL(project:Project, commit:playRepository.Commit) = @{ |
|
25 |
+@getShowCommitURL(project:Project, commit:playRepository.Commit, path:String) = @{ |
|
26 | 26 |
if(selectedBranch){ |
27 |
- routes.CodeHistoryApp.show(project.owner, project.name, commit.getId()) + "?branch=" + URLEncoder.encode(selectedBranch, "UTF-8") |
|
27 |
+ var queryString = "?branch=" + URLEncoder.encode(selectedBranch, "UTF-8"); |
|
28 |
+ if(path != null) { |
|
29 |
+ queryString += "&path=" + path; |
|
30 |
+ } |
|
31 |
+ routes.CodeHistoryApp.show(project.owner, project.name, commit.getId()) + queryString; |
|
28 | 32 |
} else { |
29 | 33 |
routes.CodeHistoryApp.show(project.owner, project.name, commit.getId()) |
30 | 34 |
} |
... | ... | @@ -105,15 +109,15 @@ |
105 | 109 |
</thead> |
106 | 110 |
<tbody class="tbody"> |
107 | 111 |
@for(commit <- history.iterator()) { |
108 |
- @defining(getShowCommitURL(project, commit)){ showCommitURL => |
|
112 |
+ @defining(getShowCommitURL(project, commit, path)){ showCommitURL => |
|
109 | 113 |
<tr> |
110 | 114 |
<td class="commit-id"> |
111 |
- <a href="@showCommitURL#@path" title="@Messages("code.showCommit")"> |
|
115 |
+ <a href="@showCommitURL" title="@Messages("code.showCommit")"> |
|
112 | 116 |
@commit.getShortId() |
113 | 117 |
</a> |
114 | 118 |
</td> |
115 | 119 |
<td class="messages"> |
116 |
- @defining(CommitComment.count(project, commit.getId, if(path != null){"/"+path}else{null})){ numOfComment => |
|
120 |
+ @defining(CommitComment.count(project, commit.getId, path)){ numOfComment => |
|
117 | 121 |
@if(numOfComment > 0) { |
118 | 122 |
<span class="number-of-comments"><i class="yobicon-comments"></i> @numOfComment</span> |
119 | 123 |
} |
... | ... | @@ -123,7 +127,7 @@ |
123 | 127 |
@if(commitMsg.startsWith("Merge pull request")){ |
124 | 128 |
@defining(commitMsg.split(" ")(3)) { pullRequestIdPart => |
125 | 129 |
@defining(pullRequestIdPart.replace("#", "").toLong) { pullRequestId => |
126 |
- <a href="@showCommitURL#@path"> |
|
130 |
+ <a href="@showCommitURL"> |
|
127 | 131 |
@defining(commitMsg.indexOf(" #")) { indexOfPullRequestStart => |
128 | 132 |
@commitMsg.split("\n")(0).substring(0, indexOfPullRequestStart) |
129 | 133 |
} |
... | ... | @@ -131,7 +135,7 @@ |
131 | 135 |
<a href="@routes.PullRequestApp.pullRequest(project.owner, project.name, pullRequestId)" class="secondary-txt"> |
132 | 136 |
#@pullRequestId |
133 | 137 |
</a> |
134 |
- <a href="@showCommitURL#@path"> |
|
138 |
+ <a href="@showCommitURL"> |
|
135 | 139 |
@defining(commitMsg.indexOf(commitMsg.split(" ")(3)) + commitMsg.split(" ")(3).length) { indexOfPullRequestIdEnd => |
136 | 140 |
@commitMsg.split("\n")(0).substring(indexOfPullRequestIdEnd) |
137 | 141 |
} |
... | ... | @@ -139,7 +143,7 @@ |
139 | 143 |
} |
140 | 144 |
} |
141 | 145 |
} else { |
142 |
- <a href="@showCommitURL#@path">@commitMsg.split("\n")(0)</a> |
|
146 |
+ <a href="@showCommitURL">@commitMsg.split("\n")(0)</a> |
|
143 | 147 |
} |
144 | 148 |
|
145 | 149 |
@if(commitMsg.split("\n").length > 1){ |
--- app/views/code/svnDiff.scala.html
+++ app/views/code/svnDiff.scala.html
... | ... | @@ -1,4 +1,4 @@ |
1 |
-@(project: Project, commit:playRepository.Commit, parentCommit:playRepository.Commit, patch: String, comments:List[CommitComment], selectedBranch:String) |
|
1 |
+@(project: Project, commit:playRepository.Commit, parentCommit:playRepository.Commit, patch: String, comments:List[CommitComment], selectedBranch:String, path:String) |
|
2 | 2 |
|
3 | 3 |
@import playRepository.RepositoryService |
4 | 4 |
@import java.net.URLEncoder |
... | ... | @@ -91,7 +91,7 @@ |
91 | 91 |
</p> |
92 | 92 |
<pre class="commitMsg">@commit.getMessage</pre> |
93 | 93 |
<div class="diff-wrap"> |
94 |
- <div id="commit" class="diff-body show-comments">@patch</div> |
|
94 |
+ <div id="commit" data-commit-origin="true" class="diff-body show-comments hide">@patch</div> |
|
95 | 95 |
</div> |
96 | 96 |
<div id="compare" class="modal hide compare-wrap" tabindex="-1" role="dialog"> |
97 | 97 |
<h4 class="path"> |
... | ... | @@ -148,7 +148,7 @@ |
148 | 148 |
|
149 | 149 |
<button id="watch-button" type="button" class="ybtn @if(commit.getWatchers(project).contains(UserApp.currentUser())) { active }" data-toggle="button">@Messages("notification.watch")</button> |
150 | 150 |
|
151 |
- <a href="javascript: history.back();" class="ybtn pull-right">@Messages("button.list")</a> |
|
151 |
+ <a href="@routes.CodeHistoryApp.history(project.owner, project.name, selectedBranch, path)" class="ybtn pull-right">@Messages("button.list")</a> |
|
152 | 152 |
|
153 | 153 |
<div id="minimap" class="minimap-outer"> |
154 | 154 |
<div class="minimap-wrap"> |
--- public/javascripts/service/yobi.code.SvnDiff.js
+++ public/javascripts/service/yobi.code.SvnDiff.js
... | ... | @@ -50,7 +50,7 @@ |
50 | 50 |
htVar.sTplMiniMapLink = '<a href="#${id}" style="top:${top}px; height:${height}px;"></a>'; |
51 | 51 |
|
52 | 52 |
// yobi.Attachments |
53 |
- htVar.sTplFileItem = ('#tplAttachedFile').text(); |
|
53 |
+ htVar.sTplFileItem = $('#tplAttachedFile').text(); |
|
54 | 54 |
} |
55 | 55 |
|
56 | 56 |
/** |
... | ... | @@ -134,6 +134,8 @@ |
134 | 134 |
window.scrollTo(0, welTarget.offset().top); |
135 | 135 |
} |
136 | 136 |
} |
137 |
+ |
|
138 |
+ $('[data-commit-origin="true"]').removeClass("hide"); |
|
137 | 139 |
} |
138 | 140 |
|
139 | 141 |
/** |
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?