Permalink
Browse files

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

  • Loading branch information...
2 parents 24547b0 + a0578b3 commit 58b45955f5602de2ddf7e225b959f0822c5dfc75 @everzet committed Aug 28, 2011
Showing with 44 additions and 41 deletions.
  1. +17 −21 public/javascripts/twalks.js
  2. +11 −7 public/stylesheets/style.css
  3. +4 −1 scripts/poller.js
  4. +2 −5 server.js
  5. +1 −1 views/_navigation.ejs
  6. +9 −0 views/backbone/_events.ejs
  7. +0 −6 views/frontend.ejs
@@ -7,7 +7,7 @@
// Enable close button on alert messages
$('.alert-message a.close').live('click', function(ev) {
- $(this).parent().remove();
+ $(this).parent().slideUp('fast', function(){ $(this).remove(); });
ev.preventDefault();
});
@@ -211,15 +211,19 @@
this.collection.bind('reset', this.render);
}
, render: function() {
- var $list;
+ if (this.collection.length > 0) {
+ var $list;
- $(this.el).html(this.template({}));
- $list = this.$('.list');
+ $(this.el).html(this.template({}));
+ $list = this.$('.list');
- this.collection.each(function(event) {
- var view = new App.Views.EventsListEvent({ model: event });
- $list.append(view.render().el);
- });
+ this.collection.each(function(event) {
+ var view = new App.Views.EventsListEvent({ model: event });
+ $list.append(view.render().el);
+ });
+ } else {
+ $(this.el).html($('#events-list-empty-template').html());
+ }
return this;
}
@@ -330,14 +334,10 @@
this.$navigation = $('#navigation');
this.$secondaryNav = $('.secondary-nav', this.$navigation);
this.eventsListView = new App.Views.EventsList({ collection: eventsCollection });
- this.$errorNotif = $('#error-notification');
this.$searchInput = $('#search-form input');
var self = this
, timeout;
- $('#error-notification .close').click(function() {
- self.$errorNotif.slideUp(200);
- });
this.$searchInput.keyup(function() {
clearTimeout(timeout);
@@ -413,7 +413,7 @@
self.displayContainer(self.eventsListView.render().el);
});
}
- }, error: function(){ this.displayErrorNotification('Events list', 'fetching failed'); } });
+ }, error: function(){ alertMessage('warning', 'We encountered an error fetching your events.'); });
}
, listMy: function() {
this.showProgressBar();
@@ -429,7 +429,7 @@
self.hideAndEmptyContainer(function() {
self.displayContainer(listView.render().el);
});
- }, error: function(){ this.displayErrorNotification('My events', 'fetching failed'); } });
+ }, error: function(){ alertMessage('warning', 'We encountered an error fetching your events.'); });
}
, listCurrent: function() {
this.showProgressBar();
@@ -445,7 +445,7 @@
self.hideAndEmptyContainer(function() {
self.displayContainer(listView.render().el);
});
- }, error: function(){ this.displayErrorNotification('Current events', 'fetching failed'); } });
+ }, error: function(){ alertMessage('warning', 'We encountered an error fetching ongoing events.'); });
}
, listUpcoming: function() {
this.showProgressBar();
@@ -461,7 +461,7 @@
self.hideAndEmptyContainer(function() {
self.displayContainer(listView.render().el);
});
- }, error: function(){ this.displayErrorNotification('Upcoming events', 'fetching failed'); } });
+ }, error: function(){ alertMessage('warning', 'We encountered an error fetching upcoming events.'); });
}
, showEvent: function(id) {
this.showProgressBar();
@@ -482,11 +482,7 @@
self.hideAndEmptyContainer(function(){
self.displayContainer(view.render().el);
});
- }, error: function(){ this.displayErrorNotification('Event', 'fetching failed'); } });
- }
- , displayErrorNotification: function(title, description) {
- this.$errorNotif.find('p').empty().append('<strong>'+title+'</strong> '+description);
- this.$errorNotif.slideDown(300);
+ }, error: function(){ alertMessage('warning', 'We encountered an error fetching this event.'); });
}
, showProgressBar: function() {
$('li.user', this.$secondaryNav).stop().hide();
@@ -23,13 +23,6 @@ body {
text-align:center;
margin-top:250px;
}
-#error-notification {
- margin-top:-3px;
- position:fixed;
- width:910px;
- z-index:5;
- display:none;
-}
#intro .logo h1 {
font-family:Leckerli One;
font-size:128px;
@@ -174,6 +167,13 @@ body {
padding-left:20px;
text-align:left;
}
+#events-list.empty {
+ content: '';
+ z-index: 1;
+ background: white;
+ margin: 15px auto;
+ text-align: center;
+}
#events-list .list article .time i {
font-weight:bold;
font-style:normal;
@@ -553,6 +553,10 @@ body {
-o-border-radius:10px;
}
+div.input {
+ position: relative;
+}
+
#flash {
margin-top:20px;
}
View
@@ -55,8 +55,8 @@ function processEvent(job, collection, event, eventsCollection) {
var poll = poller.createPoller(twit, event.hash);
poll.on('data', function(res) {
- console.log(res);
if (typeof res.results !== "undefined") {
+ console.log(res);
res.results.forEach(function(json) {
var tweet = {
tweetId : json.id_str
@@ -79,6 +79,7 @@ function processEvent(job, collection, event, eventsCollection) {
// don't process existing tweet
if (event.tweets.map(mapper('tweetId')).indexOf(tweet.tweetId) !== -1) {
+ console.log('tweet exists');
return;
}
@@ -88,6 +89,8 @@ function processEvent(job, collection, event, eventsCollection) {
event.tweets.push(tweet);
+ eventsCollection.save(event);
+
var relevantTalks = [];
event.talks.forEach(function(talk) {
View
@@ -132,10 +132,7 @@ app.configure('production', function(){
// Routes
app.get('/', function(req, res){
- res.render('frontend', {
- flash: req.flash()
- , layout: false
- });
+ res.render('frontend', { layout: false });
});
function andRequireUser(req, res, next) {
@@ -357,7 +354,7 @@ app.get('/events/:id/tweets.json', function(req, res) {
if (aTime === bTime) {
return 0;
}
- return aTime > bTime ? 1 : -1
+ return aTime < bTime ? 1 : -1
}), 200);
});
});
View
@@ -10,7 +10,7 @@
</form>
<ul id="global-nav">
<li class="all-events"><a href="#events">All events</a></li>
- <li class="current-events"><a href="#events/current">Current events</a></li>
+ <li class="current-events"><a href="#events/current">Ongoing events</a></li>
<li class="upcoming-events"><a href="#events/upcoming">Upcoming events</a></li>
</ul>
<ul class="nav secondary-nav">
@@ -46,6 +46,15 @@
</div>
</script>
+<script type="text/template" id="events-list-empty-template">
+ <div id="events-list" class="empty">
+ <section class="span16 columns list">
+ <h3>No Events Found</h3>
+ <p>No events were found matching your criteria. Please try again.</p>
+ </section>
+ </div>
+</script>
+
<script type="text/template" id="events-list-event-template">
<header class="map">
<span class="time">
View
@@ -50,12 +50,6 @@
<body>
<div class="container">
<%- partial('navigation') %>
- <%- partial('flash') %>
-
- <div id="error-notification" class="alert-message error">
- <a class="close" href="javascript:void(0)">×</a>
- <p><strong>Oh snap!</strong> Change this and that and try again.</p>
- </div>
<div id="bb-content"></div>
</div>

0 comments on commit 58b4595

Please sign in to comment.