Skip to content

Commit

Permalink
Added style
Browse files Browse the repository at this point in the history
  • Loading branch information
maranas committed Feb 23, 2013
1 parent d1a6672 commit 19f3481
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 41 deletions.
21 changes: 20 additions & 1 deletion wordpresser/Controllers/GSPostViewerController.m
Expand Up @@ -40,6 +40,11 @@ - (void)viewDidLoad
l.shadowOffset = CGSizeMake(0,2);
l.shadowRadius = 2;
l.shadowOpacity = 0.2;
for(UIView *subview in [[[self.webView subviews] objectAtIndex:0] subviews]) {
if([subview isKindOfClass:[UIImageView class]]) {
[subview setHidden:YES];
}
}
}

- (void)viewDidUnload
Expand Down Expand Up @@ -121,7 +126,21 @@ - (void) contentLoadCallback:(id)res {
return;
}
}
NSString* htmlString = [page objectForKey:@"content"];
NSString* htmlStyle = @"<style type=\"text/css\">div.body {margin-top:20px; margin-bottom:20px; margin-right:20px; margin-left:20px; font-family: Georgia, serif} div.title {font-family: Helvetica, Verdana, serif; color:black; font-size: 20px; font-weight: bold;} div.author {color: gray; font-size: 12px; font-weight: italic} div.content {color: black} img {margin-top:10px; margin-bottom:10px; margin-right:10px; margin-left:10px;} </style>";

NSString *imageHeader = @"";
/* TODO: images? i don't think we need it
NSString* urlForImage = [GSPostsViewController extractImageURIFromPost:page];
if (urlForImage != nil) {
imageHeader = [NSString stringWithFormat:@"<img src=\"%@\"></img>", urlForImage];
}
*/
NSString* htmlString = [NSString stringWithFormat:@"<html><head>%@</head><body>%@<div class=\"body\"><div class=\"title\">%@</div><div class=\"author\"> by %@ </div><div class=\"content\">%@</div></div></body></html>",
htmlStyle,
imageHeader,
[page objectForKey:@"title"],
[[page objectForKey:@"author"] objectForKey:@"nickname"],
[page objectForKey:@"content"]];
[[self webView] loadHTMLString:htmlString baseURL:nil];
}

Expand Down
2 changes: 2 additions & 0 deletions wordpresser/Controllers/GSPostsViewController.h
Expand Up @@ -37,4 +37,6 @@
- (void) viewEntryForIndexPath:(NSIndexPath*)indexPath;
- (void) refreshCallback:(id)res;

+ (NSString*) extractImageURIFromPost:(id)post;

@end
4 changes: 2 additions & 2 deletions wordpresser/Controllers/GSPostsViewController.m
Expand Up @@ -280,7 +280,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
NSDictionary *post = [postData objectForKey:[postIDs objectAtIndex:indexPath.row]];
[[cell titleText] setText:[post objectForKey:@"title"]];
[[cell excerptText] setText:[post objectForKey:@"excerpt"]];
[[GSWordpressRequester sharedRequester] downloadImageFromURI:[self extractImageURIFromPost:post] forView:[cell imageView]];
[[GSWordpressRequester sharedRequester] downloadImageFromURI:[GSPostsViewController extractImageURIFromPost:post] forView:[cell imageView]];
}
else {
[[cell titleText] setHidden:YES];
Expand All @@ -305,7 +305,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N


// utility methods
- (NSString*) extractImageURIFromPost:(id)post
+ (NSString*) extractImageURIFromPost:(id)post
{
NSArray* attachments = [post objectForKey:@"attachments"];
if ([attachments count] > 0) {
Expand Down
56 changes: 28 additions & 28 deletions wordpresser/Interface Elements/GSPostViewer.xib
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1536</int>
<int key="IBDocument.SystemTarget">1552</int>
<string key="IBDocument.SystemVersion">12C60</string>
<string key="IBDocument.InterfaceBuilderVersion">2844</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1187.34</string>
<string key="IBDocument.HIToolboxVersion">625.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1930</string>
<string key="NS.object.0">2083</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
Expand Down Expand Up @@ -264,6 +264,16 @@
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">10</int>
<reference key="object" ref="1253967"/>
<reference key="parent" ref="56310587"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">43</int>
<reference key="object" ref="731291613"/>
<reference key="parent" ref="56310587"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="592770333"/>
Expand All @@ -286,18 +296,13 @@
<reference key="parent" ref="592770333"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">10</int>
<reference key="object" ref="1253967"/>
<reference key="parent" ref="56310587"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">29</int>
<reference key="object" ref="60328111"/>
<int key="objectID">36</int>
<reference key="object" ref="879446371"/>
<reference key="parent" ref="592770333"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">30</int>
<reference key="object" ref="369171475"/>
<int key="objectID">35</int>
<reference key="object" ref="178979992"/>
<reference key="parent" ref="592770333"/>
</object>
<object class="IBObjectRecord">
Expand All @@ -306,13 +311,13 @@
<reference key="parent" ref="592770333"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">32</int>
<reference key="object" ref="77524445"/>
<int key="objectID">34</int>
<reference key="object" ref="301446501"/>
<reference key="parent" ref="592770333"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">34</int>
<reference key="object" ref="301446501"/>
<int key="objectID">30</int>
<reference key="object" ref="369171475"/>
<reference key="parent" ref="592770333"/>
</object>
<object class="IBObjectRecord">
Expand All @@ -321,20 +326,15 @@
<reference key="parent" ref="592770333"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">35</int>
<reference key="object" ref="178979992"/>
<int key="objectID">29</int>
<reference key="object" ref="60328111"/>
<reference key="parent" ref="592770333"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">36</int>
<reference key="object" ref="879446371"/>
<int key="objectID">32</int>
<reference key="object" ref="77524445"/>
<reference key="parent" ref="592770333"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">43</int>
<reference key="object" ref="731291613"/>
<reference key="parent" ref="56310587"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
Expand All @@ -360,7 +360,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">44</int>
<int key="maxID">45</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand Down Expand Up @@ -421,14 +421,14 @@
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1536" key="NS.object.0"/>
<real value="1552" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="arrow-flip.png">{13, 20}</string>
<string key="arrow.png">{13, 20}</string>
</dictionary>
<string key="IBCocoaTouchPluginVersion">1930</string>
<string key="IBCocoaTouchPluginVersion">2083</string>
</data>
</archive>
26 changes: 16 additions & 10 deletions wordpresser/Interface Elements/GSPostsViewCell.xib
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1536</int>
<int key="IBDocument.SystemTarget">1552</int>
<string key="IBDocument.SystemVersion">12C60</string>
<string key="IBDocument.InterfaceBuilderVersion">2844</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1187.34</string>
<string key="IBDocument.HIToolboxVersion">625.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1930</string>
<string key="NS.object.0">2083</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
Expand Down Expand Up @@ -67,7 +67,9 @@
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">2</int>
<string key="name">Helvetica-Bold</string>
<string key="family">Helvetica</string>
<int key="traits">2</int>
<double key="pointSize">14</double>
</object>
<object class="NSFont" key="IBUIFont">
Expand Down Expand Up @@ -96,11 +98,13 @@
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUINumberOfLines">0</int>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">1</int>
<string key="name">Georgia</string>
<string key="family">Georgia</string>
<int key="traits">0</int>
<double key="pointSize">12</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<string key="NSName">Georgia</string>
<double key="NSSize">12</double>
<int key="NSfFlags">16</int>
</object>
Expand Down Expand Up @@ -140,11 +144,13 @@
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">1</int>
<string key="name">Georgia</string>
<string key="family">Georgia</string>
<int key="traits">0</int>
<double key="pointSize">17</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<string key="NSName">Georgia</string>
<double key="NSSize">17</double>
<int key="NSfFlags">16</int>
</object>
Expand Down Expand Up @@ -408,10 +414,10 @@
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1536" key="NS.object.0"/>
<real value="1552" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">1930</string>
<string key="IBCocoaTouchPluginVersion">2083</string>
</data>
</archive>

0 comments on commit 19f3481

Please sign in to comment.