Permalink
Browse files

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

  • Loading branch information...
avalanche123 committed Aug 28, 2011
2 parents ce3b083 + 9ecbaa5 commit 16e491a0e748303f0c4f046a2554528e76ec4f6a
Showing with 14 additions and 5 deletions.
  1. +11 −2 public/javascripts/twalks.js
  2. +1 −1 server.js
  3. +2 −2 views/backbone/_events.ejs
@@ -295,7 +295,11 @@
window.App.router.navigate('events/' + model.get('_id'), true);
}
, error: function(model, err) {
- console.log(err);
+ if (403 == err.status) {
+ alertMessage('warning', 'You must be signed in to submit this form. Please sign in using the link at the top right.');
+ return;
+ }
+
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;
@@ -437,7 +441,12 @@
self.displayContainer(listView.render().el);
});
}
- , error: function(){
+ , error: function(model, err){
+ if (403 == err.status) {
+ alertMessage('warning', 'You must be signed in to view your events. Please sign in using the link at the top right.');
+ return;
+ }
+
alertMessage('warning', 'We encountered an error fetching your events.');
}
});
View
@@ -136,7 +136,7 @@ app.get('/', function(req, res){
});
function andRequireUser(req, res, next) {
- req.loggedIn ? next() : next(new Error('Unauthorized'));
+ req.loggedIn ? next() : res.send('Unauthorized', 403);
}
app.post('/events/new.json', andRequireUser, function(req, res){
@@ -66,7 +66,7 @@
{% } %}
</span>
{% if (typeof location != 'undefined') { %}
- <div class="img" style="width:150px; height:150px; background:url(http://maps.google.com/maps/api/staticmap?center={{ location }}&zoom=13&size=150x150&sensor=false);"></div>
+ <div class="img" style="width:150px; height:150px; background:url(http://maps.google.com/maps/api/staticmap?center={{ encodeURIComponent(location) }}&zoom=13&size=150x150&sensor=false);"></div>
{% } else { %}
<div class="img" style="width:150px; height:150px; background:url(http://maps.google.com/maps/api/staticmap?center=Unknown&zoom=13&size=150x150&sensor=false);"></div>
{% } %}
@@ -124,7 +124,7 @@
<article>
<header class="map">
{% if (typeof location != 'undefined') { %}
- <div class="img" style="width:300px; height:300px; background:url(http://maps.google.com/maps/api/staticmap?center={{ location }}&markers=size:mid|color:blue|{{ location }}&zoom=13&size=300x300&sensor=false);"></div>
+ <div class="img" style="width:300px; height:300px; background:url(http://maps.google.com/maps/api/staticmap?center={{ encodeURIComponent(location) }}&markers=size:mid|color:blue|{{ encodeURIComponent(location) }}&zoom=13&size=300x300&sensor=false);"></div>
{% } else { %}
<div class="img" style="width:300px; height:300px; background:url(http://maps.google.com/maps/api/staticmap?center=Unknown&markers=size:mid|color:blue|Unknown&zoom=13&size=300x300&sensor=false);"></div>
{% } %}

0 comments on commit 16e491a

Please sign in to comment.