Align the file summary

Use <table> element to lay out the file summary. The summary is tabular
data anyway so the use of <table> should be justified. First column
contains lines added, justified to right and the second column contains
lines removed, justified to the left. The last column has the file name.

Fixes #27
This commit is contained in:
Mikko Rantanen 2015-10-28 19:43:06 +02:00
parent 90b8892bb3
commit 26d349b736
2 changed files with 19 additions and 9 deletions

View file

@ -33,6 +33,10 @@
} }
.d2h-lines-added { .d2h-lines-added {
text-align: right;
}
.d2h-lines-added > * {
background-color: #ceffce; background-color: #ceffce;
border: 1px solid #b4e2b4; border: 1px solid #b4e2b4;
color: #399839; color: #399839;
@ -42,6 +46,10 @@
} }
.d2h-lines-deleted { .d2h-lines-deleted {
text-align: left;
}
.d2h-lines-deleted > * {
background-color: #f7c8c8; background-color: #f7c8c8;
border: 1px solid #e9aeae; border: 1px solid #e9aeae;
color: #c33; color: #c33;

View file

@ -21,19 +21,21 @@
' <a id="' + hideId + '" class="d2h-hide" href="#' + hideId + '">+</a>\n' + ' <a id="' + hideId + '" class="d2h-hide" href="#' + hideId + '">+</a>\n' +
' <a id="' + showId + 'd2h-show" class="d2h-show" href="#' + showId + '">-</a>\n' + ' <a id="' + showId + 'd2h-show" class="d2h-show" href="#' + showId + '">-</a>\n' +
' <div class="d2h-clear"></div>\n' + ' <div class="d2h-clear"></div>\n' +
' <div class="d2h-file-list">\n' + ' <table class="d2h-file-list">\n' +
diffFiles.map(function (file) { diffFiles.map(function (file) {
return ' <div class="d2h-file-list-line">\n' + return ' <tr class="d2h-file-list-line">\n' +
' <div class="d2h-file-stats">\n' + ' <td class="d2h-lines-added">\n' +
' <span class="d2h-lines-added">+' + file.addedLines + '</span>\n' + ' <span>+' + file.addedLines + '</span>\n' +
' <span class="d2h-lines-deleted">-' + file.deletedLines + '</span>\n' + ' </td>\n' +
' </div>\n' + ' <td class="d2h-lines-deleted">\n' +
' <div class="d2h-file-name"><a href="#' + printerUtils.getHtmlId(file) + '">&nbsp;' + printerUtils.getDiffName(file) + '</a></div>\n' + ' <span>-' + file.deletedLines + '</span>\n' +
' </div>\n' ' </td>\n' +
' <td class="d2h-file-name"><a href="#' + printerUtils.getHtmlId(file) + '">&nbsp;' + printerUtils.getDiffName(file) + '</a></td>\n' +
' </tr>\n'
}).join('\n') + }).join('\n') +
'</div></div>\n'; '</table></div>\n';
}; };
module.exports['FileListPrinter'] = new FileListPrinter(); module.exports['FileListPrinter'] = new FileListPrinter();