Merge pull request #676 from team-lab/#672-fix-blank-diff-output

#672 fix blank diff output
This commit is contained in:
Naoki Takezoe
2015-03-25 13:00:20 +09:00
4 changed files with 24 additions and 16 deletions

View File

@@ -47,9 +47,6 @@
<tr>
<th style="font-weight: normal; line-height: 27px;" class="box-header">
@if(diff.changeType == ChangeType.COPY || diff.changeType == ChangeType.RENAME){
<span class="diffstat">
<img src="@assets/common/images/diff_move.png"/>
</span> @diff.oldPath -> @diff.newPath
@if(newCommitId.isDefined){
<div class="pull-right align-right">
<label class="checkbox" style="display: inline-block;"><input type="checkbox" class="ignore-whitespace" value="1"/>Ignore Space</label>
@@ -57,8 +54,18 @@
<a href="@url(repository)/blob/@newCommitId.get/@diff.newPath" class="btn btn-small" title="View the whole file at version @newCommitId.get.substring(0, 10)" data-toggle="tooltip">View</a>
</div>
}
<span class="diffstat">
<img src="@assets/common/images/diff_move.png"/>
</span> @diff.oldPath -> @diff.newPath
}
@if(diff.changeType == ChangeType.ADD || diff.changeType == ChangeType.MODIFY){
@if(newCommitId.isDefined){
<div class="pull-right align-right">
<label class="checkbox" style="display: inline-block;"><input type="checkbox" class="ignore-whitespace" value="1"/>Ignore Space</label>
<label class="checkbox" style="display: inline-block;"><input type="checkbox" class="toggle-notes" checked><span>Show notes</span></label>
<a href="@url(repository)/blob/@newCommitId.get/@diff.newPath" class="btn btn-small" title="View the whole file at version @newCommitId.get.substring(0, 10)" data-toggle="tooltip">View</a>
</div>
}
<span class="diffstat">
@if(diff.changeType == ChangeType.ADD){
<img src="@assets/common/images/diff_add.png"/>
@@ -67,24 +74,17 @@
}
</span>
@diff.newPath
@if(newCommitId.isDefined){
<div class="pull-right align-right">
<label class="checkbox" style="display: inline-block;"><input type="checkbox" class="ignore-whitespace" value="1"/>Ignore Space</label>
<label class="checkbox" style="display: inline-block;"><input type="checkbox" class="toggle-notes" checked><span>Show notes</span></label>
<a href="@url(repository)/blob/@newCommitId.get/@diff.newPath" class="btn btn-small" title="View the whole file at version @newCommitId.get.substring(0, 10)" data-toggle="tooltip">View</a>
</div>
}
}
@if(diff.changeType == ChangeType.DELETE){
<span class="diffstat">
<img src="@assets/common/images/diff_delete.png"/>
</span> @diff.oldPath
@if(oldCommitId.isDefined){
<div class="pull-right align-right">
<label class="checkbox" style="display: inline-block;"><input type="checkbox" class="toggle-notes" checked><span>Show notes</span></label>
<a href="@url(repository)/blob/@oldCommitId.get/@diff.oldPath" class="btn btn-small" title="View the whole file at version @oldCommitId.get.substring(0, 10)" data-toggle="tooltip">View</a>
</div>
}
<span class="diffstat">
<img src="@assets/common/images/diff_delete.png"/>
</span> @diff.oldPath
}
</th>
</tr>

View File

@@ -182,7 +182,7 @@ $(function(){
$('a[rel*=facebox]').facebox({
'loadingImage': '@assets/vendors/facebox/loading.gif',
'closeImage': '@assets/vendors/facebox/closelabel.png',
'closeImage': '@assets/vendors/facebox/closelabel.png'
});
$(document).on("click", ".js-fork-owner-select-target", function() {

View File

@@ -1121,6 +1121,9 @@ table.diff tbody tr.not-diff:hover td{
.diffstat-bar {
display: inline-block;
/* For IE 6/7 */
*display: inline;
*zoom: 1;
margin-left: 3px;
font-size: 16px;
color: #ddd;

View File

@@ -118,12 +118,17 @@ function JsDiffRender(params){
var dom = null;
return function(ln){
if(dom===null){
dom = prettyPrintOne(
var html = prettyPrintOne(
text.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/"/g,'&quot;').replace(/>/g,'&gt;'),
(/\.([^.]*)$/.exec(fileName)||[])[1],
true);
var re = /<li[^>]*id="?L([0-9]+)"?[^>]*>(.*?)<\/li>/gi, h;
dom=[];
while(h=re.exec(html)){
dom[h[1]]=h[2];
}
}
return (new RegExp('<li id="L'+ln+'"[^>]*>(.*?)</li>').exec(dom) || [])[1];
return dom[ln];
};
}
return this.renders(oplines, prettyDom(params.oldText, params.oldTextName), prettyDom(params.newText, params.newTextName));