Skip to content
Browse files

Merge branch 'develop' of github.com:nko2/sf2-boys into develop

  • Loading branch information...
2 parents 34ec15b + a79d380 commit da22755c853d4dfc69957574a4c85128e9bdf82b @everzet committed Aug 29, 2011
Showing with 63 additions and 27 deletions.
  1. +53 −27 public/javascripts/twalks.js
  2. +10 −0 server.js
View
80 public/javascripts/twalks.js
@@ -295,6 +295,7 @@
window.App.router.navigate('events/' + model.get('_id'), true);
}
, error: function(model, err) {
+ console.log(err);
alertMessage('error', 'Oops! There was a problem submitting this form. Please fix the errors below and try again.');
var errors = $.parseJSON(err.responseText)
, self = this;
@@ -405,15 +406,20 @@
eventsCollection.url = '/events.json';
}
- eventsCollection.fetch({ success: function() {
- if (withoutAnimation) {
- self.displayContainer(self.eventsListView.render().el);
- } else {
- self.hideAndEmptyContainer(function(){
+ eventsCollection.fetch({
+ success: function() {
+ if (withoutAnimation) {
self.displayContainer(self.eventsListView.render().el);
- });
+ } else {
+ self.hideAndEmptyContainer(function(){
+ self.displayContainer(self.eventsListView.render().el);
+ });
+ }
}
- }, error: function(){ alertMessage('warning', 'We encountered an error fetching your events.'); });
+ , error: function(){
+ alertMessage('warning', 'We encountered an error fetching your events.');
+ }
+ });
}
, listMy: function() {
this.showProgressBar();
@@ -425,11 +431,16 @@
, collection = new App.Collections.EventsMy
, listView = new App.Views.EventsList({ collection: collection });
- collection.fetch({ success: function() {
- self.hideAndEmptyContainer(function() {
- self.displayContainer(listView.render().el);
- });
- }, error: function(){ alertMessage('warning', 'We encountered an error fetching your events.'); });
+ collection.fetch({
+ success: function() {
+ self.hideAndEmptyContainer(function() {
+ self.displayContainer(listView.render().el);
+ });
+ }
+ , error: function(){
+ alertMessage('warning', 'We encountered an error fetching your events.');
+ }
+ });
}
, listCurrent: function() {
this.showProgressBar();
@@ -441,11 +452,16 @@
, collection = new App.Collections.EventsCurrent
, listView = new App.Views.EventsList({ collection: collection });
- collection.fetch({ success: function() {
- self.hideAndEmptyContainer(function() {
- self.displayContainer(listView.render().el);
- });
- }, error: function(){ alertMessage('warning', 'We encountered an error fetching ongoing events.'); });
+ collection.fetch({
+ success: function() {
+ self.hideAndEmptyContainer(function() {
+ self.displayContainer(listView.render().el);
+ });
+ }
+ , error: function(){
+ alertMessage('warning', 'We encountered an error fetching ongoing events.');
+ }
+ });
}
, listUpcoming: function() {
this.showProgressBar();
@@ -457,11 +473,16 @@
, collection = new App.Collections.EventsUpcoming
, listView = new App.Views.EventsList({ collection: collection });
- collection.fetch({ success: function() {
- self.hideAndEmptyContainer(function() {
- self.displayContainer(listView.render().el);
- });
- }, error: function(){ alertMessage('warning', 'We encountered an error fetching upcoming events.'); });
+ collection.fetch({
+ success: function() {
+ self.hideAndEmptyContainer(function() {
+ self.displayContainer(listView.render().el);
+ });
+ }
+ , error: function(){
+ alertMessage('warning', 'We encountered an error fetching upcoming events.');
+ }
+ });
}
, showEvent: function(id) {
this.showProgressBar();
@@ -478,11 +499,16 @@
, self = this
;
- event.fetch({ success: function() {
- self.hideAndEmptyContainer(function(){
- self.displayContainer(view.render().el);
- });
- }, error: function(){ alertMessage('warning', 'We encountered an error fetching this event.'); });
+ event.fetch({
+ success: function() {
+ self.hideAndEmptyContainer(function(){
+ self.displayContainer(view.render().el);
+ });
+ }
+ , error: function(){
+ alertMessage('warning', 'We encountered an error fetching this event.');
+ }
+ });
}
, showProgressBar: function() {
$('li.user', this.$secondaryNav).stop().hide();
View
10 server.js
@@ -231,7 +231,9 @@ app.get('/events.json', function(req, res){
}
event.set("tweetsCount", event.tweets.length);
+ event.set("assetsCount", event.assets.length);
event.tweets = [];
+ event.assets = [];
eventList.push(event);
});
@@ -259,7 +261,9 @@ app.get('/events/my.json', andRequireUser, function(req, res) {
return aTime > bTime ? -1 : 1
}).forEach(function(event, i) {
event.set("tweetsCount", event.tweets.length);
+ event.set("assetsCount", event.assets.length);
event.tweets = [];
+ event.assets = [];
eventList.push(event);
});
@@ -287,7 +291,9 @@ app.get('/events/current.json', function(req, res){
return aTime > bTime ? -1 : 1
}).forEach(function(event, i) {
event.set("tweetsCount", event.tweets.length);
+ event.set("assetsCount", event.assets.length);
event.tweets = [];
+ event.assets = [];
eventList.push(event);
});
@@ -315,7 +321,9 @@ app.get('/events/upcoming.json', function(req, res){
return aTime > bTime ? -1 : 1
}).forEach(function(event, i) {
event.set("tweetsCount", event.tweets.length);
+ event.set("assetsCount", event.assets.length);
event.tweets = [];
+ event.assets = [];
eventList.push(event);
});
@@ -333,7 +341,9 @@ app.get('/events/:id.json', function(req, res) {
}
event.set("tweetsCount", event.tweets.length);
+ event.set("assetsCount", event.assets.length);
event.tweets = [];
+ event.assets = [];
res.json(event, 200);
});

0 comments on commit da22755

Please sign in to comment.
Something went wrong with that request. Please try again.