mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
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:
+30
-22
@@ -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 = '';
|
||||
}
|
||||
Reference in New Issue
Block a user