
svn: Fix incorrect url to file at specific revision
Do not use jquery template for the url. We can't create a template string by routes.CodeApp.codeBrowserWithBranch because the method encodes path segments. It is a kind of duplication with the routes file, but currently I think there is no better way to solve this problem.
@857020afb39e5709c790df6a0c230f6ff75e8338
--- app/views/code/svnDiff.scala.html
+++ app/views/code/svnDiff.scala.html
... | ... | @@ -178,7 +178,7 @@ |
178 | 178 |
"sUnwatchUrl" : "@routes.WatchApp.unwatch(commit.asResource(project).asParameter)", |
179 | 179 |
"sParentCommitId": "@if(parentCommit != null){@parentCommit.getId}", |
180 | 180 |
"sCommitId" : "@commit.getId", |
181 |
- "sTplFileURL" : "@routes.CodeApp.codeBrowserWithBranch(project.owner, project.name, "${commitId}", "${path}")", |
|
181 |
+ "sCodeURL" : "@routes.CodeApp.codeBrowser(project.owner, project.name)" |
|
182 | 182 |
}); |
183 | 183 |
|
184 | 184 |
yobi.Mention({ |
--- public/javascripts/service/yobi.code.SvnDiff.js
+++ public/javascripts/service/yobi.code.SvnDiff.js
... | ... | @@ -50,6 +50,7 @@ |
50 | 50 |
htVar.sUnwatchUrl = htOptions.sUnwatchUrl; |
51 | 51 |
htVar.sParentCommitId = htOptions.sParentCommitId; |
52 | 52 |
htVar.sCommitId = htOptions.sCommitId; |
53 |
+ htVar.sCodeURL = htOptions.sCodeURL; |
|
53 | 54 |
htVar.sTplFileURL = htOptions.sTplFileURL; |
54 | 55 |
htVar.rxSlashes = /\//g; |
55 | 56 |
|
... | ... | @@ -444,7 +445,7 @@ |
444 | 445 |
} |
445 | 446 |
|
446 | 447 |
function _makeCommitLink(sPath,sCommitId) { |
447 |
- var sURL = $yobi.tmpl(htVar.sTplFileURL, {"commitId":sCommitId, "path":sPath}); |
|
448 |
+ var sURL = htVar.sCodeURL + "/" + sCommitId + "/" + sPath; |
|
448 | 449 |
var welCommit = $('<div/>',{class:'diff-partial-commit-id'}); |
449 | 450 |
var welCommitLink = $('<a/>',{href:sURL,target:'_blink'}).text(sCommitId); |
450 | 451 |
welCommit.append(welCommitLink); |
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?