-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to touch22. Work around the removal of lat/lng data in the
Yelp API by issuing a separate GMaps geocoding request at the time the map is displayed.
- Loading branch information
Showing
18 changed files
with
220 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/* | ||
* File: app.js | ||
* | ||
* This file was generated by Sencha Architect version 2.2.0. | ||
* This file was generated by Sencha Architect version 2.2.2. | ||
* http://www.sencha.com/products/architect/ | ||
* | ||
* This file requires use of the Sencha Touch 2.1.x library, under independent license. | ||
* License of Sencha Architect does not include license for Sencha Touch 2.1.x. For more | ||
* This file requires use of the Sencha Touch 2.2.x library, under independent license. | ||
* License of Sencha Architect does not include license for Sencha Touch 2.2.x. For more | ||
* details see http://www.sencha.com/license or contact [email protected]. | ||
* | ||
* This file will be auto-generated each and everytime you save your project. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/* | ||
* File: app/controller/Business.js | ||
* | ||
* This file was generated by Sencha Architect version 2.2.0. | ||
* This file was generated by Sencha Architect version 2.2.2. | ||
* http://www.sencha.com/products/architect/ | ||
* | ||
* This file requires use of the Sencha Touch 2.1.x library, under independent license. | ||
* License of Sencha Architect does not include license for Sencha Touch 2.1.x. For more | ||
* This file requires use of the Sencha Touch 2.2.x library, under independent license. | ||
* License of Sencha Architect does not include license for Sencha Touch 2.2.x. For more | ||
* details see http://www.sencha.com/license or contact [email protected]. | ||
* | ||
* This file will be auto-generated each and everytime you save your project. | ||
|
@@ -30,55 +30,86 @@ Ext.define('CityBars.controller.Business', { | |
}, | ||
"detailpanel button[text='Call']": { | ||
tap: 'onCallButtonTap' | ||
}, | ||
"detailpanel > map": { | ||
activate: 'onMapActivate' | ||
} | ||
} | ||
}, | ||
|
||
onListItemTap: function(dataview, index, target, record, e, eOpts) { | ||
var me = this, | ||
map, | ||
lat, | ||
lon, | ||
loc, | ||
marker, | ||
info, details; | ||
var map, | ||
info, | ||
details; | ||
|
||
if (record) { | ||
|
||
details = Ext.create('CityBars.view.DetailPanel', { | ||
title: 'Details' | ||
}); | ||
|
||
// set the map | ||
map = details.child('#detailMap'); | ||
lat = record.get('latitude'); | ||
lon = record.get('longitude'); | ||
|
||
map.setMapOptions({ | ||
zoom: 18 | ||
}); | ||
|
||
// fixes a bug in touch 2.1.1 | ||
map.element.un('painted', 'setMapCenter', map); | ||
|
||
map.setMapCenter({ | ||
latitude: lat, | ||
longitude: lon | ||
}); | ||
map._record = record; | ||
|
||
// set the info | ||
info = details.child('#contact').child('#info'); | ||
info.child('#photo').setData(record.data); | ||
info.child('#data').setData(record.data); | ||
|
||
me.getMainNav().push(details); | ||
this.getMainNav().push(details); | ||
} | ||
}, | ||
|
||
onCallButtonTap: function(button, e, eOpts) { | ||
alert('call tap'); | ||
}, | ||
|
||
onMapActivate: function(newActiveItem, container, oldActiveItem, eOpts) { | ||
var map = newActiveItem, | ||
record = map._record, | ||
lat = record.get('latitude'), | ||
lng = record.get('longitude'), | ||
centerMap = Ext.Function.createDelayed(function() { | ||
map.setMapOptions({ | ||
zoom: 18 | ||
}); | ||
map.setMapCenter({ | ||
latitude: lat, | ||
longitude: lng | ||
}); | ||
}, 250), | ||
geocoder, loc; | ||
|
||
if (lat && lng) { | ||
centerMap(); | ||
} else { | ||
geocoder = this._geocoder || (this._geocoder = new google.maps.Geocoder()); | ||
geocoder.geocode( | ||
{address: [ | ||
record.get('address1'), | ||
record.get('address2'), | ||
record.get('address3'), | ||
record.get('city'), | ||
record.get('state_code'), | ||
record.get('zip') | ||
].join(', ')}, | ||
function(results, status) { | ||
if (status == google.maps.GeocoderStatus.OK) { | ||
loc = results[0].geometry.location; | ||
lat = loc.lat(); | ||
lng = loc.lng(); | ||
record.set('latitude', lat); | ||
record.set('longitude', lng); | ||
centerMap(); | ||
} else { | ||
Ext.Msg.alert("Could not find location: " + status); | ||
} | ||
} | ||
); | ||
} | ||
|
||
}, | ||
|
||
getLocation: function(callback) { | ||
console.log('getLoc'); | ||
if (navigator && navigator.geolocation) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/* | ||
* File: app/model/Business.js | ||
* | ||
* This file was generated by Sencha Architect version 2.2.0. | ||
* This file was generated by Sencha Architect version 2.2.2. | ||
* http://www.sencha.com/products/architect/ | ||
* | ||
* This file requires use of the Sencha Touch 2.1.x library, under independent license. | ||
* License of Sencha Architect does not include license for Sencha Touch 2.1.x. For more | ||
* This file requires use of the Sencha Touch 2.2.x library, under independent license. | ||
* License of Sencha Architect does not include license for Sencha Touch 2.2.x. For more | ||
* details see http://www.sencha.com/license or contact [email protected]. | ||
* | ||
* This file will be auto-generated each and everytime you save your project. | ||
|
@@ -54,6 +54,12 @@ Ext.define('CityBars.model.Business', { | |
}, | ||
{ | ||
name: 'photo_url' | ||
}, | ||
{ | ||
name: 'city' | ||
}, | ||
{ | ||
name: 'zip' | ||
} | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/* | ||
* File: app/store/BusinessStore.js | ||
* | ||
* This file was generated by Sencha Architect version 2.2.0. | ||
* This file was generated by Sencha Architect version 2.2.2. | ||
* http://www.sencha.com/products/architect/ | ||
* | ||
* This file requires use of the Sencha Touch 2.1.x library, under independent license. | ||
* License of Sencha Architect does not include license for Sencha Touch 2.1.x. For more | ||
* This file requires use of the Sencha Touch 2.2.x library, under independent license. | ||
* License of Sencha Architect does not include license for Sencha Touch 2.2.x. For more | ||
* details see http://www.sencha.com/license or contact [email protected]. | ||
* | ||
* This file will be auto-generated each and everytime you save your project. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/* | ||
* File: app/view/DetailPanel.js | ||
* | ||
* This file was generated by Sencha Architect version 2.2.0. | ||
* This file was generated by Sencha Architect version 2.2.2. | ||
* http://www.sencha.com/products/architect/ | ||
* | ||
* This file requires use of the Sencha Touch 2.1.x library, under independent license. | ||
* License of Sencha Architect does not include license for Sencha Touch 2.1.x. For more | ||
* This file requires use of the Sencha Touch 2.2.x library, under independent license. | ||
* License of Sencha Architect does not include license for Sencha Touch 2.2.x. For more | ||
* details see http://www.sencha.com/license or contact [email protected]. | ||
* | ||
* This file will be auto-generated each and everytime you save your project. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/* | ||
* File: app/view/ListContainer.js | ||
* | ||
* This file was generated by Sencha Architect version 2.2.0. | ||
* This file was generated by Sencha Architect version 2.2.2. | ||
* http://www.sencha.com/products/architect/ | ||
* | ||
* This file requires use of the Sencha Touch 2.1.x library, under independent license. | ||
* License of Sencha Architect does not include license for Sencha Touch 2.1.x. For more | ||
* This file requires use of the Sencha Touch 2.2.x library, under independent license. | ||
* License of Sencha Architect does not include license for Sencha Touch 2.2.x. For more | ||
* details see http://www.sencha.com/license or contact [email protected]. | ||
* | ||
* This file will be auto-generated each and everytime you save your project. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/* | ||
* File: app/view/MainNav.js | ||
* | ||
* This file was generated by Sencha Architect version 2.2.0. | ||
* This file was generated by Sencha Architect version 2.2.2. | ||
* http://www.sencha.com/products/architect/ | ||
* | ||
* This file requires use of the Sencha Touch 2.1.x library, under independent license. | ||
* License of Sencha Architect does not include license for Sencha Touch 2.1.x. For more | ||
* This file requires use of the Sencha Touch 2.2.x library, under independent license. | ||
* License of Sencha Architect does not include license for Sencha Touch 2.2.x. For more | ||
* details see http://www.sencha.com/license or contact [email protected]. | ||
* | ||
* This file will be auto-generated each and everytime you save your project. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.