Created
October 19, 2014 06:41
-
-
Save anbublacky/7dbf2890cdbe530233ef to your computer and use it in GitHub Desktop.
// source http://jsbin.com/guyeto
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> | |
| <script src="http://code.jquery.com/jquery.min.js"></script> | |
| <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> | |
| <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> | |
| <script src="http://code.jquery.com/jquery.js"></script> | |
| <script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.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 }} | |
| <br /> | |
| Your name :{{ ads }}<br /> | |
| {{#linkTo 'makes'}}makes{{/linkTo}}<br /> | |
| {{outlet}} | |
| </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"> | |
| <div class="col-xs-12"> | |
| <div class="col-xs-4"> | |
| <ul> | |
| {{#each model.makes }} | |
| <li>{{#linkTo 'make' this}}{{name}}{{/linkTo}}</li> | |
| {{/each}} | |
| </ul> | |
| </div> | |
| {{outlet}} | |
| </div> | |
| </script> | |
| <script type="text/x-handlebars" data-template-name="make"> | |
| <div class="col-xs-4"> | |
| {{#each model in model.models }} | |
| <li>{{#linkTo 'model' model.id}}{{model.name}}{{/linkTo}}</li> | |
| {{/each}} | |
| </div> | |
| {{outlet}} | |
| </script> | |
| <script type="text/x-handlebars" data-template-name="model"> | |
| <div class="col-xs-4"> | |
| Enter Your zipcode: {{ input type="text" value=zipcode }} </div> | |
| </script> | |
| <script type="text/x-handlebars" data-template-name="photo"> | |
| Individual photo <br /> | |
| {{name }}<br /> | |
| {{#each model.songs}} | |
| {{id}} - | |
| {{name}}<br /> | |
| {{/each}} | |
| </script> | |
| <script id="jsbin-javascript"> | |
| App = Ember.Application.create(); | |
| App.Router.map(function(){ | |
| this.resource('makes', function(){ | |
| this.resource('make', {path: ':make_id'}, function(){ | |
| this.resource('model', {path: ':model_id'}); | |
| }); | |
| }); | |
| this.resource('photo', {path: 'photos/:photo_id'}); | |
| }); | |
| App.IndexRoute = Ember.Route.extend({ | |
| model: function(){ | |
| return App.ALBUM_FIXTURES; | |
| } | |
| }); | |
| App.MakesRoute = Ember.Route.extend({ | |
| model: function(){ | |
| return makes; | |
| }, | |
| }); | |
| App.MakeRoute = Ember.Route.extend({ | |
| model: function(){ | |
| return makes[0]; | |
| } | |
| }); | |
| App.ZipRoute = Ember.Route.extend({ | |
| }); | |
| App.ModelRoute = Ember.Route.extend({ | |
| model: function(){ | |
| } | |
| }); | |
| App.PhotoRoute = Ember.Route.extend({ | |
| model: function(){ | |
| return App.ALBUM_FIXTURES; | |
| } | |
| }); | |
| makes = jQuery.getJSON('https://api.edmunds.com/api/vehicle/v2/makes?fmt=json&api_key=hg9m93hc23wpgarmu6j6qtyc&state=new&view=full'); | |
| App.ALBUM_FIXTURES = [{ | |
| 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" | |
| }]; | |
| App.ALBUM_FIXTURES.forEach(function(album) { | |
| album.songs = album.songs.map(function(id) { | |
| var song = App.SONG_FIXTURES.findProperty('id', id); | |
| song.album = App.ALBUM_FIXTURES.findProperty('id', song.album); | |
| return song; | |
| }); | |
| }); | |
| </script> | |
| <script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="//code.jquery.com/jquery.min.js"><\/script> | |
| <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> | |
| <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"><\/script> | |
| <script src="http://code.jquery.com/jquery.js"><\/script> | |
| <script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.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 }} | |
| <br /> | |
| Your name :{{ ads }}<br /> | |
| {{#linkTo 'makes'}}makes{{/linkTo}}<br /> | |
| {{outlet}} | |
| <\/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"> | |
| <div class="col-xs-12"> | |
| <div class="col-xs-4"> | |
| <ul> | |
| {{#each model.makes }} | |
| <li>{{#linkTo 'make' this}}{{name}}{{/linkTo}}</li> | |
| {{/each}} | |
| </ul> | |
| </div> | |
| {{outlet}} | |
| </div> | |
| <\/script> | |
| <script type="text/x-handlebars" data-template-name="make"> | |
| <div class="col-xs-4"> | |
| {{#each model in model.models }} | |
| <li>{{#linkTo 'model' model.id}}{{model.name}}{{/linkTo}}</li> | |
| {{/each}} | |
| </div> | |
| {{outlet}} | |
| <\/script> | |
| <script type="text/x-handlebars" data-template-name="model"> | |
| <div class="col-xs-4"> | |
| Enter Your zipcode: {{ input type="text" value=zipcode }} </div> | |
| <\/script> | |
| <script type="text/x-handlebars" data-template-name="photo"> | |
| Individual photo <br /> | |
| {{name }}<br /> | |
| {{#each model.songs}} | |
| {{id}} - | |
| {{name}}<br /> | |
| {{/each}} | |
| <\/script> | |
| </body> | |
| </html></script> | |
| <script id="jsbin-source-javascript" type="text/javascript">App = Ember.Application.create(); | |
| App.Router.map(function(){ | |
| this.resource('makes', function(){ | |
| this.resource('make', {path: ':make_id'}, function(){ | |
| this.resource('model', {path: ':model_id'}); | |
| }); | |
| }); | |
| this.resource('photo', {path: 'photos/:photo_id'}); | |
| }); | |
| App.IndexRoute = Ember.Route.extend({ | |
| model: function(){ | |
| return App.ALBUM_FIXTURES; | |
| } | |
| }); | |
| App.MakesRoute = Ember.Route.extend({ | |
| model: function(){ | |
| return makes; | |
| }, | |
| }); | |
| App.MakeRoute = Ember.Route.extend({ | |
| model: function(){ | |
| return makes[0]; | |
| } | |
| }); | |
| App.ZipRoute = Ember.Route.extend({ | |
| }); | |
| App.ModelRoute = Ember.Route.extend({ | |
| model: function(){ | |
| } | |
| }); | |
| App.PhotoRoute = Ember.Route.extend({ | |
| model: function(){ | |
| return App.ALBUM_FIXTURES; | |
| } | |
| }); | |
| makes = jQuery.getJSON('https://api.edmunds.com/api/vehicle/v2/makes?fmt=json&api_key=hg9m93hc23wpgarmu6j6qtyc&state=new&view=full'); | |
| App.ALBUM_FIXTURES = [{ | |
| 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" | |
| }]; | |
| App.ALBUM_FIXTURES.forEach(function(album) { | |
| album.songs = album.songs.map(function(id) { | |
| var song = App.SONG_FIXTURES.findProperty('id', id); | |
| song.album = App.ALBUM_FIXTURES.findProperty('id', song.album); | |
| return song; | |
| }); | |
| }); | |
| </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
| App = Ember.Application.create(); | |
| App.Router.map(function(){ | |
| this.resource('makes', function(){ | |
| this.resource('make', {path: ':make_id'}, function(){ | |
| this.resource('model', {path: ':model_id'}); | |
| }); | |
| }); | |
| this.resource('photo', {path: 'photos/:photo_id'}); | |
| }); | |
| App.IndexRoute = Ember.Route.extend({ | |
| model: function(){ | |
| return App.ALBUM_FIXTURES; | |
| } | |
| }); | |
| App.MakesRoute = Ember.Route.extend({ | |
| model: function(){ | |
| return makes; | |
| }, | |
| }); | |
| App.MakeRoute = Ember.Route.extend({ | |
| model: function(){ | |
| return makes[0]; | |
| } | |
| }); | |
| App.ZipRoute = Ember.Route.extend({ | |
| }); | |
| App.ModelRoute = Ember.Route.extend({ | |
| model: function(){ | |
| } | |
| }); | |
| App.PhotoRoute = Ember.Route.extend({ | |
| model: function(){ | |
| return App.ALBUM_FIXTURES; | |
| } | |
| }); | |
| makes = jQuery.getJSON('https://api.edmunds.com/api/vehicle/v2/makes?fmt=json&api_key=hg9m93hc23wpgarmu6j6qtyc&state=new&view=full'); | |
| App.ALBUM_FIXTURES = [{ | |
| 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" | |
| }]; | |
| App.ALBUM_FIXTURES.forEach(function(album) { | |
| album.songs = album.songs.map(function(id) { | |
| var song = App.SONG_FIXTURES.findProperty('id', id); | |
| song.album = App.ALBUM_FIXTURES.findProperty('id', song.album); | |
| return song; | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment