Skip to content

Commit

Permalink
Restfulx is in place, prep for deploy to heroku. Misc. files installe…
Browse files Browse the repository at this point in the history
…d for next dev step.
  • Loading branch information
Carl Tanner committed Aug 5, 2009
1 parent 3a58efe commit c34792f
Show file tree
Hide file tree
Showing 84 changed files with 4,361 additions and 30 deletions.
33 changes: 25 additions & 8 deletions .actionScriptProperties
@@ -1,15 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<actionScriptProperties mainApplicationPath="Eldorado.mxml" version="3">
<compiler additionalCompilerArguments="-locale en_US -keep-as3-metadata+=Resource,HasOne,HasMany,BelongsTo,DateTime,Lazy,Ignored,Nested" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="public/bin" rootURL="http://localhost:3000/bin" sourceFolderPath="app/flex" strict="true" useApolloConfig="false" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="1">
<libraryPathEntry kind="4" path=""/>
<libraryPathEntry kind="1" linkType="1" path="lib"/>
</libraryPath>
<sourceAttachmentPath/>
<compiler additionalCompilerArguments="-locale en_US -keep-as3-metadata+=Resource,HasOne,HasMany,BelongsTo,DateTime,Lazy,Ignored,Nested" copyDependentFiles="true" enableModuleDebug="true" flexSDK="Flex 3.2" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="public/bin" rootURL="http://localhost:3000/bin" sourceFolderPath="app/flex" strict="true" useApolloConfig="false" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="1">
<libraryPathEntry kind="4" path="">
<modifiedEntries>
<libraryPathEntry kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/framework.swc" useDefaultLinkType="true">
<crossDomainRsls>
<crossDomainRslEntry autoExtract="true" policyFileUrl="http://fpdownload.adobe.com/pub/swz/crossdomain.xml" rslUrl="http://fpdownload.adobe.com/pub/swz/flex/4.0.0.7219/framework_4.0.0.7219.swz"/>
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="framework_4.0.0.7219.swz"/>
</crossDomainRsls>
</libraryPathEntry>
<libraryPathEntry kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/rpc.swc" useDefaultLinkType="true">
<crossDomainRsls>
<crossDomainRslEntry autoExtract="true" policyFileUrl="http://fpdownload.adobe.com/pub/swz/crossdomain.xml" rslUrl="http://fpdownload.adobe.com/pub/swz/flex/4.0.0.7219/rpc_4.0.0.7219.swz"/>
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="rpc_4.0.0.7219.swz"/>
</crossDomainRsls>
</libraryPathEntry>
</modifiedEntries>
</libraryPathEntry>
<libraryPathEntry kind="1" linkType="1" path="lib"/>
</libraryPath>
<sourceAttachmentPath/>
</compiler>
<applications>
<application path="Eldorado.mxml"/>
<application path="Eldorado.mxml"/>
<application path="Scratch.mxml"/>
<application path="example_text_layout_famework.mxml"/>
</applications>
<modules/>
<buildCSSFiles/>
Expand Down
1 change: 1 addition & 0 deletions .gems
@@ -0,0 +1 @@
captproton-restfulx --version=1.2.3 --source=gems.github.com
6 changes: 6 additions & 0 deletions app/controllers/users_controller.rb
Expand Up @@ -7,6 +7,12 @@ class UsersController < ApplicationController
def index
@users = User.paginate(:page => params[:page], :order => 'profile_updated_at desc')
@users_count = User.count

respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @users }
format.fxml { render :fxml => @users }
end
end

def show
Expand Down
33 changes: 33 additions & 0 deletions app/flex/Scratch.mxml
@@ -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>
45 changes: 45 additions & 0 deletions app/flex/a.mxml
@@ -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>
Binary file added app/flex/air.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/flex/assets/add.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/flex/assets/background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/flex/assets/fonts/MyriadWebPro-Bold.ttf
Binary file not shown.
Binary file added app/flex/assets/fonts/MyriadWebPro-Condensed.ttf
Binary file not shown.
Binary file not shown.
Binary file added app/flex/assets/fonts/MyriadWebPro-Italic.ttf
Binary file not shown.
Binary file added app/flex/assets/fonts/MyriadWebPro.ttf
Binary file not shown.
Binary file added app/flex/assets/pause.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/flex/assets/play_green.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/flex/assets/remove.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/flex/assets/sync_light.swf
Binary file not shown.
Binary file added app/flex/assets/task_complete.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/flex/assets/trash.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/flex/assets/valid_blue.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/flex/assets/valid_green.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions app/flex/eldorado/components/extras/DataSetOption.as
@@ -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 app/flex/eldorado/components/extras/DoubleClickDataGrid.as
@@ -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;
}
}
}
}
168 changes: 168 additions & 0 deletions app/flex/eldorado/components/login/LoginScreen.mxml
@@ -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>

0 comments on commit c34792f

Please sign in to comment.