Last active
August 29, 2015 14:01
-
-
Save jacksonp/b0dd4608c8be831c5c50 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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi"> | |
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.4.2/pure-min.css"> | |
<style> | |
.app { | |
width: 300px; | |
margin: 0 auto; | |
} | |
button { | |
width: 260px; | |
} | |
</style> | |
<title>Scotch</title> | |
<div class="app"></div> | |
<script src="http://yui.yahooapis.com/3.16.0/build/yui/yui-min.js"></script> | |
<script> | |
YUI().use('app', function (Y) { | |
'use strict'; | |
// 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>'; | |
html += '<p><button class="pure-button pure-button-disabled">Highland</button>'; | |
html += '<p><button class="pure-button pure-button-disabled">Islands</button>'; | |
html += '<p><button class="pure-button pure-button-disabled">Islay</button>'; | |
html += '<p><button class="pure-button pure-button-disabled">Lowland</button>'; | |
html += '<p><button class="pure-button pure-button-disabled">Speyside</button>'; | |
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 had over 30 distilleries and ' + | |
'proclaimed itself "the whisky capital of the world". However, a focus ' + | |
'on quantity rather than quality, and the combination of prohibition ' + | |
'and the Great Depression in the United States, led to most ' + | |
'distilleries going out of business. Today only three active ' + | |
'distilleries remain in Campbeltown: Glen Scotia, Glengyle, and ' + | |
'Springbank.<br>- Wikipedia'; | |
this.get('container').setHTML(html); | |
return this; | |
}, | |
events : { | |
'button' : { | |
click : function (e) { | |
app.showView('home'); | |
} | |
} | |
} | |
}); | |
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> |
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
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.4.2/pure-min.css"> | |
<script src="http://yui.yahooapis.com/3.16.0/build/yui/yui-min.js"></script> |
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
These need to be one per gist otherwise it embeds them all at once. I created three new gists for the blog post.
https://gist.github.com/triptych/48649fe0093bcde01df1
https://gist.github.com/triptych/1a72987f89f5b5093d97
https://gist.github.com/triptych/d6e013a2565ad37002be