|
|
@ -21,20 +21,9 @@ var groups = [ |
|
|
|
{id: "1", name: "sf"}, {id: "2", name: "major"} |
|
|
|
{id: "1", name: "sf"}, {id: "2", name: "major"} |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
var theaters = [ |
|
|
|
|
|
|
|
{id: "1", name: 'Sf Emporium', code: "9909"}, |
|
|
|
|
|
|
|
{id: "2", name: 'Sf NgamWongWan', code: "9934"} |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var showtimes = [ |
|
|
|
|
|
|
|
{id: "1", name: "The Cove (1999)", showtimes: ['10:30', '13:30']}, |
|
|
|
|
|
|
|
{id: "2", name: "The Notebook (2004)", showtimes: ['15:30', '17:30']}, |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var restUrl = 'http://showtimes.everyday.in.th/api'; |
|
|
|
var restUrl = 'http://showtimes.everyday.in.th/api'; |
|
|
|
var today = new Date(); |
|
|
|
var today = new Date(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
App.Router.map(function() { |
|
|
|
App.Router.map(function() { |
|
|
|
this.resource('about'); |
|
|
|
this.resource('about'); |
|
|
|
this.resource('api'); |
|
|
|
this.resource('api'); |
|
|
@ -53,11 +42,14 @@ App.GroupsRoute = Ember.Route.extend({ |
|
|
|
|
|
|
|
|
|
|
|
App.TheatersRoute = Ember.Route.extend({ |
|
|
|
App.TheatersRoute = Ember.Route.extend({ |
|
|
|
model: function(params) { |
|
|
|
model: function(params) { |
|
|
|
return $.getJSON(restUrl+'/theaters/'+params.name+'/'); |
|
|
|
return $.getJSON(restUrl+'/theaters/'+params.name+'/').then(function(data) { |
|
|
|
|
|
|
|
return data.objects.map(function(theater) { |
|
|
|
|
|
|
|
return theater; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
App.ShowtimesRoute = Ember.Route.extend({ |
|
|
|
App.ShowtimesRoute = Ember.Route.extend({ |
|
|
|
model: function(params) { |
|
|
|
model: function(params) { |
|
|
|
var theatersObjs = this.modelFor('theaters'); |
|
|
|
var theatersObjs = this.modelFor('theaters'); |
|
|
@ -65,7 +57,11 @@ App.ShowtimesRoute = Ember.Route.extend({ |
|
|
|
restUrl, '/showtimes/', theatersObjs[0].group, |
|
|
|
restUrl, '/showtimes/', theatersObjs[0].group, |
|
|
|
'/', params.code, '/?d=', moment(today).format('YYYY-MM-DD') |
|
|
|
'/', params.code, '/?d=', moment(today).format('YYYY-MM-DD') |
|
|
|
]; |
|
|
|
]; |
|
|
|
return $.getJSON(url.join('')); |
|
|
|
return $.getJSON(url.join('')).then(function(data) { |
|
|
|
|
|
|
|
return data.objects.map(function(showtimesItem) { |
|
|
|
|
|
|
|
return showtimesItem; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|