Permalink
Browse files

added support for story deadline attribute (releases)

  • Loading branch information...
1 parent edd1f9b commit bf636dfdfd534139fe767a77b29c3187e737473c @intabulas committed Aug 24, 2010
@@ -32,8 +32,8 @@
//#define CACHED_CONTENT
-#define LOG_NETWORK 0
-#define LOG_CONTENT 0
+#define LOG_NETWORK 1
+#define LOG_CONTENT 1
#define NO_COMPRESS_RESPONSE 0
#define SHOW_CURL_VERSION 0
@@ -51,6 +51,7 @@
#define kTagCreatedAt @"created_at"
#define kTagUpdatedAt @"updated_at"
#define kTagAcceptedAt @"accepted_at"
+#define kTagDeadline @"deadline"
#define kTagProject @"project"
#define kTagIterationLength @"iteration_length"
#define kTagWeekStartDay @"week_start_day"
@@ -36,6 +36,8 @@
@interface CommentCell : UITableViewCell {
PivotalNote *comment;
IBOutlet UITextView *commentText;
+ IBOutlet UILabel *commentName;
+ IBOutlet UILabel *commentWhen;
}
@property (nonatomic,retain) PivotalNote *comment;
@@ -55,6 +55,10 @@ - (void)setComment:(PivotalNote *)anComment {
comment = [anComment retain];
commentText.text = comment.text;
[commentText sizeThatFits:commentText.bounds.size];
+
+ [commentName setText:anComment.author];
+ [commentWhen setText:[anComment.createdAt prettyDate]];
+
anComment.visualHeight = commentText.bounds.size.height;
}
@@ -88,21 +88,25 @@ - (void)viewDidUnload {
#pragma mark Table view methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- return [comments count];
+ return 1;//[comments count];
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return 1;
+ return [comments count]; //1;
}
-- (UIView *)tableView: (UITableView *)tableView viewForHeaderInSection: (NSInteger)section {
- CommentHeaderView* headerView = [[[CommentHeaderView alloc] initWithFrame:CGRectMake(0, 0, commentTableView.bounds.size.width, 55)] autorelease];
- [headerView setNote:[comments objectAtIndex:section]];
- return headerView;
-}
+- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
+ return @"Comments";
+}
+//- (UIView *)tableView: (UITableView *)tableView viewForHeaderInSection: (NSInteger)section {
+// CommentHeaderView* headerView = [[[CommentHeaderView alloc] initWithFrame:CGRectMake(0, 0, commentTableView.bounds.size.width, 55)] autorelease];
+// [headerView setNote:[comments objectAtIndex:section]];
+// return headerView;
+//}
+//
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
@@ -114,8 +118,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
cell = commentCell;
}
- PivotalNote *note = (PivotalNote *)[comments objectAtIndex:indexPath.section];
-
+ PivotalNote *note = (PivotalNote *)[comments objectAtIndex:indexPath.row];
+
[cell setComment:note];
// Set up the cell...
@@ -142,7 +146,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
constrainedToSize:CGSizeMake(310.0f, CGFLOAT_MAX)
lineBreakMode:UILineBreakModeWordWrap];
- return detailTextSize.height + 25.0f;
+ return detailTextSize.height + 25.0f + 11.0f;
}
@@ -150,6 +150,8 @@ - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName names
}
} else if ([elementName isEqualToString:kTagAcceptedAt]) {
currentStory.acceptedAt = [dateFormatter dateFromString:currentElementValue];
+ } else if ([elementName isEqualToString:kTagDeadline]) {
+ currentStory.deadline = [dateFormatter dateFromString:currentElementValue];
} else if ([elementName isEqualToString:kTagText]) {
currentNote.text = currentElementValue;
} else if ([elementName isEqualToString:kTagLabels]) {
@@ -150,7 +150,8 @@ - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName names
currentStory.lighthouseUrl = currentElementValue;
} else if ([elementName isEqualToString:kTagLighthouseId]) {
currentStory.lighthouseId = [currentElementValue integerValue];
-
+ } else if ([elementName isEqualToString:kTagDeadline]) {
+ currentStory.deadline = [dateFormatter dateFromString:currentElementValue];
} else if ([elementName isEqualToString:kTagAcceptedAt]) {
currentStory.acceptedAt = [dateFormatter dateFromString:currentElementValue];
} else if ([elementName isEqualToString:kTagText]) {
@@ -48,6 +48,7 @@
NSDate *createdAt;
NSDate *updatedAt;
NSDate *acceptedAt;
+ NSDate *deadline;
NSString *lighthouseUrl;
NSInteger lighthouseId;
@@ -71,6 +72,7 @@
@property (nonatomic, retain) NSDate *createdAt;
@property (nonatomic, retain) NSDate *updatedAt;
@property (nonatomic, retain) NSDate *acceptedAt;
+@property (nonatomic, retain) NSDate *deadline;
@property (nonatomic, retain) NSMutableArray *comments;
@property (nonatomic, retain) NSMutableArray *tasks;
@property (nonatomic, retain) NSMutableArray *attachments;
@@ -36,7 +36,7 @@
@implementation PivotalStory
@synthesize storyId, storyType, estimate, url, currentState, description, name, requestedBy, owner, createdAt, acceptedAt, comments,
- tasks, attachments, lighthouseId, lighthouseUrl, updatedAt, labels, project;
+ tasks, attachments, lighthouseId, lighthouseUrl, updatedAt, labels, project, deadline;
#pragma mark -
@@ -88,6 +88,7 @@ - (void)dealloc {
[createdAt release]; createdAt = nil;
[updatedAt release]; updatedAt = nil;
[acceptedAt release]; acceptedAt = nil;
+ [deadline release]; deadline = nil;
[lighthouseUrl release]; lighthouseUrl = nil;
[labels release]; labels = nil;
[super dealloc];
Oops, something went wrong.

0 comments on commit bf636df

Please sign in to comment.