Skip to content

Commit

Permalink
Fix IE8 bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
atogle committed Sep 9, 2014
1 parent 386f7ee commit 1ff451a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
12 changes: 12 additions & 0 deletions src/sa_web/static/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ var Shareabouts = Shareabouts || {};
return false;
},

// NOTE this is not in Shareabouts.js
// this will be "mobile" or "desktop", as defined in default.css
getPageLayout: function() {
// not IE8
if (window.getComputedStyle) {
return window.getComputedStyle(document.body,':after').getPropertyValue('content');
}

// IE8
return 'desktop';
},

// NOTE this is not in Shareabouts.js
// Keeps a cache of "sticky" form fields in memory. This cache is set when
// the user submits a place or survey form, and is used to prepopulate both
Expand Down
11 changes: 5 additions & 6 deletions src/sa_web/static/js/views/app-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ var Shareabouts = Shareabouts || {};
// is enabled.
$(S).on('reversegeocode', function(evt, locationData) {
var locationString = Handlebars.templates['location-string'](locationData);
self.geocodeAddressView.setAddress(locationString.trim());
self.geocodeAddressView.setAddress($.trim(locationString));
self.placeFormView.setLatLng(locationData.latLng);
self.placeFormView.setLocation(locationData);
});
Expand Down Expand Up @@ -349,7 +349,7 @@ var Shareabouts = Shareabouts || {};
// If the newBodyClass isn't among the ones that will be cleared
// (bodyClasses), then we probably don't want to use this method and
// should fail loudly.
if (bodyClasses.indexOf(newBodyClasses[i]) === -1) {
if (_.indexOf(bodyClasses, newBodyClasses[i]) === -1) {
S.Util.console.error('Setting an unrecognized body class.\nYou should probably just use jQuery directly.');
}
$body.addClass(newBodyClasses[i]);
Expand Down Expand Up @@ -421,8 +421,7 @@ var Shareabouts = Shareabouts || {};
viewPlace: function(model, responseId, zoom) {
var self = this,
includeSubmissions = S.Config.flavor.app.list_enabled !== false,
// will be "mobile" or "desktop", as defined in default.css
layout = window.getComputedStyle(document.body,':after').getPropertyValue('content'),
layout = S.Util.getPageLayout(),
onPlaceFound, onPlaceNotFound, modelId;

onPlaceFound = function(model) {
Expand Down Expand Up @@ -539,7 +538,7 @@ var Shareabouts = Shareabouts || {};

if (!preventScrollToTop) {
// will be "mobile" or "desktop", as defined in default.css
var layout = window.getComputedStyle(document.body,':after').getPropertyValue('content');
var layout = S.Util.getPageLayout();
if (layout === 'desktop') {
// For desktop, the panel content is scrollable
this.$panelContent.scrollTo(0, 0);
Expand Down Expand Up @@ -588,7 +587,7 @@ var Shareabouts = Shareabouts || {};
},
destroyNewModels: function() {
this.collection.each(function(m){
if (m.isNew()) {
if (m && m.isNew()) {
m.destroy();
}
});
Expand Down
7 changes: 2 additions & 5 deletions src/sa_web/static/js/views/survey-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@ var Shareabouts = Shareabouts || {};
responses = [],
url = window.location.toString(),
urlParts = url.split('response/'),
// will be "mobile" or "desktop", as defined in default.css
layout = window.getComputedStyle(document.body,':after').getPropertyValue('content'),
responseIdToScrollTo,
$responseToScrollTo,
data;
layout = S.Util.getPageLayout(),
responseIdToScrollTo, $responseToScrollTo, data;

// get the response id from the url
if (urlParts.length === 2) {
Expand Down

0 comments on commit 1ff451a

Please sign in to comment.