Permalink
Browse files

HTML: Restructure html folder

This changes the HTML part of GitX to be more consistent -- we
now use a "views" directory where every web view has it's own
directory.

Furthermore, GitX-wide Javascript is added in the "lib" directory.
The same is true for CSS in the "css" directory. Every view can
have its own custom CSS and JS, and those are put in the views
directory (without JS or CSS prefix directories).
  • Loading branch information...
1 parent 4363ad1 commit bd097b0eff2a7099b73cb80d5a17c85f9b42a218 @pieter pieter committed Oct 21, 2008

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -12,7 +12,7 @@ @implementation PBWebChangesController
- (void) awakeFromNib
{
- startFile = @"diff";
+ startFile = @"commit";
[super awakeFromNib];
[unstagedFilesController addObserver:self forKeyPath:@"selection" options:0 context:@"UnstagedFileSelected"];
View
@@ -15,7 +15,9 @@ @implementation PBWebController
- (void) awakeFromNib
{
- NSString* file = [[NSBundle mainBundle] pathForResource:startFile ofType:@"html"];
+ NSString *path = [NSString stringWithFormat:@"html/views/%@", startFile];
+ NSString* file = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:path];
+ NSLog(@"path: %@, file: %@", path, file);
NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:file]];
finishedLoading = NO;
View
@@ -13,7 +13,7 @@ @implementation PBWebDiffController
- (void) awakeFromNib
{
- startFile = @"simpleDiff";
+ startFile = @"diff";
[super awakeFromNib];
[diffController addObserver:self forKeyPath:@"diff" options:0 context:@"ChangedDiff"];
}
View
@@ -24,7 +24,7 @@ @implementation PBWebHistoryController
- (void) awakeFromNib
{
- startFile = @"commit";
+ startFile = @"history";
[super awakeFromNib];
[historyController addObserver:self forKeyPath:@"webCommit" options:0 context:@"ChangedCommit"];
}
View
@@ -0,0 +1 @@
+@import url("diff.css");
@@ -29,13 +29,6 @@ pre code {
width: 100%;
}
-#message {
- margin: 5px;
- margin-left: 20px;
- font-family: Monaco;
- width: auto;
-}
-
#CurrentHunk {
border-left: 5px solid black;
}
View
@@ -1,63 +0,0 @@
-<html>
-<head>
- <title>Diff for file</title>
- <link rel="stylesheet" href="commits.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <link rel="stylesheet" href="diff_style.css" type="text/css" media="screen" title="no title" charset="utf-8">
-
- <script src="GitX.js" type="text/javascript" charset="utf-8"></script>
- <script src="diff.js" type="text/javascript" charset="utf-8"></script>
- <script>
- var showFileChanges = function(file, cached) {
- // New file?
- var diff = $("diff");
-
- 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;
- }
- }
- </script>
- <style type="text/css" media="screen">
- body {
- padding: 0px;
- margin: 0px;
- margin-top: 20px;
- }
- #title {
- padding: 0px;
- padding-left: 5px;
- border-bottom: 1px solid black;
- margin: 0px;
- font-weight: 500;
- background-color: #ECF3FD;
- font-size: 100%;
- position: fixed;
- font-family: Helvetica;
- top: 0px;
- width: 100%;
- }
- </style>
- <script src="diffHighlighter.js" type="text/javascript" charset="utf-8"></script>
- <script src="keyboardNavigation.js" type="text/javascript" charset="utf-8"></script>
-
-</head>
-<h1 id='title'>Nothing to commit</h1>
-<body style="padding: 0px; border: 0px" onLoad="">
- <pre><code class="diffcode" id='diff'>Nothing to commit (working directory clean)</code></pre>
-</body>
View
No changes.
File renamed without changes
@@ -24,4 +24,23 @@ Array.prototype.indexOf = function(item, i) {
for (; i < length; i++)
if (this[i] === item) return i;
return -1;
-};
+};
+
+var notify = function(text, state) {
+ var n = $("notification");
+ n.style.display = "";
+ $("notification_message").innerHTML = text;
+
+ // Change color
+ if (!state) { // Busy
+ $("spinner").style.display = "";
+ n.setAttribute("class", "");
+ }
+ else if (state == 1) { // Success
+ $("spinner").style.display = "none";
+ n.setAttribute("class", "success");
+ } else if (state == -1) {// Fail
+ $("spinner").style.display = "none";
+ n.setAttribute("class", "fail");
+ }
+}
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -1,19 +0,0 @@
-<html>
-<head>
- <title>Details for commit</title>
- <link rel="stylesheet" href="commits.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <link rel="stylesheet" href="diff_style.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script src="prototype.js" type="text/javascript" charset="utf-8"></script>
- <script src="diffHighlighter.js" type="text/javascript" charset="utf-8"></script>
- <script type="text/javascript" charset="utf-8">
-
- var showDiff = function(diff) {
- document.getElementById("details").innerHTML = diff.escapeHTML();
- highlightDiffs();
- }
- </script>
-</head>
-
-<body style="padding: 0px; border: 0px">
- <pre><code class="diffcode" id='details'></code></pre>
-</body>
@@ -0,0 +1,19 @@
+body {
+ padding: 0px;
+ margin: 0px;
+ margin-top: 20px;
+}
+
+#title {
+ padding: 0px;
+ padding-left: 5px;
+ border-bottom: 1px solid black;
+ margin: 0px;
+ font-weight: 500;
+ background-color: #ECF3FD;
+ font-size: 100%;
+ position: fixed;
+ font-family: Helvetica;
+ top: 0px;
+ width: 100%;
+}
@@ -0,0 +1,25 @@
+var showFileChanges = function(file, cached) {
+ // New file?
+ var diff = $("diff");
+
+ 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;
+ }
+}
@@ -0,0 +1,27 @@
+<html>
+<head>
+ <title>Diff for file</title>
+ <link rel="stylesheet" href="../../css/GitX.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script src="../../lib/GitX.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../../lib/md5.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../../lib/diffHighlighter.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../../lib/keyboardNavigation.js" type="text/javascript" charset="utf-8"></script>
+
+ <link rel="stylesheet" href="commit.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script src="commit.js" type="text/javascript" chahrset="utf-8"></script>
+</head>
+
+<body>
+ <h1 id='title'>Nothing to commit</h1>
+
+ <div id="notification" style="display:none;">
+ <img src="../../images/spinner.gif" alt="Spinner" id="spinner"></img>
+ <div id="notification_message"></div>
+ </div>
+
+ <pre>
+ <code class="diffcode" id='diff'>
+ Nothing to commit (working directory clean)
+ </code>
+ </pre>
+</body>
View
@@ -0,0 +1,21 @@
+<html>
+<head>
+ <title>Details for commit</title>
+ <link rel="stylesheet" href="../../css/GitX.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script src="../../lib/GitX.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../../lib/md5.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../../lib/diffHighlighter.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../../lib/keyboardNavigation.js" type="text/javascript" charset="utf-8"></script>
+
+ <script type="text/javascript" charset="utf-8">
+ var showDiff = function(diff) {
+ document.getElementById("details").innerHTML = diff.escapeHTML();
+ highlightDiffs();
+ }
+ </script>
+</head>
+
+<body>
+ <pre><code class="diffcode" id='details'>
+ </code></pre>
+</body>
@@ -79,8 +79,10 @@ a.servicebutton{
}
#message {
- font-family: Helvetica;
- margin-left: 0px;
+ font-family: Monaco;
+ margin: 5px;
+ margin-left: 20px;
+ width: auto;
font-size: 12px;
}
@@ -37,25 +37,6 @@ var Commit = function(obj) {
}
};
-var notify = function(text, state) {
- var n = $("notification");
- n.style.display = "";
- $("notification_message").innerHTML = text;
-
- // Change color
- if (!state) { // Busy
- $("spinner").style.display = "";
- n.setAttribute("class", "");
- }
- else if (state == 1) { // Success
- $("spinner").style.display = "none";
- n.setAttribute("class", "success");
- } else if (state == -1) {// Fail
- $("spinner").style.display = "none";
- n.setAttribute("class", "fail");
- }
-}
-
var gistie = function() {
notify("Uploading code to Gistie..", 0);
@@ -1,13 +1,14 @@
<html>
<head>
<title>Details for commit</title>
- <link rel="stylesheet" href="commits.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <link rel="stylesheet" href="diff_style.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script src="GitX.js" type="text/javascript" charset="utf-8"></script>
- <script src="md5.js" type="text/javascript" charset="utf-8"></script>
- <script src="commit.js" type="text/javascript" charset="utf-8"></script>
- <script src="diffHighlighter.js" type="text/javascript" charset="utf-8"></script>
- <script src="keyboardNavigation.js" type="text/javascript" charset="utf-8"></script>
+ <link rel="stylesheet" href="../../css/GitX.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script src="../../lib/GitX.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../../lib/md5.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../../lib/diffHighlighter.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../../lib/keyboardNavigation.js" type="text/javascript" charset="utf-8"></script>
+
+ <link rel="stylesheet" href="history.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script src="history.js" type="text/javascript" charset="utf-8"></script>
</head>
<body style="padding: 0px; border: 0px">
@@ -42,7 +43,7 @@
</tr>
</table>
<div id="notification" style="display:none;">
- <img src="spinner.gif" alt="Spinner" id="spinner"></img>
+ <img src="../../images/spinner.gif" alt="Spinner" id="spinner"></img>
<div id="notification_message"></div>
</div>
<hr>

0 comments on commit bd097b0

Please sign in to comment.