From 04a763cd6ebea061df13fd748f00a091df540781 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Mon, 25 May 2015 21:57:11 -0700 Subject: [PATCH] show date in post list --- Blog/Base.lproj/Main.storyboard | 21 ++++++++++++++++++--- Blog/Post.m | 21 +++++++++++---------- Blog/PostsViewController.m | 7 +++++-- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/Blog/Base.lproj/Main.storyboard b/Blog/Base.lproj/Main.storyboard index d1ece41..f686ca9 100644 --- a/Blog/Base.lproj/Main.storyboard +++ b/Blog/Base.lproj/Main.storyboard @@ -387,7 +387,7 @@ wanted with as little input and thought as possible. - + @@ -395,31 +395,46 @@ wanted with as little input and thought as possible. + + + + + + + + + + + + + + + diff --git a/Blog/Post.m b/Blog/Post.m index af7f539..236fe89 100644 --- a/Blog/Post.m +++ b/Blog/Post.m @@ -21,16 +21,17 @@ + (NSDictionary *)JSONKeyPathsByPropertyKey { return @{ - @"objectID" : @"id", - @"slug" : @"slug", - @"author" : @"author", - @"title" : @"title", - @"date" : @"date", - @"draft" : @"draft", - @"body" : @"body", - @"path" : @"url", - @"url" : @"link", - @"time" : @"", // ignore + @"objectID" : @"id", + @"slug" : @"slug", + @"author" : @"author", + @"title" : @"title", + @"date" : @"date", + @"draft" : @"draft", + @"body" : @"body", + @"path" : @"url", + @"url" : @"link", + @"time" : @"", // ignore + @"timestamp" : @"timestamp", }; } diff --git a/Blog/PostsViewController.m b/Blog/PostsViewController.m index d95aec9..846356f 100644 --- a/Blog/PostsViewController.m +++ b/Blog/PostsViewController.m @@ -531,6 +531,10 @@ static NSString *const StateRestorationBlogStatusTextKey = @"blogStatusText"; return [self postCollectionForSection:section].title; } +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + return 58; +} + - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { return 40; } @@ -549,8 +553,7 @@ static NSString *const StateRestorationBlogStatusTextKey = @"blogStatusText"; Post *post = [self postForIndexPath:indexPath]; NSString *prefix = post.link ? @"→ " : @""; NSString *title = [NSString stringWithFormat:@"%@%@", prefix, post.title.length ? post.title : @"Untitled"]; - NSString *date = post.draft ? @"" : post.date; - [cell configureWithTitle:title date:date]; + [cell configureWithTitle:title date:post.date]; return cell; }