|
|
@ -25,23 +25,62 @@ App.ApplicationRoute = Ember.Route.extend({ |
|
|
|
var restUrl = 'http://localhost:5000'; |
|
|
|
var restUrl = 'http://localhost:5000'; |
|
|
|
var today = new Date(); |
|
|
|
var today = new Date(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// no more hashchange in browser location
|
|
|
|
|
|
|
|
/*App.Router.reopen({ |
|
|
|
|
|
|
|
location: 'history' |
|
|
|
|
|
|
|
});*/ |
|
|
|
|
|
|
|
|
|
|
|
App.ApplicationController = Ember.Controller.extend({ |
|
|
|
App.ApplicationController = Ember.Controller.extend({ |
|
|
|
appName: '#Movies' |
|
|
|
appName: '#Movies', |
|
|
|
|
|
|
|
loginState: null |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Routers
|
|
|
|
|
|
|
|
|
|
|
|
App.Router.map(function() { |
|
|
|
App.Router.map(function() { |
|
|
|
this.resource('movies'); |
|
|
|
this.resource('movies', { path: 'm' }, function() { |
|
|
|
this.resource('nowshowing'); |
|
|
|
this.route('nowshowing'); |
|
|
|
this.resource('comingsoon'); |
|
|
|
this.route('comingsoon'); |
|
|
|
this.resource('older'); |
|
|
|
this.route('older'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
/* this.resource('nowshowing', { path: 'm/nowshowing' }); |
|
|
|
|
|
|
|
this.resource('comingsoon', { path: 'm/comingsoon' }); |
|
|
|
|
|
|
|
this.resource('older', { path: 'm/older' });*/ |
|
|
|
|
|
|
|
this.resource('login'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
App.LoginRoute = Ember.Route.extend({ |
|
|
|
|
|
|
|
renderTemplate: function() { |
|
|
|
|
|
|
|
console.log("rendering!!"); |
|
|
|
|
|
|
|
this.render('login', { controller: 'login' }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Controllers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
App.LoginController = Ember.Controller.extend({ |
|
|
|
|
|
|
|
login: function() { |
|
|
|
|
|
|
|
var self = this, data = this.getProperties('username', 'password'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.set('errorMessage', null); |
|
|
|
|
|
|
|
Ember.$.post(restUrl+'/login/', data).then(function(response) { |
|
|
|
|
|
|
|
self.set('errorMessage', response.message); |
|
|
|
|
|
|
|
if (response.success) { |
|
|
|
|
|
|
|
self.set('token', request.token); |
|
|
|
|
|
|
|
console.log(request); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// redirect '/' to 'groups' by default
|
|
|
|
// redirect '/' to 'groups' by default
|
|
|
|
App.IndexRoute = Ember.Route.extend({ |
|
|
|
App.IndexRoute = Ember.Route.extend({ |
|
|
|
afterModel: function() { |
|
|
|
redirect: function() { |
|
|
|
this.transitionTo('nowshowing'); |
|
|
|
this.transitionTo('movies'); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -81,39 +120,65 @@ App.BaseModalComponent = Ember.Component.extend({ |
|
|
|
}.on('didInsertElement') |
|
|
|
}.on('didInsertElement') |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
App.MoviesRoute = Ember.Route.extend({ |
|
|
|
/*App.MoviesRoute = Ember.Route.extend({ |
|
|
|
model: function(params) { |
|
|
|
setupController: function(controller, model) { |
|
|
|
return $.getJSON(restUrl+'/movies/').then(function(data) { |
|
|
|
this.controllerFor('nowshowing').set('model', model); |
|
|
|
return data.objects.map(function(movies) { |
|
|
|
|
|
|
|
return movies; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
// model: function(params) {
|
|
|
|
|
|
|
|
// return $.getJSON(restUrl+'/movies/').then(function(data) {
|
|
|
|
|
|
|
|
// return data.objects.map(function(movies) {
|
|
|
|
|
|
|
|
// return movies;
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
});*/ |
|
|
|
|
|
|
|
|
|
|
|
App.NowshowingRoute = Ember.Route.extend({ |
|
|
|
App.MoviesNowshowingRoute = Ember.Route.extend({ |
|
|
|
model: function(params) { |
|
|
|
model: function(params) { |
|
|
|
return $.getJSON(restUrl+'/movies/').then(function(data) { |
|
|
|
return $.getJSON(restUrl+'/movies/nowshowing/').then(function(data) { |
|
|
|
return data.objects.map(function(movies) { |
|
|
|
return data.objects.map(function(movies) { |
|
|
|
return movies; |
|
|
|
return movies; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
}); |
|
|
|
renderTemplate: function() { |
|
|
|
|
|
|
|
console.log("rendering!!"); |
|
|
|
|
|
|
|
this.render('movies.nowshowing'); |
|
|
|
|
|
|
|
|
|
|
|
App.ComingsoonRoute = Ember.Route.extend({ |
|
|
|
/* |
|
|
|
model: function(params) { |
|
|
|
// can render multiple thing at once too!!
|
|
|
|
return $.getJSON(restUrl+'/movies/comingsoon/').then(function(data) { |
|
|
|
this.render('comments', { |
|
|
|
return data.objects.map(function(movies) { |
|
|
|
into: 'favoritePost', |
|
|
|
return movies; |
|
|
|
outlet: 'comment', |
|
|
|
}); |
|
|
|
controller: 'blogPost' |
|
|
|
}); |
|
|
|
});*/ |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
actions: { |
|
|
|
|
|
|
|
createMovie: function() { |
|
|
|
|
|
|
|
var name = this.get('controller').get('newName'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ember.$.ajax(restUrl+'/movie/new/', { |
|
|
|
|
|
|
|
type: 'POST', |
|
|
|
|
|
|
|
dataType: 'json', |
|
|
|
|
|
|
|
data: { name: name }, |
|
|
|
|
|
|
|
context: this, |
|
|
|
|
|
|
|
success: function(data) { |
|
|
|
|
|
|
|
var mv = App.Nowshowing.createMovie(data); |
|
|
|
|
|
|
|
// this.modelFor('nowshowing').set('newName', '');
|
|
|
|
|
|
|
|
// this.transitionTo
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
error: function() { |
|
|
|
|
|
|
|
alert('Failed to save movie'); |
|
|
|
|
|
|
|
// this.modelFor('nowshowing').set('newName', '');
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
App.OlderRoute = Ember.Route.extend({ |
|
|
|
App.MoviesComingsoonRoute = Ember.Route.extend({ |
|
|
|
model: function(params) { |
|
|
|
model: function(params) { |
|
|
|
return $.getJSON(restUrl+'/movies/older/').then(function(data) { |
|
|
|
return $.getJSON(restUrl+'/movies/comingsoon/').then(function(data) { |
|
|
|
return data.objects.map(function(movies) { |
|
|
|
return data.objects.map(function(movies) { |
|
|
|
return movies; |
|
|
|
return movies; |
|
|
|
}); |
|
|
|
}); |
|
|
@ -121,7 +186,7 @@ App.OlderRoute = Ember.Route.extend({ |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
App.ComingsoonView = Ember.View.extend({ |
|
|
|
App.MoviesComingsoonView = Ember.View.extend({ |
|
|
|
didInsertElement: function() { |
|
|
|
didInsertElement: function() { |
|
|
|
Ember.run.next(this, function() { |
|
|
|
Ember.run.next(this, function() { |
|
|
|
this.$('#container').isotope({ |
|
|
|
this.$('#container').isotope({ |
|
|
@ -130,16 +195,16 @@ App.ComingsoonView = Ember.View.extend({ |
|
|
|
transitionDuration: '0.7s', |
|
|
|
transitionDuration: '0.7s', |
|
|
|
isResizeBound: true |
|
|
|
isResizeBound: true |
|
|
|
}); |
|
|
|
}); |
|
|
|
echo.init({ |
|
|
|
/*echo.init({ |
|
|
|
offset: 100, |
|
|
|
offset: 100, |
|
|
|
throttle: 250, |
|
|
|
throttle: 250, |
|
|
|
unload: false |
|
|
|
unload: false |
|
|
|
}); |
|
|
|
});*/ |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
App.NowshowingView = Ember.View.extend({ |
|
|
|
App.MoviesNowshowingView = Ember.View.extend({ |
|
|
|
didInsertElement: function() { |
|
|
|
didInsertElement: function() { |
|
|
|
Ember.run.next(this, function() { |
|
|
|
Ember.run.next(this, function() { |
|
|
|
this.$('#container').isotope({ |
|
|
|
this.$('#container').isotope({ |
|
|
@ -156,7 +221,20 @@ App.NowshowingView = Ember.View.extend({ |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
App.OlderView = Ember.View.extend({ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
App.MoviesOlderRoute = Ember.Route.extend({ |
|
|
|
|
|
|
|
model: function(params) { |
|
|
|
|
|
|
|
return $.getJSON(restUrl+'/movies/older/').then(function(data) { |
|
|
|
|
|
|
|
return data.objects.map(function(movies) { |
|
|
|
|
|
|
|
return movies; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
App.MoviesOlderView = Ember.View.extend({ |
|
|
|
didInsertElement: function() { |
|
|
|
didInsertElement: function() { |
|
|
|
Ember.run.next(this, function() { |
|
|
|
Ember.run.next(this, function() { |
|
|
|
this.$('#container').isotope({ |
|
|
|
this.$('#container').isotope({ |
|
|
@ -165,16 +243,16 @@ App.OlderView = Ember.View.extend({ |
|
|
|
transitionDuration: '0.7s', |
|
|
|
transitionDuration: '0.7s', |
|
|
|
isResizeBound: true |
|
|
|
isResizeBound: true |
|
|
|
}); |
|
|
|
}); |
|
|
|
echo.init({ |
|
|
|
/*echo.init({ |
|
|
|
offset: 100, |
|
|
|
offset: 100, |
|
|
|
throttle: 250, |
|
|
|
throttle: 250, |
|
|
|
unload: false |
|
|
|
unload: false |
|
|
|
}); |
|
|
|
});*/ |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
App.MoviesView = Ember.View.extend({ |
|
|
|
/*App.MoviesView = Ember.View.extend({ |
|
|
|
didInsertElement: function() { |
|
|
|
didInsertElement: function() { |
|
|
|
Ember.run.next(this, function() { |
|
|
|
Ember.run.next(this, function() { |
|
|
|
this.$('#container').isotope({ |
|
|
|
this.$('#container').isotope({ |
|
|
@ -190,7 +268,7 @@ App.MoviesView = Ember.View.extend({ |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
});*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ember.Handlebars.helper('format-date', function(date) { |
|
|
|
Ember.Handlebars.helper('format-date', function(date) { |
|
|
|