forked from trevorturk/eldorado
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restfulx is in place, prep for deploy to heroku. Misc. files installe…
…d for next dev step.
- Loading branch information
Carl Tanner
committed
Aug 5, 2009
1 parent
3a58efe
commit c34792f
Showing
84 changed files
with
4,361 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
captproton-restfulx --version=1.2.3 --source=gems.github.com |
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,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" | ||
xmlns:generated="eldorado.views.generated.*" | ||
xmlns:crafted="eldorado.views.crafted.*" | ||
paddingBottom="8" paddingLeft="8" paddingRight="8" paddingTop="8" | ||
layout="vertical" styleName="plain" initialize="init()"> | ||
<mx:Script> | ||
<![CDATA[ | ||
import org.restfulx.Rx; | ||
import eldorado.controllers.ApplicationController; | ||
private function init():void { | ||
ApplicationController.initialize(); | ||
} | ||
]]> | ||
</mx:Script> | ||
<mx:VBox width="95%" borderColor="0xACACAC" borderThickness="1" borderStyle="solid" horizontalAlign="center" | ||
paddingTop="5" paddingRight="5" paddingBottom="5" paddingLeft="5"> | ||
<mx:Image id="loadedImage" source="http://farm3.static.flickr.com/2472/3790267581_b6abbc180f.jpg" horizontalAlign="center" /> | ||
<mx:Text color="0x323232" text="CC credit http://www.flickr.com/photos/lierne/3790267581/" /> | ||
</mx:VBox> | ||
<mx:HBox width="95%"> | ||
<mx:LinkBar dataProvider="{mainViewStack}" direction="vertical" borderStyle="solid" backgroundColor="#EEEEEE"/> | ||
<mx:ViewStack id="mainViewStack" width="100%" height="100%"> | ||
<!-- For a simple demo, put all the components here. --> | ||
<crafted:Home/> | ||
<crafted:ArticleBox/> | ||
<crafted:ForumBox/> | ||
<crafted:HappeningBox/> | ||
</mx:ViewStack> | ||
|
||
</mx:HBox> | ||
</mx:Application> |
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,45 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()"> | ||
<mx:Script> | ||
<![CDATA[ | ||
import flashx.textLayout.container.DisplayObjectContainerController; | ||
import flashx.textLayout.elements.SpanElement; | ||
import flashx.textLayout.elements.InlineGraphicElement; | ||
import flashx.textLayout.elements.ParagraphElement; | ||
import flashx.textLayout.elements.TextFlow; | ||
[Embed(source="air.png")] | ||
static public var imgClass:Class; | ||
public function init():void | ||
{ | ||
var textFlow:TextFlow = new TextFlow(); | ||
var p:ParagraphElement = new ParagraphElement(); | ||
var inlineGraphicElement:InlineGraphicElement = new InlineGraphicElement(); | ||
//inlineGraphicElement.source = drawRect(); | ||
inlineGraphicElement.source = imgClass; | ||
var span:SpanElement = new SpanElement(); | ||
span.text = "Too much depends upon a "; | ||
span.fontSize = 48; | ||
p.addChild(span); | ||
p.addChild(inlineGraphicElement); | ||
textFlow.addChild(p); | ||
var sprite:Sprite = new Sprite(); | ||
rawChildren.addChild(sprite); | ||
textFlow.flowComposer.addController(new DisplayObjectContainerController(sprite,400,300)); | ||
textFlow.flowComposer.updateAllContainers(); | ||
} | ||
public function drawRect():Sprite | ||
{ | ||
var redRect:Sprite = new Sprite(); | ||
redRect.graphics.beginFill(0xff0000); // red | ||
redRect.graphics.drawRect(0,0,30, 30); | ||
redRect.graphics.endFill(); | ||
return redRect; | ||
} | ||
]]> | ||
</mx:Script> | ||
</mx:Application> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,14 @@ | ||
package pomodo.components.extras { | ||
[Bindable] | ||
public class DataSetOption { | ||
|
||
public var label:String; | ||
|
||
public var clazz:Class; | ||
|
||
public function DataSetOption(label:String, clazz:Class) { | ||
this.label = label; | ||
this.clazz = clazz; | ||
} | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
app/flex/eldorado/components/extras/DoubleClickDataGrid.as
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,59 @@ | ||
package pomodo.components.extras { | ||
import flash.events.MouseEvent; | ||
|
||
import mx.controls.DataGrid; | ||
import mx.controls.dataGridClasses.DataGridColumn; | ||
import mx.controls.listClasses.IDropInListItemRenderer; | ||
import mx.controls.listClasses.IListItemRenderer; | ||
import mx.events.DataGridEvent; | ||
|
||
public class DoubleClickDataGrid extends DataGrid { | ||
private var triggeredEditable:Boolean = false; | ||
|
||
public function DoubleClickDataGrid() { | ||
super(); | ||
doubleClickEnabled = true; | ||
} | ||
|
||
override protected function mouseDoubleClickHandler(event:MouseEvent):void { | ||
var currentRenderer:IListItemRenderer = mouseEventToItemRenderer(event); | ||
|
||
if (itemRenderer && itemRenderer != itemEditorInstance) { | ||
var dropInItemRenderer:IDropInListItemRenderer = IDropInListItemRenderer(currentRenderer); | ||
if (columns[dropInItemRenderer.listData.columnIndex].editable) { | ||
var currentColumn:DataGridColumn = columns[dropInItemRenderer.listData.columnIndex]; | ||
var dataGridEvent:DataGridEvent = new DataGridEvent(DataGridEvent.ITEM_EDIT_BEGINNING, false, true); | ||
dataGridEvent.columnIndex = dropInItemRenderer.listData.columnIndex; | ||
dataGridEvent.dataField = currentColumn.dataField; | ||
dataGridEvent.rowIndex = dropInItemRenderer.listData.rowIndex + verticalScrollPosition; | ||
dataGridEvent.itemRenderer = currentRenderer; | ||
dispatchEvent(dataGridEvent); | ||
} | ||
} | ||
|
||
super.mouseDoubleClickHandler(event); | ||
} | ||
|
||
override protected function mouseUpHandler(event:MouseEvent):void { | ||
var currentRenderer:IListItemRenderer = mouseEventToItemRenderer(event); | ||
var currentColumn:DataGridColumn; | ||
if (currentRenderer) { | ||
try { | ||
var dropInItemRenderer:IDropInListItemRenderer = IDropInListItemRenderer(currentRenderer); | ||
if (columns[dropInItemRenderer.listData.columnIndex].editable) { | ||
currentColumn = DataGridColumn(columns[dropInItemRenderer.listData.columnIndex]); | ||
currentColumn.editable = false; | ||
} | ||
} catch (e:Error) { | ||
// nothing to do here | ||
} | ||
|
||
} | ||
|
||
super.mouseUpHandler(event); | ||
if (currentColumn) { | ||
currentColumn.editable = true; | ||
} | ||
} | ||
} | ||
} |
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,168 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" height="400" width="300" | ||
xmlns:validators="org.restfulx.validators.*"> | ||
<mx:Metadata> | ||
[Event(name="login", type="flash.events.Event")] | ||
</mx:Metadata> | ||
<mx:Script> | ||
<![CDATA[ | ||
import org.restfulx.utils.RxFileReference; | ||
import mx.core.Application; | ||
import org.restfulx.Rx; | ||
import eldorado.models.User; | ||
import eldorado.models.Account; | ||
[Bindable] | ||
private var photoFileName:String = "None selected"; | ||
private var photo:RxFileReference; | ||
[Bindable] | ||
private var signUpFormDirty:Boolean = true; | ||
private function login():void { | ||
Rx.http(onLoginSuccess, onLoginFailure).invoke("session.fxml", | ||
{ login: userTI.text, password: passwordTI.text }, "POST", true); | ||
} | ||
private function signUp():void { | ||
var account:Account = new Account; | ||
account.login = signUpUsername.text; | ||
account.email = signUpEmail.text; | ||
account.password = signUpPassword.text; | ||
account.passwordConfirmation = signUpPasswordConfirmation.text; | ||
account.attachment = photo; | ||
account.create(onSignUp); | ||
} | ||
private function onLoginSuccess(result:User):void { | ||
Eldorado.models.currentUser = result; | ||
dispatchEvent(new Event("login")); | ||
} | ||
private function onLoginFailure(result:Object):void { | ||
loginForm.errorString = "Wrong username or password. Try again."; | ||
} | ||
private function onSignUp(account:Account):void { | ||
views.selectedChild = signUpConfirmationView; | ||
} | ||
private function loginOnEnter(event:KeyboardEvent):void { | ||
if (event.keyCode == 13) { | ||
login(); | ||
} | ||
} | ||
private function signUpOnEnter(event:KeyboardEvent):void { | ||
if (event.keyCode == 13) { | ||
signUp(); | ||
} | ||
} | ||
private function chooseFile():void { | ||
photo = new RxFileReference("avatar"); | ||
photo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler, false, 0, true); | ||
photo.addEventListener(Event.SELECT, selectFile, false, 0, true); | ||
photo.addEventListener(Event.CANCEL, cancelBrowse, false, 0, true); | ||
photo.browse(); | ||
} | ||
private function selectFile(event:Event):void { | ||
fileSelected(event) | ||
} | ||
private function cancelBrowse(event:Event):void { | ||
photo = null; | ||
} | ||
private function fileSelected(event:Event):void { | ||
photoFileName = RxFileReference(event.target).name; | ||
} | ||
private function ioErrorHandler(event:Event):void { | ||
photoChooser.errorString = "Failed to selected a file. Please try again."; | ||
} | ||
]]> | ||
</mx:Script> | ||
<mx:Fade id="hideEffect" duration="300" alphaFrom="1" alphaTo="0"/> | ||
<mx:Fade id="showEffect" duration="300" alphaFrom="0" alphaTo="1"/> | ||
|
||
<!-- Flex Validators --> | ||
<mx:StringValidator source="{signUpUsername}" property="text" | ||
minLength="1" invalid="signUpFormDirty = true"/> | ||
<mx:EmailValidator source="{signUpEmail}" property="text" invalid="signUpFormDirty = true"/> | ||
<mx:RegExpValidator source="{signUpPasswordConfirmation}" | ||
property="text" expression="{signUpPassword.text}" noMatchError="Passwords do not match" | ||
invalid="signUpFormDirty = true" valid="signUpFormDirty = false"/> | ||
|
||
<!-- Proxies for Rails Validators --> | ||
<validators:ServiceErrorValidator id="signUpLoginNameValidator" field="login" listener="{signUpUsername}" | ||
serviceErrors="{Rx.models.errors}"/> | ||
<validators:ServiceErrorValidator id="signUpPasswordValidator" field="password" listener="{signUpPassword}" | ||
serviceErrors="{Rx.models.errors}"/> | ||
|
||
<mx:ViewStack height="100%" width="100%" id="views"> | ||
<mx:Canvas id="loginView" width="100%" height="100%" hideEffect="{hideEffect}" showEffect="{showEffect}"> | ||
<mx:Form verticalCenter="0" horizontalCenter="0" id="loginForm" borderStyle="solid"> | ||
<mx:Canvas backgroundColor="#000000" width="100%" height="50"> | ||
<mx:Label text="Eldorado / Welcome" styleName="appTitle" x="4" y="2" selectable="false"/> | ||
<mx:Label text="Agile time tracking for everyone" styleName="appDescription" x="4" y="27" selectable="false"/> | ||
</mx:Canvas> | ||
<mx:FormItem label="Username"> | ||
<mx:TextInput width="190" id="userTI"/> | ||
</mx:FormItem> | ||
<mx:FormItem label="Password"> | ||
<mx:TextInput width="190" displayAsPassword="true" id="passwordTI" keyDown="loginOnEnter(event)"/> | ||
</mx:FormItem> | ||
<mx:FormItem label=""> | ||
<mx:Button label="Login" click="login()" keyDown="loginOnEnter(event)"/> | ||
</mx:FormItem> | ||
</mx:Form> | ||
<mx:Text text="Don't have an account?" verticalCenter="101" horizontalCenter="-80"/> | ||
<mx:LinkButton label="Sign Up!" horizontalCenter="18" verticalCenter="101" | ||
click="views.selectedChild = signUpView"/> | ||
</mx:Canvas> | ||
<mx:Canvas id="signUpView" width="100%" height="100%" hideEffect="{hideEffect}" showEffect="{showEffect}"> | ||
<mx:Form verticalCenter="0" horizontalCenter="0" id="signUpForm" borderStyle="solid"> | ||
<mx:Canvas backgroundColor="#000000" width="100%" height="50"> | ||
<mx:Label text="Eldorado / Sign Up" styleName="appTitle" x="4" y="2" selectable="false"/> | ||
<mx:Label text="Agile time tracking for everyone" styleName="appDescription" x="4" y="27" selectable="false"/> | ||
</mx:Canvas> | ||
<mx:FormItem label="Username" required="true"> | ||
<mx:TextInput id="signUpUsername" width="190"/> | ||
</mx:FormItem> | ||
<mx:FormItem label="Email" required="true"> | ||
<mx:TextInput id="signUpEmail" width="190"/> | ||
</mx:FormItem> | ||
<mx:FormItem label="Password" required="true"> | ||
<mx:TextInput id="signUpPassword" width="190" displayAsPassword="true"/> | ||
</mx:FormItem> | ||
<mx:FormItem label="Confirm" required="true"> | ||
<mx:TextInput id="signUpPasswordConfirmation" width="190" displayAsPassword="true" | ||
keyDown="signUpOnEnter(event)"/> | ||
</mx:FormItem> | ||
<mx:FormItem label="Photo:" width="100%" id="photoChooser"> | ||
<mx:Button label="Browse…" id="photoBrowseButton" click="chooseFile()" /> | ||
<mx:Label text="{photoFileName}" maxWidth="190" /> | ||
</mx:FormItem> | ||
<mx:FormItem label=""> | ||
<mx:Button label="Sign Up" click="signUp()" keyDown="signUpOnEnter(event)" enabled="{!signUpFormDirty}"/> | ||
</mx:FormItem> | ||
</mx:Form> | ||
<mx:Text text="Already have an account?" verticalCenter="158" horizontalCenter="-77"/> | ||
<mx:LinkButton label="Log In" horizontalCenter="21" verticalCenter="158" | ||
click="views.selectedChild = loginView"/> | ||
</mx:Canvas> | ||
<mx:Canvas id="signUpConfirmationView" width="100%" height="100%" | ||
hideEffect="{hideEffect}" showEffect="{showEffect}"> | ||
<mx:Form verticalCenter="0" horizontalCenter="0" borderStyle="solid"> | ||
<mx:Canvas backgroundColor="#000000" width="100%" height="50"> | ||
<mx:Label text="Eldorado / Thank You" styleName="appTitle" x="4" y="2" selectable="false"/> | ||
<mx:Label text="Agile time tracking for everyone" styleName="appDescription" x="4" y="27" selectable="false"/> | ||
</mx:Canvas> | ||
<mx:Text text="Thanks for signing up! We're sending you an email with your activation code." width="100%"/> | ||
</mx:Form> | ||
</mx:Canvas> | ||
</mx:ViewStack> | ||
</mx:Canvas> |
Oops, something went wrong.