Permalink
Browse files

Make error messages consistent and incorporate the slide-up effect fr…

…om the Backbone fetch errors
  • Loading branch information...
1 parent 5ff4281 commit f63c222e7f51cc02db7fbcb8c02fba97a1f90393 @jmikola jmikola committed Aug 28, 2011
Showing with 6 additions and 26 deletions.
  1. +6 −14 public/javascripts/twalks.js
  2. +0 −7 public/stylesheets/style.css
  3. +0 −5 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();
});
@@ -330,14 +330,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 +409,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 +425,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 +441,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 +457,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 +478,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;
View
@@ -51,11 +51,6 @@
<div class="container">
<%- partial('navigation') %>
- <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 f63c222

Please sign in to comment.