Created
May 14, 2014 21:41
-
-
Save triptych/d6e013a2565ad37002be to your computer and use it in GitHub Desktop.
code for ScotchApp-0.0.1.apk
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
<script> | |
YUI().use('app', function (Y) { | |
// Initial view: | |
Y.HomeView = Y.Base.create('homeView', Y.View, [], { | |
render : function () { | |
var html = '<h1>Scotch Regions</h1>'; | |
html += '<p><button class="pure-button">Cambletown</button>'; | |
// more html content | |
this.get('container').setHTML(html); | |
return this; | |
}, | |
events : { | |
'button' : { | |
click : function (e) { | |
app.showView('cambletown'); | |
} | |
} | |
} | |
}); | |
// A sample view we can go to and back from: | |
Y.CambletownView = Y.Base.create('cambletownView', Y.View, [], { | |
render : function () { | |
var html = '<h1>Cambletown</h1>'; | |
html += '<p><button class="pure-button">Home</button>'; | |
html += '<p>At one point Cambletown [...snip...]'; | |
this.get('container').setHTML(html); | |
return this; | |
}, | |
events : { | |
'button' : { | |
click : function (e) { | |
app.showView('home'); | |
} | |
} | |
} | |
}); | |
// Initialize and render the app. | |
var app = new Y.App({ | |
transitions : true, | |
viewContainer : '.app', | |
views: { | |
home: { | |
type : 'HomeView', | |
preserve : true | |
}, | |
cambletown: { | |
type : 'CambletownView', | |
parent : 'home' | |
} | |
} | |
}); | |
app.render(); | |
app.showView('home'); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment