Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a detailed HTML view

  • Loading branch information...
commit 79e9ba9fb604f9123db73c1ca728ef3e63fac6de 1 parent a47da8d
@pieter pieter authored
View
4,136 English.lproj/MainMenu.nib/designable.nib
2,221 additions, 1,915 deletions not shown
View
BIN  English.lproj/MainMenu.nib/keyedobjects.nib
Binary file not shown
View
14 GitTest.xcodeproj/project.pbxproj
@@ -15,6 +15,9 @@
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
F56524BB0E02D22D00F03B52 /* NSFileHandleExt.m in Sources */ = {isa = PBXBuildFile; fileRef = F56524B90E02D22D00F03B52 /* NSFileHandleExt.m */; };
F56524F00E02D45200F03B52 /* PBGitCommit.m in Sources */ = {isa = PBXBuildFile; fileRef = F56524EF0E02D45200F03B52 /* PBGitCommit.m */; };
+ F56526240E03D85900F03B52 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56526230E03D85900F03B52 /* WebKit.framework */; };
+ F565262B0E03D89B00F03B52 /* PBWebGitController.m in Sources */ = {isa = PBXBuildFile; fileRef = F565262A0E03D89B00F03B52 /* PBWebGitController.m */; };
+ F565265A0E03E71B00F03B52 /* commit.html in Resources */ = {isa = PBXBuildFile; fileRef = F56526590E03E71B00F03B52 /* commit.html */; };
F5945E170E02B0C200706420 /* PBGitRepository.m in Sources */ = {isa = PBXBuildFile; fileRef = F5945E160E02B0C200706420 /* PBGitRepository.m */; };
/* End PBXBuildFile section */
@@ -36,6 +39,10 @@
F56524BA0E02D22D00F03B52 /* NSFileHandleExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSFileHandleExt.h; sourceTree = "<group>"; };
F56524EE0E02D45200F03B52 /* PBGitCommit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitCommit.h; sourceTree = "<group>"; };
F56524EF0E02D45200F03B52 /* PBGitCommit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitCommit.m; sourceTree = "<group>"; };
+ F56526230E03D85900F03B52 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = /System/Library/Frameworks/WebKit.framework; sourceTree = "<absolute>"; };
+ F56526290E03D89B00F03B52 /* PBWebGitController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBWebGitController.h; sourceTree = "<group>"; };
+ F565262A0E03D89B00F03B52 /* PBWebGitController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBWebGitController.m; sourceTree = "<group>"; };
+ F56526590E03E71B00F03B52 /* commit.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = commit.html; path = html/commit.html; sourceTree = "<group>"; };
F5945E150E02B0C200706420 /* PBGitRepository.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitRepository.h; sourceTree = "<group>"; };
F5945E160E02B0C200706420 /* PBGitRepository.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitRepository.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -46,6 +53,7 @@
buildActionMask = 2147483647;
files = (
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
+ F56526240E03D85900F03B52 /* WebKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -55,6 +63,9 @@
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
+ F56526590E03E71B00F03B52 /* commit.html */,
+ F56526290E03D89B00F03B52 /* PBWebGitController.h */,
+ F565262A0E03D89B00F03B52 /* PBWebGitController.m */,
F56524B90E02D22D00F03B52 /* NSFileHandleExt.m */,
F56524BA0E02D22D00F03B52 /* NSFileHandleExt.h */,
77C8280B06725ACE000B614F /* GitTest_AppDelegate.h */,
@@ -70,6 +81,7 @@
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
+ F56526230E03D85900F03B52 /* WebKit.framework */,
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
);
name = "Linked Frameworks";
@@ -187,6 +199,7 @@
files = (
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
+ F565265A0E03E71B00F03B52 /* commit.html in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -203,6 +216,7 @@
F5945E170E02B0C200706420 /* PBGitRepository.m in Sources */,
F56524BB0E02D22D00F03B52 /* NSFileHandleExt.m in Sources */,
F56524F00E02D45200F03B52 /* PBGitCommit.m in Sources */,
+ F565262B0E03D89B00F03B52 /* PBWebGitController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
9 PBGitCommit.m
@@ -26,4 +26,13 @@ - (NSString*) details
NSString* details = [[NSString alloc] initWithData:[handle readDataToEndOfFile] encoding: NSASCIIStringEncoding];
return details;
}
+
++ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
+{
+ return NO;
+}
+
++ (BOOL)isKeyExcludedFromWebScript:(const char *)name {
+ return NO;
+}
@end
View
22 PBWebGitController.h
@@ -0,0 +1,22 @@
+//
+// PBWebGitController.h
+// GitTest
+//
+// Created by Pieter de Bie on 14-06-08.
+// Copyright 2008 __MyCompanyName__. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "GitTest_AppDelegate.h"
+#import <WebKit/WebKit.h>
+
+@interface PBWebGitController : NSObject {
+ IBOutlet GitTest_AppDelegate* controller;
+ IBOutlet WebView* view;
+ IBOutlet NSArrayController* commitsController;
+ NSString* diff;
+}
+
+- (void) changeContentTo: (id) content;
+@property (readonly) NSString* diff;
+@end
View
50 PBWebGitController.m
@@ -0,0 +1,50 @@
+//
+// PBWebGitController.m
+// GitTest
+//
+// Created by Pieter de Bie on 14-06-08.
+// Copyright 2008 __MyCompanyName__. All rights reserved.
+//
+
+#import "PBWebGitController.h"
+
+
+@implementation PBWebGitController
+
+@synthesize diff;
+
+- (void) awakeFromNib
+{
+ [commitsController addObserver:self forKeyPath:@"selection" options:0 context:@"ChangedCommit"];
+ NSLog(@"WebGitController activated");
+ NSLog([[NSBundle mainBundle] resourcePath]);
+ NSString* file = [[NSBundle mainBundle] pathForResource:@"commit" ofType:@"html"];
+ NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:file]];
+ NSLog(@"Request: %@", request);
+ [[view mainFrame] loadRequest:request];
+}
+
+- (void) webView:(id) view didFinishLoadForFrame:(id) frame
+{
+ NSLog(@"Loading done");
+ [self changeContentTo: [[commitsController selectedObjects] objectAtIndex:0]];
+}
+
+- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+ if (context == @"ChangedCommit") {
+ NSLog(@"SomethingChanged");
+ [self changeContentTo: [[commitsController selectedObjects] objectAtIndex:0]];
+ }
+ else {
+ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
+ }
+}
+
+- (void) changeContentTo: (id) content
+{
+ id script = [view windowScriptObject];
+ [script setValue: content forKey:@"CommitObject"];
+ [script callWebScriptMethod:@"doeHet" withArguments: nil];
+}
+@end
View
45 html/commit.html
@@ -0,0 +1,45 @@
+<html>
+<header>
+ <title>Details for commit</title>
+ <script type="text/JavaScript">
+ var doeHet = function() {
+ document.getElementById("commitID").innerHTML = CommitObject.sha;
+ document.getElementById("authorID").innerHTML = CommitObject.author;
+ document.getElementById("subjectID").innerHTML = CommitObject.subject;
+ details = CommitObject.details();
+ date = details.match(/Date:(.*)/)[1];
+ document.getElementById("date").innerHTML = date;
+ diffStart = details.indexOf("diff");
+ messageStart = details.indexOf("\n\n") + 2;
+ message = details.substring(messageStart,diffStart);
+ details = details.substring(diffStart);
+ document.getElementById("details").innerHTML = details;
+ document.getElementById("message").innerHTML = message.replace(/\n/g,"<br>");
+ }
+ </script>
+
+</header>
+
+<body style="padding: 0px; border: 0px">
+ <table style="width: 100%; font-size: 1.2em;">
+ <tr>
+ <td style="width: 100px; color:#999; text-align: right; text-weight: bold;">SHA:</td>
+ <td id="commitID"></td>
+ </tr>
+ <tr>
+ <td style="width: 100px; color:#999; text-align: right; text-weight: bold;">Author:</td>
+ <td id="authorID">Pieter de Bie</td>
+ </tr>
+ <tr>
+ <td style="width: 100px; color:#999; text-align: right; text-weight: bold;">Date:</td>
+ <td id="date">Pieter de Bie</td>
+ </tr>
+ <tr>
+ <td style="width: 100px; color:#999; text-align: right; text-weight: bold;">Subject:</td>
+ <td id="subjectID">Pieter de Bie</td>
+ </tr>
+ </table>
+ <hr>
+ <div id="message"></div>
+ <code><pre id="details"></pre></code>
+</body>
Please sign in to comment.
Something went wrong with that request. Please try again.