WebCommitView: Use a notification to display errors

This should give GitX some more consistency. Also, it will
give us a basis to build further changes on.
This commit is contained in:
Pieter de Bie
2008-10-21 22:46:33 +02:00
parent bd097b0eff
commit b1e3dd2212
7 changed files with 77 additions and 50 deletions
+30 -22
View File
@@ -1,25 +1,33 @@
var showFileChanges = function(file, cached) {
// New file?
var diff = $("diff");
var showNewFile = function(file)
{
$('title').innerHTML = "New file: " + file.path;
if (file.status == 0)
{
var contents = file.unstagedChanges();
if (contents)
diff.innerHTML = contents.escapeHTML();
else
diff.innerHTML = "Could not display changes";
diff.style.display= '';
$('title').innerHTML = "New file: " + file.path;
} else {
diff.style.display = 'none';
if (cached)
diff.innerHTML = file.cachedChangesAmend_(Controller.amend()).escapeHTML();
else
diff.innerHTML = file.unstagedChanges().escapeHTML();
highlightDiffs();
diff.style.display = '';
$("title").innerHTML = "Changes for " + file.path;
var contents = file.unstagedChanges();
if (!contents) {
notify("Can not display changes (Binary file?)", -1);
return;
}
diff.innerHTML = contents.escapeHTML();
}
var showFileChanges = function(file, cached) {
var diff = $("diff");
diff.style.display = 'none';
hideNotification();
if (file.status == 0) // New file?
return showNewFile(file);
if (cached) {
$("title").innerHTML = "Staged changes for " + file.path;
diff.innerHTML = file.cachedChangesAmend_(Controller.amend()).escapeHTML();
}
else {
$("title").innerHTML = "Unstaged changes for " + file.path;
diff.innerHTML = file.unstagedChanges().escapeHTML();
}
highlightDiffs();
diff.style.display = '';
}