Created
January 23, 2013 21:38
-
-
Save mklew/4613833 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="scripts/vendor/jquery.min.js"></script> | |
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet" type="text/css" /> | |
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" /> | |
<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap.js"></script> | |
<title>Skillshare</title> | |
</head> | |
<body> | |
<!-- To jest domyślny template i wszystko co się wyświetla jest w outlet --> | |
<!-- domyślnie jako outlet wyświetli się template o nazwie index --> | |
<script type="text/x-handlebars" data-template-name="application"> | |
{{outlet}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="index"> | |
<div class="container"> | |
<div class="hero unit"> | |
<h1>Hello {{who}}</h1> | |
<h2>at {{where}}</h2> | |
</div> | |
<p>Application</p> | |
<nav> | |
<ul class="nav"> | |
<li> | |
{{#linkTo 'contributors'}} | |
ObjectLedge contributors | |
{{/linkTo}} | |
</li> | |
<li> | |
{{#linkTo 'about'}} | |
About | |
{{/linkTo}} | |
</li> | |
</ul> | |
</nav> | |
{{outlet}} | |
</div> | |
</script> | |
<script type="text/x-handlebars" data-template-name="about"> | |
About this is about | |
</script> | |
<script type="text/x-handlebars" data-template-name="contributors"> | |
<p>Contributors</p> | |
{{#if isLoaded}} | |
<ul> | |
{{#each contributors}} | |
<li>{{name}}</li> | |
{{/each}} | |
</ul> | |
<p>Inny template ktory robi to samo</p> | |
<ul> | |
{{#each contributor in contributors}} | |
<li>{{contributor.name}}</li> | |
{{/each}} | |
</ul> | |
<p>Now some view</p> | |
{{#each contributor in contributors}} | |
{{view App.OneView oneBinding="contributor"}} | |
{{/each}} | |
{{else}} | |
<p>Still loading</p> | |
{{/if}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="one"> | |
this is view | |
</script> | |
<script src="https://github.com/downloads/wycats/handlebars.js/handlebars-1.0.rc.1.js"></script> | |
<!-- <script src="scripts/vendor/handlebars-1.0.0.beta.6.js"></script> --> | |
<script src="scripts/vendor/ember-1.0.0-pre.4.js"></script> | |
<!-- <script src="http://f.cl.ly/items/2y0X3M0F2K2O1W1O1w0f/ember-data.js"> | |
</script> --> | |
<script src="scripts/main.js"></script> | |
</body> | |
</html> |
This file contains hidden or 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
var App = Ember.Application.create(); | |
App.Router.map(function(){ | |
this.route("about"); | |
this.resource("contributors"); | |
this.route("one", { path : "contributors"}); | |
}); | |
App.ContributorsController = Ember.ArrayController.extend({}); | |
App.Contributor = Ember.Object.extend({}); | |
App.Contributor.reopenClass({ | |
contributors : [], | |
find : function() | |
{ | |
return [{name : "Rafal"}, {name : "Łukasz"}, {name: "Marek"}, {name : "Tomek"}]; | |
} | |
}); | |
App.ContributorsRoute = Ember.Route.extend({ | |
model : function() | |
{ | |
return App.Contributor.find(); | |
}, | |
setupController : function(controller, model) | |
{ | |
controller.set('contributors', model); | |
controller.set('isLoaded', true); | |
} | |
}); | |
App.IndexRoute = Ember.Route.extend({ | |
model : function() | |
{ | |
return { who : "Caltha team", | |
where : "(no)Skillshare" | |
}; | |
} | |
}); | |
App.OneView = Ember.View.extend({}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment