Skip to content

Instantly share code, notes, and snippets.

@gtsiap
Created August 13, 2013 17:56
Show Gist options
  • Save gtsiap/6223824 to your computer and use it in GitHub Desktop.
Save gtsiap/6223824 to your computer and use it in GitHub Desktop.
MyApp = Ember.Application.create({});
MyApp.Router.map(function() {
this.route("index", {path: "/"});
});
MyApp.myObject = Ember.Object.extend({
name: "foo",
surname: "bar",
jsonData: {},
aComputedProperty: function() {
return this.get('name') + ' ' + this.get('surname');
}.property('name', 'surname'),
find: function() {
var koker =
{
"authStatus": true,
"device": "KDE-1",
"store": "KDE-1",
"points": 10000,
"success": true,
"offset": 0,
"hasMoreAssets": false,
"channels": [
{
"id": 3,
"image": "cardgames.png",
"name": "Card Games",
"description": "Bust out the deck of 52!",
"assetcount": 19
}
],
"assets": [
{
"id": 5,
"license": 1,
"partnerid": 1002,
"partnername": "KDE",
"version": "0.1",
"file": "org.kde.15puzzle.plasmoid",
"image": "15puzzle.png",
"name": "15 Puzzle",
"points": 15
},
{
"id": 4,
"license": 1,
"partnerid": 1002,
"partnername": "KDE",
"version": "0.1",
"file": "com.diamondevices.juice.plasmoid",
"image": "juice.png",
"name": "Diamond Juice",
"points": 15
}
]
}
var a = Ember.A()
console.log(koker.assets)
koker.assets.forEach(function(c) {
a.pushObject(c);
})
return a;
}.property('jsonData')
});
MyApp.IndexRoute = Ember.Route.extend({
model: function() {
return MyApp.myObject.create().get('find')
}
});
MyApp.ApplicationController = Ember.Controller.extend({
content: MyApp.myObject.create().get('aComputedProperty'),
json: MyApp.myObject.create().get('find')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment