Created
April 23, 2014 10:41
-
-
Save rwjblue/11210361 to your computer and use it in GitHub Desktop.
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> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.1/jquery.min.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.3.0/handlebars.min.js"></script> | |
<script src="http://builds.emberjs.com/canary/ember.min.js"></script> | |
<script src="http://builds.emberjs.com/canary/ember-data.js"></script> | |
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> | |
<script type="text/x-handlebars"> | |
<div class="container"><br> | |
{{#link-to "projects" class="btn btn-info"}}Manage Projects{{/link-to}} | |
{{outlet}} | |
</div> | |
</script> | |
<script type="text/x-handlebars" id="projects"> | |
<div class="row"> | |
<div class="col-md-3 col-lg-3"> | |
<ul class="nav nav-pills nav-stacked" id="project-list"> | |
{{#each}} | |
{{#link-to "project" this tagName="li"}} | |
<a {{bind-attr href="view.href"}}>{{title}}</a> | |
{{/link-to}} | |
{{/each}} | |
</ul> | |
</div> | |
<div class="col-md-9 col-lg-9 col-sm-9"> | |
{{outlet}} | |
</div> | |
</div> | |
</script> | |
<script type="text/x-handlebars" id="project"> | |
<h2>Title: {{title}}</h2> | |
{{description}} | |
{{#each milestone in this.milestones}} | |
{{milestone.title}} | |
{{/each}} | |
</script> | |
<script type="text/x-handlebars" id="milestones"> | |
<div class="row"> | |
<div class="col-md-3 col-lg-3"> | |
<ul class="nav nav-pills nav-stacked" id="project-list"> | |
{{#each}} | |
{{#link-to "milestone" this tagName="li"}} | |
<a {{bind-attr href="view.href"}}>{{title}}</a> | |
{{/link-to}} | |
{{/each}} | |
{{#link-to 'milestones.new' tagName="li" class="btn btn-info"}}<i class="fa fa-plus"></i> Add{{/link-to}} | |
</ul> | |
</div> | |
<div class="col-md-9 col-lg-9"> | |
{{outlet}} | |
</div> | |
</div> | |
</script> | |
</body> | |
</html> |
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
App = Ember.Application.create({ | |
LOG_TRANSITIONS: true | |
}); | |
App.Router.map(function() { | |
this.resource('projects', function(){ | |
this.resource('project', { path: ':project_id' }); | |
}); | |
this.resource('milestones', { path: '/projects/:project_id/milestones'}, function(){ | |
this.resource('milestone', { path: ':milestone_id' }); | |
}); | |
}); | |
App.ApplicationAdapter = DS.FixtureAdapter.extend(); | |
App.Project = DS.Model.extend({ | |
title: DS.attr('string'), | |
description: DS.attr('string'), | |
milestones: DS.hasMany('milestone') | |
}); | |
App.Milestone = DS.Model.extend({ | |
title: DS.attr('string'), | |
description: DS.attr('string'), | |
project_id: DS.attr('number'), | |
project: DS.belongsTo('project') | |
}); | |
App.ProjectsRoute = Ember.Route.extend({ | |
model: function(){ | |
return this.store.find('project'); | |
} | |
}); | |
App.MilestonesRoute = Ember.Route.extend({ | |
model: function(params){ | |
return this.store.find('project', params.project_id).then(function(project) { | |
return project.get('milestones'); | |
}); | |
} | |
}); | |
App.Project.FIXTURES = [ | |
{ | |
"id":"1", | |
"title":"Kaeri", | |
"description":"Return to where you were before, only this time you actually thought to bring your damn camera", | |
"milestones":["1","2","3","4"] | |
},{ | |
"id":"2", | |
"title":"MCI", | |
"description":"", | |
"milestones":["5","6"] | |
},{ | |
"id":"3", | |
"title":"Back To Me", | |
"description":"This very project that I'm working on right now that this is the API for", | |
"milestones":[] | |
} | |
]; | |
App.Milestone.FIXTURES = [ | |
{ | |
"id":"1", | |
"title":"Alpha", | |
"project":"1", | |
"description":"Basic functionality implementation - login, auth, and basic laravel functionality fully implemented" | |
}, { | |
"id":"2", | |
"title":"Beta", | |
"project":"1", | |
"description":"EmberJS version of site fully implemented, large-scale testing pre-launch." | |
},{ | |
"id":"3", | |
"title":"Launch", | |
"project":"1", | |
"description":"Release of 1.0 version of the softwares" | |
},{ | |
"id":"4", | |
"title":"European", | |
"project":"1", | |
"description":"Launch in Europe. English and French only, time depending" | |
},{ | |
"id":"5", | |
"title":"Australian Release", | |
"project":"2", | |
"description":"" | |
},{ | |
"id":"6", | |
"title":"Chip + PIN Support", | |
"project":"2", | |
"description":"" | |
} | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment