Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port from LinkIt Main Demo that has the following fixes:
1. Can delete selected members with the 'delete' key 2. Popup for when you access with Mobile Devices (unstyled) 3. Fixed a bug where you can't connect pets
- Loading branch information
Evin Grano
committed
Oct 9, 2010
1 parent
03449c5
commit 4564852
Showing
8 changed files
with
145 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// ========================================================================== | ||
// Project: FamilyTree - Core Actions | ||
// Copyright: ©2010 Evin Grano and Contributors | ||
// ========================================================================== | ||
/*globals FamilyTree */ | ||
|
||
/** @namespace | ||
My cool new app. Describe your application. | ||
@extends SC.Object | ||
*/ | ||
|
||
FamilyTree.mixin( /** @scope Orion */{ | ||
deleteSelectedMembers: function() { | ||
var selection, toRemove, family, | ||
len, confirmStr, alertController, | ||
fc = FamilyTree.familyController; | ||
|
||
selection = FamilyTree.membersController.get('selection'); | ||
toRemove = []; | ||
family = fc.get('content'); | ||
|
||
if (selection) { | ||
len = selection.get('length'); | ||
confirmStr = (len === 1) ? "Are you sure you want to delete this member" : "Are you sure you want to delete these members"; | ||
alertController = SC.Object.create({ | ||
|
||
button1Action: function() { | ||
// copy to a separate array since deleting elements changes the selection set itself | ||
if (selection && selection.isEnumerable) { | ||
selection.forEach(function(element) { | ||
toRemove.push(element); | ||
}); | ||
} | ||
|
||
if (family) { | ||
toRemove.forEach(function(member) { | ||
family.removeMember(member); | ||
}); | ||
} | ||
}, | ||
|
||
alertPaneDidDismiss: function(pane, status) { | ||
switch(status) { | ||
case SC.BUTTON1_STATUS: | ||
if (this.button1Action) this.button1Action(); | ||
break; | ||
|
||
case SC.BUTTON2_STATUS: | ||
if (this.button2Action) this.button2Action(); | ||
break; | ||
} | ||
} | ||
}); | ||
|
||
SC.AlertPane.warn("Delete?", confirmStr, '', "Delete", "Cancel", '', alertController); | ||
} | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters