Created
October 14, 2014 14:21
-
-
Save anbublacky/25a55ee2baa033c90bc9 to your computer and use it in GitHub Desktop.
// source http://jsbin.com/guyeto/3
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> | |
<script src="http://code.jquery.com/jquery.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script> | |
<script src="http://builds.emberjs.com/ember-latest.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script type="text/x-handlebars"> | |
Enter Your name : {{ input type="text" value=ads }} | |
Your name :{{ ads }} | |
{{outlet}} | |
{{#linkTo 'makes'}}makes{{/linkTo}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="index"> | |
<ul> | |
{{#each}} | |
<li>{{#linkTo 'photo' this}}{{name}}{{/linkTo}}</li> | |
{{/each}} | |
</ul> | |
</script> | |
<script type="text/x-handlebars" data-template-name="makes"> | |
sadasd | |
<ul> | |
{{#each model.makes }} | |
<li>{{#linkTo 'make' this}}{{id}}{{/linkTo}}</li> | |
{{/each}} | |
</ul> | |
</script> | |
<script type="text/x-handlebars" data-template-name="make"> | |
admin | |
{{id}} | |
{{name}} | |
{{#each model.models }} | |
<li>{{name}}</li> | |
{{/each}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="photo"> | |
Individual photo | |
{{name }} | |
</script> | |
<script id="jsbin-javascript"> | |
App = Ember.Application.create(); | |
App.Router.map(function(){ | |
this.resource('makes'); | |
this.resource('make', {path: 'makes/:make_id'}); | |
this.resource('photo', {path: 'photos/:photo_id'}); | |
}); | |
App.IndexRoute = Ember.Route.extend({ | |
model: function(){ | |
return photos; | |
} | |
}); | |
App.MakesRoute = Ember.Route.extend({ | |
model: function(){ | |
return makes; | |
} | |
}); | |
App.PhotoRoute = Ember.Route.extend({ | |
model: function(){ | |
return makes[0]; | |
} | |
}); | |
App.PhotoRoute = Ember.Route.extend({ | |
model: function(){ | |
return phtotos[0]; | |
} | |
}); | |
makes = jQuery.getJSON('https://api.edmunds.com/api/vehicle/v2/makes?fmt=json&api_key=hg9m93hc23wpgarmu6j6qtyc&state=new&view=full'); | |
photos = [{ | |
id: "1", | |
artwork: "images/the-morning-after.jpg", | |
name: "The Morning After", | |
artist: "GOLDHOUSE", | |
songs: [ "11", "12", "13", "14" ] | |
}, { | |
id: "2", | |
artwork: "images/dusk-to-dawn.jpg", | |
name: "Dusk to Dawn", | |
artist: "Emancipator", | |
songs: [ "21", "22", "23", "24" ] | |
}, { | |
id: "3", | |
artwork: "images/the-heist.jpg", | |
name: "The Heist", | |
artist: "Macklemore & Ryan Lewis", | |
isExplicit: true, | |
songs: [ "31", "32", "33", "34" ] | |
}, { | |
id: "4", | |
artwork: "images/some-nights.jpg", | |
name: "Some Nights", | |
artist: "fun.", | |
isExplicit: true, | |
songs: [ "41", "42", "43", "44" ] | |
}]; | |
App.SONG_FIXTURES = [{ | |
id: "11", | |
track: 1, | |
name: "A Walk", | |
duration: 316, | |
url: 'audio/Southern_Nights_-_07_-_All_My_Sorrows.mp3', | |
album: "1" | |
}, { | |
id: "12", | |
track: 2, | |
name: "Hours", | |
duration: 344, | |
url: 'audio/Southern_Nights_-_06_-_Um.mp3', | |
album: "1" | |
}, { | |
id: "13", | |
track: 3, | |
name: "Daydream", | |
duration: 334, | |
url: 'audio/Southern_Nights_-_08_-_Go_Way.mp3', | |
album: "1" | |
}, { | |
id: "14", | |
track: 4, | |
name: "Dive", | |
duration: 499, | |
url: 'audio/Southern_Nights_-_09_-_Grass_or_Gasoline.mp3', | |
album: "1" | |
}, { | |
id: "21", | |
track: 1, | |
name: "A Walk", | |
duration: 316, | |
url: 'audio/Southern_Nights_-_07_-_All_My_Sorrows.mp3', | |
album: "2" | |
}, { | |
id: "22", | |
track: 2, | |
name: "Hours", | |
duration: 344, | |
url: 'audio/Southern_Nights_-_06_-_Um.mp3', | |
album: "2" | |
}, { | |
id: "23", | |
track: 3, | |
name: "Daydream", | |
duration: 334, | |
url: 'audio/Southern_Nights_-_08_-_Go_Way.mp3', | |
album: "2" | |
}, { | |
id: "24", | |
track: 4, | |
name: "Dive", | |
duration: 499, | |
url: 'audio/Southern_Nights_-_09_-_Grass_or_Gasoline.mp3', | |
album: "2" | |
}, { | |
id: "31", | |
track: 1, | |
name: "A Walk", | |
duration: 316, | |
url: 'audio/Southern_Nights_-_07_-_All_My_Sorrows.mp3', | |
album: "3" | |
}, { | |
id: "32", | |
track: 2, | |
name: "Hours", | |
duration: 344, | |
url: 'audio/Southern_Nights_-_06_-_Um.mp3', | |
album: "3" | |
}, { | |
id: "33", | |
track: 3, | |
name: "Daydream", | |
duration: 334, | |
url: 'audio/Southern_Nights_-_08_-_Go_Way.mp3', | |
album: "3" | |
}, { | |
id: "34", | |
track: 4, | |
name: "Dive", | |
duration: 499, | |
url: 'audio/Southern_Nights_-_09_-_Grass_or_Gasoline.mp3', | |
album: "3" | |
}, { | |
id: "41", | |
track: 1, | |
name: "A Walk", | |
duration: 316, | |
url: 'audio/Southern_Nights_-_07_-_All_My_Sorrows.mp3', | |
album: "4" | |
}, { | |
id: "42", | |
track: 2, | |
name: "Hours", | |
duration: 344, | |
url: 'audio/Southern_Nights_-_06_-_Um.mp3', | |
album: "4" | |
}, { | |
id: "43", | |
track: 3, | |
name: "Daydream", | |
duration: 334, | |
url: 'audio/Southern_Nights_-_08_-_Go_Way.mp3', | |
album: "4" | |
}, { | |
id: "44", | |
track: 4, | |
name: "Dive", | |
duration: 499, | |
url: 'audio/Southern_Nights_-_09_-_Grass_or_Gasoline.mp3', | |
album: "4" | |
}]; | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">App = Ember.Application.create(); | |
App.Router.map(function(){ | |
this.resource('makes'); | |
this.resource('make', {path: 'makes/:make_id'}); | |
this.resource('photo', {path: 'photos/:photo_id'}); | |
}); | |
App.IndexRoute = Ember.Route.extend({ | |
model: function(){ | |
return photos; | |
} | |
}); | |
App.MakesRoute = Ember.Route.extend({ | |
model: function(){ | |
return makes; | |
} | |
}); | |
App.PhotoRoute = Ember.Route.extend({ | |
model: function(){ | |
return makes[0]; | |
} | |
}); | |
App.PhotoRoute = Ember.Route.extend({ | |
model: function(){ | |
return phtotos[0]; | |
} | |
}); | |
makes = jQuery.getJSON('https://api.edmunds.com/api/vehicle/v2/makes?fmt=json&api_key=hg9m93hc23wpgarmu6j6qtyc&state=new&view=full'); | |
photos = [{ | |
id: "1", | |
artwork: "images/the-morning-after.jpg", | |
name: "The Morning After", | |
artist: "GOLDHOUSE", | |
songs: [ "11", "12", "13", "14" ] | |
}, { | |
id: "2", | |
artwork: "images/dusk-to-dawn.jpg", | |
name: "Dusk to Dawn", | |
artist: "Emancipator", | |
songs: [ "21", "22", "23", "24" ] | |
}, { | |
id: "3", | |
artwork: "images/the-heist.jpg", | |
name: "The Heist", | |
artist: "Macklemore & Ryan Lewis", | |
isExplicit: true, | |
songs: [ "31", "32", "33", "34" ] | |
}, { | |
id: "4", | |
artwork: "images/some-nights.jpg", | |
name: "Some Nights", | |
artist: "fun.", | |
isExplicit: true, | |
songs: [ "41", "42", "43", "44" ] | |
}]; | |
App.SONG_FIXTURES = [{ | |
id: "11", | |
track: 1, | |
name: "A Walk", | |
duration: 316, | |
url: 'audio/Southern_Nights_-_07_-_All_My_Sorrows.mp3', | |
album: "1" | |
}, { | |
id: "12", | |
track: 2, | |
name: "Hours", | |
duration: 344, | |
url: 'audio/Southern_Nights_-_06_-_Um.mp3', | |
album: "1" | |
}, { | |
id: "13", | |
track: 3, | |
name: "Daydream", | |
duration: 334, | |
url: 'audio/Southern_Nights_-_08_-_Go_Way.mp3', | |
album: "1" | |
}, { | |
id: "14", | |
track: 4, | |
name: "Dive", | |
duration: 499, | |
url: 'audio/Southern_Nights_-_09_-_Grass_or_Gasoline.mp3', | |
album: "1" | |
}, { | |
id: "21", | |
track: 1, | |
name: "A Walk", | |
duration: 316, | |
url: 'audio/Southern_Nights_-_07_-_All_My_Sorrows.mp3', | |
album: "2" | |
}, { | |
id: "22", | |
track: 2, | |
name: "Hours", | |
duration: 344, | |
url: 'audio/Southern_Nights_-_06_-_Um.mp3', | |
album: "2" | |
}, { | |
id: "23", | |
track: 3, | |
name: "Daydream", | |
duration: 334, | |
url: 'audio/Southern_Nights_-_08_-_Go_Way.mp3', | |
album: "2" | |
}, { | |
id: "24", | |
track: 4, | |
name: "Dive", | |
duration: 499, | |
url: 'audio/Southern_Nights_-_09_-_Grass_or_Gasoline.mp3', | |
album: "2" | |
}, { | |
id: "31", | |
track: 1, | |
name: "A Walk", | |
duration: 316, | |
url: 'audio/Southern_Nights_-_07_-_All_My_Sorrows.mp3', | |
album: "3" | |
}, { | |
id: "32", | |
track: 2, | |
name: "Hours", | |
duration: 344, | |
url: 'audio/Southern_Nights_-_06_-_Um.mp3', | |
album: "3" | |
}, { | |
id: "33", | |
track: 3, | |
name: "Daydream", | |
duration: 334, | |
url: 'audio/Southern_Nights_-_08_-_Go_Way.mp3', | |
album: "3" | |
}, { | |
id: "34", | |
track: 4, | |
name: "Dive", | |
duration: 499, | |
url: 'audio/Southern_Nights_-_09_-_Grass_or_Gasoline.mp3', | |
album: "3" | |
}, { | |
id: "41", | |
track: 1, | |
name: "A Walk", | |
duration: 316, | |
url: 'audio/Southern_Nights_-_07_-_All_My_Sorrows.mp3', | |
album: "4" | |
}, { | |
id: "42", | |
track: 2, | |
name: "Hours", | |
duration: 344, | |
url: 'audio/Southern_Nights_-_06_-_Um.mp3', | |
album: "4" | |
}, { | |
id: "43", | |
track: 3, | |
name: "Daydream", | |
duration: 334, | |
url: 'audio/Southern_Nights_-_08_-_Go_Way.mp3', | |
album: "4" | |
}, { | |
id: "44", | |
track: 4, | |
name: "Dive", | |
duration: 499, | |
url: 'audio/Southern_Nights_-_09_-_Grass_or_Gasoline.mp3', | |
album: "4" | |
}]; | |
</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(); | |
App.Router.map(function(){ | |
this.resource('makes'); | |
this.resource('make', {path: 'makes/:make_id'}); | |
this.resource('photo', {path: 'photos/:photo_id'}); | |
}); | |
App.IndexRoute = Ember.Route.extend({ | |
model: function(){ | |
return photos; | |
} | |
}); | |
App.MakesRoute = Ember.Route.extend({ | |
model: function(){ | |
return makes; | |
} | |
}); | |
App.PhotoRoute = Ember.Route.extend({ | |
model: function(){ | |
return makes[0]; | |
} | |
}); | |
App.PhotoRoute = Ember.Route.extend({ | |
model: function(){ | |
return phtotos[0]; | |
} | |
}); | |
makes = jQuery.getJSON('https://api.edmunds.com/api/vehicle/v2/makes?fmt=json&api_key=hg9m93hc23wpgarmu6j6qtyc&state=new&view=full'); | |
photos = [{ | |
id: "1", | |
artwork: "images/the-morning-after.jpg", | |
name: "The Morning After", | |
artist: "GOLDHOUSE", | |
songs: [ "11", "12", "13", "14" ] | |
}, { | |
id: "2", | |
artwork: "images/dusk-to-dawn.jpg", | |
name: "Dusk to Dawn", | |
artist: "Emancipator", | |
songs: [ "21", "22", "23", "24" ] | |
}, { | |
id: "3", | |
artwork: "images/the-heist.jpg", | |
name: "The Heist", | |
artist: "Macklemore & Ryan Lewis", | |
isExplicit: true, | |
songs: [ "31", "32", "33", "34" ] | |
}, { | |
id: "4", | |
artwork: "images/some-nights.jpg", | |
name: "Some Nights", | |
artist: "fun.", | |
isExplicit: true, | |
songs: [ "41", "42", "43", "44" ] | |
}]; | |
App.SONG_FIXTURES = [{ | |
id: "11", | |
track: 1, | |
name: "A Walk", | |
duration: 316, | |
url: 'audio/Southern_Nights_-_07_-_All_My_Sorrows.mp3', | |
album: "1" | |
}, { | |
id: "12", | |
track: 2, | |
name: "Hours", | |
duration: 344, | |
url: 'audio/Southern_Nights_-_06_-_Um.mp3', | |
album: "1" | |
}, { | |
id: "13", | |
track: 3, | |
name: "Daydream", | |
duration: 334, | |
url: 'audio/Southern_Nights_-_08_-_Go_Way.mp3', | |
album: "1" | |
}, { | |
id: "14", | |
track: 4, | |
name: "Dive", | |
duration: 499, | |
url: 'audio/Southern_Nights_-_09_-_Grass_or_Gasoline.mp3', | |
album: "1" | |
}, { | |
id: "21", | |
track: 1, | |
name: "A Walk", | |
duration: 316, | |
url: 'audio/Southern_Nights_-_07_-_All_My_Sorrows.mp3', | |
album: "2" | |
}, { | |
id: "22", | |
track: 2, | |
name: "Hours", | |
duration: 344, | |
url: 'audio/Southern_Nights_-_06_-_Um.mp3', | |
album: "2" | |
}, { | |
id: "23", | |
track: 3, | |
name: "Daydream", | |
duration: 334, | |
url: 'audio/Southern_Nights_-_08_-_Go_Way.mp3', | |
album: "2" | |
}, { | |
id: "24", | |
track: 4, | |
name: "Dive", | |
duration: 499, | |
url: 'audio/Southern_Nights_-_09_-_Grass_or_Gasoline.mp3', | |
album: "2" | |
}, { | |
id: "31", | |
track: 1, | |
name: "A Walk", | |
duration: 316, | |
url: 'audio/Southern_Nights_-_07_-_All_My_Sorrows.mp3', | |
album: "3" | |
}, { | |
id: "32", | |
track: 2, | |
name: "Hours", | |
duration: 344, | |
url: 'audio/Southern_Nights_-_06_-_Um.mp3', | |
album: "3" | |
}, { | |
id: "33", | |
track: 3, | |
name: "Daydream", | |
duration: 334, | |
url: 'audio/Southern_Nights_-_08_-_Go_Way.mp3', | |
album: "3" | |
}, { | |
id: "34", | |
track: 4, | |
name: "Dive", | |
duration: 499, | |
url: 'audio/Southern_Nights_-_09_-_Grass_or_Gasoline.mp3', | |
album: "3" | |
}, { | |
id: "41", | |
track: 1, | |
name: "A Walk", | |
duration: 316, | |
url: 'audio/Southern_Nights_-_07_-_All_My_Sorrows.mp3', | |
album: "4" | |
}, { | |
id: "42", | |
track: 2, | |
name: "Hours", | |
duration: 344, | |
url: 'audio/Southern_Nights_-_06_-_Um.mp3', | |
album: "4" | |
}, { | |
id: "43", | |
track: 3, | |
name: "Daydream", | |
duration: 334, | |
url: 'audio/Southern_Nights_-_08_-_Go_Way.mp3', | |
album: "4" | |
}, { | |
id: "44", | |
track: 4, | |
name: "Dive", | |
duration: 499, | |
url: 'audio/Southern_Nights_-_09_-_Grass_or_Gasoline.mp3', | |
album: "4" | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment