Change MyCompany stuff to Two Toasters

This commit is contained in:
Blake Watters
2011-01-16 21:51:39 -05:00
parent 319f7355af
commit 91e7f947fd
25 changed files with 73 additions and 70 deletions

View File

@@ -3,7 +3,7 @@
// DiscussionBoard
//
// Created by Jeremy Ellison on 1/7/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
// Copyright 2011 Two Toasters. All rights reserved.
//
#import "DBPostsTableViewController.h"
@@ -16,7 +16,7 @@
- (id)initWithTopicID:(NSString*)topicID {
if (self = [super initWithStyle:UITableViewStylePlain]) {
_topicID = [topicID retain];
self.title = @"Posts";
_resourcePath = [[NSString stringWithFormat:@"/topics/%@/posts", _topicID] retain];
_resourceClass = [DBPost class];
@@ -32,7 +32,7 @@
- (void)loadView {
[super loadView];
self.variableHeightRows = YES;
UIBarButtonItem* newItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addButtonWasPressed:)] autorelease];
self.navigationItem.rightBarButtonItem = newItem;
}
@@ -57,18 +57,18 @@
RKRequestTTModel* model = (RKRequestTTModel*)self.model;
NSMutableArray* postItems = [NSMutableArray arrayWithCapacity:[model.objects count]];
NSMutableArray* topicItems = [NSMutableArray arrayWithCapacity:2];
[topicItems addObject:[TTTableTextItem itemWithText:self.topic.name]];
// only add edit item if there is no current user (lazy login) or
// the current user id == topic user id.
NSNumber* topicUserId = self.topic.userID;
// if topicUserId is nil, the topic has no user for some reason (perhaps they got deleted).
if ([DBUser currentUser] == nil ||
if ([DBUser currentUser] == nil ||
(topicUserId && [[DBUser currentUser].userID isEqualToNumber:topicUserId])) {
NSString* editURL = [NSString stringWithFormat:@"db://topics/%@/edit", _topicID];
[topicItems addObject:[TTTableTextItem itemWithText:@"Edit" URL:editURL]];
}
for(DBPost* post in model.objects) {
NSString* url = [NSString stringWithFormat:@"db://posts/%@", post.postID];
NSString* imageURL = post.attachmentPath;
@@ -77,7 +77,7 @@
URL:url];
[postItems addObject:item];
}
TTSectionedDataSource* dataSource = [TTSectionedDataSource dataSourceWithArrays:@"Topic",
topicItems,
@"Posts",