Skip to content

Instantly share code, notes, and snippets.

View etgryphon's full-sized avatar

Evin Grano etgryphon

  • Concluent System, LLC
  • Leesburg, VA USA
View GitHub Profile
@etgryphon
etgryphon / gist:2406924
Created April 17, 2012 15:39
Statechart loading and login example
app.statechart.addState('marketing', {
enterState: function(){
// TODO: Super Sexy splash screen code...
// Showing marketing material and the login form
},
login: function(){
$.ajax({
Yi = Stativus.createStatechart()
Yi.addState "StateA1",
globalConcurrentState:'default_states',
states: [
name: "StateA1B1",
substatesAreConcurrent: true,
states: [
name: "StateA1C1"
,
name: "StateA1C2"
/*globals Yi Statechart */
window.Yi = Statechart.create();
Yi.addState("Store", {
initialSubstate: "store.Loading"
});
Yi.addState("store.Loading", {
parentState: "Store",
enterState: function() {
this.sendEvent("loadLargeStore");
},
/*globals Yi Statechart */
window.Yi = Statechart.create();
Yi.addState("Store", {
initialSubstate: "store.Loading"
});
Yi.addState("store.Loading", {
parentState: "Store",
enterState: function() {
this.sendEvent("loadLargeStore");
},
var myStatechart = Statechart.create();
myStatechart.addState("#application", {
initialSubstate: "#subapplication",
enterState: function() {
},
exitState: function() {
},
ready: function() {
Ext.create("Ext.form.field.Text", {
id: "seller",
emptyText: "Seller",
renderTo: Ext.getBody()
});
Ext.create("Ext.form.field.Text", {
id: "item",
emptyText: "Item",
renderTo: Ext.getBody()
/**
One-way boolean transform binding that returns YES if the 'from' end of the binding equals
'testValue', and NO otherwise.
*/
SC.Binding.equals = function(testValue) {
return this.oneWay().transform(function(value) {
value = (value === testValue) ? YES : NO;
return value;
});
};
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Family Tree</title>
<script type="text/javascript">
var SC=SC||{BUNDLE_INFO:{},LAZY_INSTANTIATION:{}};SC.browser=(function(){var c=navigator.userAgent.toLowerCase();
// Create this in you view folder for fun
ResortContracts.TestView = SC.View.extend({
createChildViews: function(){
var childViews = [], view;
view = this.createChildView(
SC.SelectButtonView.design({
valueBinding: '.parentView.content.item'
})
);
// ==========================================================================
// SCUI.WidgetView
// ==========================================================================
sc_require('core');
/** @class
This is a management view that handles a widget. Implements the Widget Mixin