From a3d0d66d31b2785edf82484564b591831c5f7d99 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Sat, 14 Jun 2008 20:08:01 +0200 Subject: [PATCH] Use a stylesheet for detailed view This simplifies the HTML code somewhat --- GitTest.xcodeproj/project.pbxproj | 14 +++++++++++++- PBGitCommit.m | 2 +- PBWebGitController.m | 4 +++- html/commit.html | 30 +++++++++++++++++++----------- html/commits.css | 28 ++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 14 deletions(-) create mode 100644 html/commits.css diff --git a/GitTest.xcodeproj/project.pbxproj b/GitTest.xcodeproj/project.pbxproj index bdcf547..5461be1 100644 --- a/GitTest.xcodeproj/project.pbxproj +++ b/GitTest.xcodeproj/project.pbxproj @@ -18,6 +18,7 @@ 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 */; }; + F58A8F280E043698007E3FC0 /* commits.css in Resources */ = {isa = PBXBuildFile; fileRef = F58A8F270E043698007E3FC0 /* commits.css */; }; F5945E170E02B0C200706420 /* PBGitRepository.m in Sources */ = {isa = PBXBuildFile; fileRef = F5945E160E02B0C200706420 /* PBGitRepository.m */; }; /* End PBXBuildFile section */ @@ -43,6 +44,7 @@ F56526290E03D89B00F03B52 /* PBWebGitController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBWebGitController.h; sourceTree = ""; }; F565262A0E03D89B00F03B52 /* PBWebGitController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBWebGitController.m; sourceTree = ""; }; F56526590E03E71B00F03B52 /* commit.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = commit.html; path = html/commit.html; sourceTree = ""; }; + F58A8F270E043698007E3FC0 /* commits.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = commits.css; path = html/commits.css; sourceTree = ""; }; F5945E150E02B0C200706420 /* PBGitRepository.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitRepository.h; sourceTree = ""; }; F5945E160E02B0C200706420 /* PBGitRepository.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitRepository.m; sourceTree = ""; }; /* End PBXFileReference section */ @@ -63,7 +65,6 @@ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( - F56526590E03E71B00F03B52 /* commit.html */, F56526290E03D89B00F03B52 /* PBWebGitController.h */, F565262A0E03D89B00F03B52 /* PBWebGitController.m */, F56524B90E02D22D00F03B52 /* NSFileHandleExt.m */, @@ -108,6 +109,7 @@ 29B97314FDCFA39411CA2CEA /* GitTest */ = { isa = PBXGroup; children = ( + F58A8F250E04368A007E3FC0 /* HTML */, 7756732906782D8800D1FEB8 /* Models */, 080E96DDFE201D6D7F000001 /* Classes */, 29B97315FDCFA39411CA2CEA /* Other Sources */, @@ -154,6 +156,15 @@ name = Models; sourceTree = ""; }; + F58A8F250E04368A007E3FC0 /* HTML */ = { + isa = PBXGroup; + children = ( + F56526590E03E71B00F03B52 /* commit.html */, + F58A8F270E043698007E3FC0 /* commits.css */, + ); + name = HTML; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -200,6 +211,7 @@ 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */, 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, F565265A0E03E71B00F03B52 /* commit.html in Resources */, + F58A8F280E043698007E3FC0 /* commits.css in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/PBGitCommit.m b/PBGitCommit.m index 9ade18d..f6ff763 100644 --- a/PBGitCommit.m +++ b/PBGitCommit.m @@ -22,7 +22,7 @@ - (NSString*) details { - NSFileHandle* handle = [self.repository handleForCommand:[@"show " stringByAppendingString:self.sha]]; + NSFileHandle* handle = [self.repository handleForCommand:[@"show --pretty=raw " stringByAppendingString:self.sha]]; NSString* details = [[NSString alloc] initWithData:[handle readDataToEndOfFile] encoding: NSASCIIStringEncoding]; return details; } diff --git a/PBWebGitController.m b/PBWebGitController.m index dda5248..df7ded1 100644 --- a/PBWebGitController.m +++ b/PBWebGitController.m @@ -33,7 +33,6 @@ - (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 { @@ -43,8 +42,11 @@ - (void) changeContentTo: (id) content { + NSLog(@"Starting Change"); id script = [view windowScriptObject]; [script setValue: content forKey:@"CommitObject"]; + NSLog(@"Done 1"); [script callWebScriptMethod:@"doeHet" withArguments: nil]; + NSLog(@"Change done"); } @end diff --git a/html/commit.html b/html/commit.html index 558a61e..9f45e85 100644 --- a/html/commit.html +++ b/html/commit.html @@ -1,45 +1,53 @@
Details for commit +
- +
- + - + - + - +
SHA:SHA:
Author:Author: Pieter de Bie
Date:Date: Pieter de Bie
Subject:Subject: Pieter de Bie

-
+
\ No newline at end of file diff --git a/html/commits.css b/html/commits.css new file mode 100644 index 0000000..bd757fa --- /dev/null +++ b/html/commits.css @@ -0,0 +1,28 @@ +#commit_header { + width: 100%; + font-family: Helvetica; + font-size: 12px; +} +.property_name { + width: 50px; + color:#999; + text-align: right; + font-weight: bold; +} +#message { + font-family: Helvetica; + font-size: 12px; +} + +#details { + font-family: Monaco; + font-size: 10px; + overflow: none; + width: 600px; +} +hr { + border: 0; + height: 1px; + width: 80%; + background-color: #999; +} \ No newline at end of file