Permalink
Browse files

Support for selecting different projects

  • Loading branch information...
Deepwinter
Deepwinter committed May 11, 2012
1 parent 148b97e commit 84ee4ec7af76c0c6fa16aae3cbf5f64c86612045
@@ -60,6 +60,8 @@ typedef void ( ^CompletedBlock )();
+ (NSArray *) getAllDocuments;
+ (NSArray *) getDocumentsInProject: (NSString *) project;
+ (NSArray *) getDocumentsInProject: (NSString *) project since: (NSString*) date;
++ (NSArray *) getProjects;
+
//+ (UIImage *) getThumbnailForId: (NSString *) documentId;
@@ -348,7 +348,7 @@ - (NSArray *) _getProjects {
CouchQuery * couchQuery = [design queryViewNamed: @"projects"]; //asLiveQuery];
couchQuery.groupLevel = 1;
CouchQueryEnumerator * enumerator = [couchQuery rows];
- NSMutableArray * r = [NSArray array];
+ NSMutableArray * r = [NSMutableArray array];
CouchQueryRow * row;
while( (row =[enumerator nextRow]) ){
[r addObject:row.key];
@@ -11,6 +11,7 @@
<string key="NS.object.0">933</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
+ <string>IBUIBarButtonItem</string>
<string>IBUITextView</string>
<string>IBUIButton</string>
<string>IBUILabel</string>
@@ -1045,15 +1046,71 @@
<object class="IBUINavigationBar" id="198110788">
<reference key="NSNextResponder" ref="1035323703"/>
<int key="NSvFlags">290</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="IBUIButton" id="220222544">
+ <reference key="NSNextResponder" ref="198110788"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{5, 4}, {102, 35}}</string>
+ <reference key="NSSuperview" ref="198110788"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="495565719"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <int key="IBUIButtonType">1</int>
+ <string key="IBUINormalTitle">&lt;</string>
+ <reference key="IBUIHighlightedTitleColor" ref="371461942"/>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+ </object>
+ <reference key="IBUINormalTitleShadowColor" ref="177670269"/>
+ <reference key="IBUIFontDescription" ref="1026745246"/>
+ <reference key="IBUIFont" ref="1062819592"/>
+ </object>
+ <object class="IBUIButton" id="495565719">
+ <reference key="NSNextResponder" ref="198110788"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{353, 4}, {102, 35}}</string>
+ <reference key="NSSuperview" ref="198110788"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="948486750"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <int key="IBUIButtonType">1</int>
+ <string key="IBUINormalTitle">+</string>
+ <reference key="IBUIHighlightedTitleColor" ref="371461942"/>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+ </object>
+ <reference key="IBUINormalTitleShadowColor" ref="177670269"/>
+ <reference key="IBUIFontDescription" ref="1026745246"/>
+ <reference key="IBUIFont" ref="1062819592"/>
+ </object>
+ </array>
<string key="NSFrame">{{0, -1}, {460, 44}}</string>
<reference key="NSSuperview" ref="1035323703"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="948486750"/>
+ <reference key="NSNextKeyView" ref="220222544"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<array key="IBUIItems">
<object class="IBUINavigationItem" id="955425165">
<reference key="IBUINavigationBar" ref="198110788"/>
<string key="IBUITitle">Title</string>
+ <object class="IBUIBarButtonItem" key="IBUILeftBarButtonItem" id="333830374">
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <reference key="IBUICustomView" ref="220222544"/>
+ <reference key="IBUINavigationItem" ref="955425165"/>
+ </object>
+ <object class="IBUIBarButtonItem" key="IBUIRightBarButtonItem" id="616676106">
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <reference key="IBUICustomView" ref="495565719"/>
+ <reference key="IBUINavigationItem" ref="955425165"/>
+ </object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
@@ -1365,6 +1422,24 @@
</object>
<int key="connectionID">130</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">didTouchAddProject:</string>
+ <reference key="source" ref="495565719"/>
+ <reference key="destination" ref="279123908"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">137</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">didTouchCancel:</string>
+ <reference key="source" ref="220222544"/>
+ <reference key="destination" ref="279123908"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">138</int>
+ </object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -1735,8 +1810,38 @@
<object class="IBObjectRecord">
<int key="objectID">129</int>
<reference key="object" ref="955425165"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="616676106"/>
+ <reference ref="333830374"/>
+ </array>
<reference key="parent" ref="198110788"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">134</int>
+ <reference key="object" ref="616676106"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="495565719"/>
+ </array>
+ <reference key="parent" ref="955425165"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">133</int>
+ <reference key="object" ref="495565719"/>
+ <reference key="parent" ref="616676106"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">136</int>
+ <reference key="object" ref="333830374"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="220222544"/>
+ </array>
+ <reference key="parent" ref="955425165"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">135</int>
+ <reference key="object" ref="220222544"/>
+ <reference key="parent" ref="333830374"/>
+ </object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -1760,6 +1865,10 @@
<string key="123.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="128.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="129.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="133.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="134.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="135.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="136.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="17.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="18.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<real value="0.0" key="18.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
@@ -1816,7 +1925,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">132</int>
+ <int key="maxID">138</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -2004,6 +2113,20 @@
<object class="IBPartialClassDescription">
<string key="className">ProjectsTableViewController</string>
<string key="superclassName">UIViewController</string>
+ <dictionary class="NSMutableDictionary" key="actions">
+ <string key="didTouchAddProject:">id</string>
+ <string key="didTouchCancel:">id</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="actionInfosByName">
+ <object class="IBActionInfo" key="didTouchAddProject:">
+ <string key="name">didTouchAddProject:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="didTouchCancel:">
+ <string key="name">didTouchCancel:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </dictionary>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">navigationBar</string>
<string key="NS.object.0">UINavigationBar</string>
@@ -12,8 +12,12 @@
<UITableViewDelegate, UITableViewDataSource>
{
IBOutlet UINavigationBar * navigationBar;
-
+ NSArray * projects;
}
@property(nonatomic, retain) UINavigationBar * navigationBar;
+@property(nonatomic, retain) NSArray * projects;
+
+-(IBAction) didTouchCancel:(id)sender;
+-(IBAction) didTouchAddProject:(id)sender;
@end
@@ -7,11 +7,13 @@
//
#import "ProjectsTableViewController.h"
+#import "RHDataModel.h"
@implementation ProjectsTableViewController
@synthesize navigationBar;
+@synthesize projects;
- (void)didReceiveMemoryWarning
{
@@ -28,7 +30,6 @@ - (void)viewDidLoad
[super viewDidLoad];
self.navigationBar.topItem.title = @"Choose a Project";
-
}
- (void)viewDidUnload
@@ -41,11 +42,14 @@ - (void)viewDidUnload
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
+ self.projects = [RHDataModel getProjects];
+
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
+
}
- (void)viewWillDisappear:(BOOL)animated
@@ -77,7 +81,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
{
#warning Incomplete method implementation.
// Return the number of rows in the section.
- return 2;
+ return [projects count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
@@ -90,7 +94,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}
// Configure the cell...
- cell.textLabel.text = @"SUP?";
+ cell.textLabel.text = (NSString*) [projects objectAtIndex: [indexPath row]];
return cell;
}
@@ -144,6 +148,19 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
*/
+ RHDataModel * rhDataModel = [RHDataModel instance];
+ rhDataModel.project = (NSString *) [self.projects objectAtIndex: [indexPath row]];
+
+}
+
+#pragma mark - IBActions
+
+-(IBAction) didTouchCancel:(id)sender{
+ [self.view removeFromSuperview];
+}
+
+-(IBAction) didTouchAddProject:(id)sender{
+
}
@end

0 comments on commit 84ee4ec

Please sign in to comment.