Skip to content
This repository has been archived by the owner on Apr 18, 2018. It is now read-only.

Commit

Permalink
Admin fixes; Cascade delete rule on some models
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel committed Nov 18, 2010
1 parent cdd4b91 commit b76d4cc
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 10 deletions.
2 changes: 2 additions & 0 deletions KegPad/Classes/Controllers/Admin/KBBeerEditViewController.h
Expand Up @@ -37,6 +37,8 @@
KBUIFormTextField *abvField_;
KBUIFormTextField *countryField_;
KBUIFormTextField *imageNameField_;

NSString *_beerEditId;
}

@property (assign, nonatomic) id<KBBeerEditViewControllerDelegate> delegate;
Expand Down
10 changes: 8 additions & 2 deletions KegPad/Classes/Controllers/Admin/KBBeerEditViewController.m
Expand Up @@ -62,10 +62,13 @@ - (void)dealloc {
[abvField_ release];
[countryField_ release];
[imageNameField_ release];
[_beerEditId release];
[super dealloc];
}

- (void)setBeer:(KBBeer *)beer {
[_beerEditId autorelease];
_beerEditId = [beer.id retain];
nameField_.text = beer.name;
infoField_.text = beer.info;
typeField_.text = beer.type;
Expand Down Expand Up @@ -96,9 +99,12 @@ - (void)_save {
NSString *country = countryField_.textField.text;
NSString *imageName = imageNameField_.textField.text;
float abv = [abvField_.textField.text floatValue];


NSString *identifier = _beerEditId;
if (!identifier) identifier = name;

NSError *error = nil;
KBBeer *beer = [[KBApplication dataStore] addOrUpdateBeerWithId:name name:name info:info type:type country:country imageName:imageName abv:abv error:&error];
KBBeer *beer = [[KBApplication dataStore] addOrUpdateBeerWithId:identifier name:name info:info type:type country:country imageName:imageName abv:abv error:&error];

if (!beer) {
[self showError:error];
Expand Down
4 changes: 3 additions & 1 deletion KegPad/Classes/Controllers/KBDisplayViewController.m
Expand Up @@ -283,7 +283,9 @@ - (void)_beerDidEdit:(NSNotification *)notification {
}

- (void)_kegDidEdit:(NSNotification *)notification {
[self updateKeg:[notification object]];
KBKeg *keg = [notification object];
if (keg_ == keg)
[self updateKeg:keg];
}

- (void)_kegTemperatureDidChange:(NSNotification *)notification {
Expand Down
4 changes: 3 additions & 1 deletion KegPad/Classes/Controllers/KBStatusViewController.m
Expand Up @@ -154,7 +154,9 @@ - (void)_beerDidEdit:(NSNotification *)notification {
}

- (void)_kegDidEdit:(NSNotification *)notification {
[self updateKeg:[notification object]];
KBKeg *keg = [notification object];
if (keg_ == keg)
[self updateKeg:keg];
}

- (void)_kegTemperatureDidChange:(NSNotification *)notification {
Expand Down
24 changes: 20 additions & 4 deletions KegPad/KegPad.xcodeproj/project.pbxproj
Expand Up @@ -57,6 +57,11 @@
00C114AD121121BA009C9B51 /* KBFetchedResultsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 00C114AC121121BA009C9B51 /* KBFetchedResultsViewController.m */; };
00C114D6121128DD009C9B51 /* kegs.json in Resources */ = {isa = PBXBuildFile; fileRef = 00C114B2121124B1009C9B51 /* kegs.json */; };
00C114EF1211297D009C9B51 /* KBUsersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 00C114EE1211297D009C9B51 /* KBUsersViewController.m */; };
00CB546E1294D9D50056FE12 /* 90_Minute_IPA.png in Resources */ = {isa = PBXBuildFile; fileRef = 00CB54691294D9D50056FE12 /* 90_Minute_IPA.png */; };
00CB546F1294D9D50056FE12 /* Punkin_Ale.png in Resources */ = {isa = PBXBuildFile; fileRef = 00CB546A1294D9D50056FE12 /* Punkin_Ale.png */; };
00CB54701294D9D50056FE12 /* Orchard_White.png in Resources */ = {isa = PBXBuildFile; fileRef = 00CB546B1294D9D50056FE12 /* Orchard_White.png */; };
00CB54711294D9D50056FE12 /* Mystery.png in Resources */ = {isa = PBXBuildFile; fileRef = 00CB546C1294D9D50056FE12 /* Mystery.png */; };
00CB54721294D9D50056FE12 /* Downtown_Brown.png in Resources */ = {isa = PBXBuildFile; fileRef = 00CB546D1294D9D50056FE12 /* Downtown_Brown.png */; };
00CD28981211DFC700DF808D /* chalk_bg.png in Resources */ = {isa = PBXBuildFile; fileRef = 00CD28961211DFC700DF808D /* chalk_bg.png */; };
00CD28991211DFC700DF808D /* wood_bg.png in Resources */ = {isa = PBXBuildFile; fileRef = 00CD28971211DFC700DF808D /* wood_bg.png */; };
00CD289F1211E42C00DF808D /* license.txt in Resources */ = {isa = PBXBuildFile; fileRef = 00CD289E1211E42C00DF808D /* license.txt */; };
Expand Down Expand Up @@ -229,6 +234,11 @@
00C114B2121124B1009C9B51 /* kegs.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = kegs.json; sourceTree = "<group>"; };
00C114ED1211297D009C9B51 /* KBUsersViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KBUsersViewController.h; sourceTree = "<group>"; };
00C114EE1211297D009C9B51 /* KBUsersViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KBUsersViewController.m; sourceTree = "<group>"; };
00CB54691294D9D50056FE12 /* 90_Minute_IPA.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = 90_Minute_IPA.png; sourceTree = "<group>"; };
00CB546A1294D9D50056FE12 /* Punkin_Ale.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Punkin_Ale.png; sourceTree = "<group>"; };
00CB546B1294D9D50056FE12 /* Orchard_White.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Orchard_White.png; sourceTree = "<group>"; };
00CB546C1294D9D50056FE12 /* Mystery.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Mystery.png; sourceTree = "<group>"; };
00CB546D1294D9D50056FE12 /* Downtown_Brown.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Downtown_Brown.png; sourceTree = "<group>"; };
00CD28961211DFC700DF808D /* chalk_bg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chalk_bg.png; sourceTree = "<group>"; };
00CD28971211DFC700DF808D /* wood_bg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = wood_bg.png; sourceTree = "<group>"; };
00CD289E1211E42C00DF808D /* license.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = license.txt; sourceTree = "<group>"; };
Expand Down Expand Up @@ -611,6 +621,11 @@
00D54ACA12028ECE00F76724 /* BeerLogos */ = {
isa = PBXGroup;
children = (
00CB54691294D9D50056FE12 /* 90_Minute_IPA.png */,
00CB546A1294D9D50056FE12 /* Punkin_Ale.png */,
00CB546B1294D9D50056FE12 /* Orchard_White.png */,
00CB546C1294D9D50056FE12 /* Mystery.png */,
00CB546D1294D9D50056FE12 /* Downtown_Brown.png */,
427ACC76126D1B790063CE3C /* Little_Sumpin_Wild.png */,
42373528127264E000C48796 /* Lagunitas_PILS.png */,
42373529127264E000C48796 /* Ommegang_BPA.png */,
Expand Down Expand Up @@ -890,6 +905,11 @@
427ACC77126D1B790063CE3C /* Little_Sumpin_Wild.png in Resources */,
4237352A127264E000C48796 /* Lagunitas_PILS.png in Resources */,
4237352B127264E000C48796 /* Ommegang_BPA.png in Resources */,
00CB546E1294D9D50056FE12 /* 90_Minute_IPA.png in Resources */,
00CB546F1294D9D50056FE12 /* Punkin_Ale.png in Resources */,
00CB54701294D9D50056FE12 /* Orchard_White.png in Resources */,
00CB54711294D9D50056FE12 /* Mystery.png in Resources */,
00CB54721294D9D50056FE12 /* Downtown_Brown.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1001,10 +1021,6 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = KegPad_Prefix.pch;
INFOPLIST_FILE = "KegPad-Info.plist";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/Libraries/YAJL\"",
);
OTHER_LDFLAGS = (
"-ObjC",
"-all_load",
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified KegPad/Resources/KegPad.xcdatamodeld/KegPad-2.xcdatamodel/elements
Binary file not shown.
Binary file modified KegPad/Resources/KegPad.xcdatamodeld/KegPad-2.xcdatamodel/layout
Binary file not shown.
8 changes: 6 additions & 2 deletions KegPad/Scripts/deploy_to_kegmate
Expand Up @@ -6,21 +6,25 @@
# Options
# -k -- Nukes the sqlite data store


# Parse arguments
KILL_DATA_STORE=
while getopts 'k' OPTION
do
case $OPTION in
k) KILL_DATA_STORE=1
;;
?) printf "Usage: %s: [-k]\n" $(basename $0) >&2
?) printf "Usage: %s: [-k] \n" $(basename $0) >&2
exit 2
;;
esac
done
shift $(($OPTIND - 1))

KEGMATES="KegMate1.local KegMate2.local KegMate3.local"
if [ "$KEGMATES" == "" ]; then
KEGMATES="KegMate1.local KegMate2.local KegMate3.local"
fi

LOCAL_BUILD_DIR="`dirname $0`/../build"
# Loop through all kegmates
for KEGMATE in $KEGMATES; do
Expand Down

0 comments on commit b76d4cc

Please sign in to comment.