Permalink
Browse files

fix dropbox stuff add in most recent image

  • Loading branch information...
1 parent 463ffc3 commit 19c9f3796eb9210cf73fce441059af7bfccd29d8 @ranman committed Mar 5, 2013
Showing with 22 additions and 9 deletions.
  1. +4 −3 main.py
  2. +18 −6 templates/index.html
View
@@ -14,7 +14,6 @@
app = Flask(__name__)
-app.config.from_object(__name__)
redirect_uri = _config['flask']['base_url'] + _config['foursquare']['redirect_uri']
foursqclient = foursquare.Foursquare(
@@ -43,7 +42,6 @@ def dropbox_oath():
dbox_session.request_token)
dbox_session.set_token(access_token.key,
access_token.secret)
- dbox_client = client.DropboxClient(dbox_session)
return redirect(_config['flask']['base_url'], 302)
@app.route(_config['foursquare']['redirect_uri'])
@@ -64,7 +62,10 @@ def foursquare_auth():
@app.route('/')
def main_page():
checkin = foursqclient.users.checkins(params={'limit': 1})['checkins']['items'][0]
- return render_template('index.html', checkin=checkin)
+ dbox_client = client.DropboxClient(dbox_session)
+ latest_photo = dbox_client.metadata('/.gitshots')['contents'][-1]
+ latest_photo = dbox_client.media(latest_photo['path'])['url']
+ return render_template('index.html', checkin=checkin, latest_photo=latest_photo)
if __name__ == '__main__':
app.debug = _config['flask']['debug']
View
@@ -13,22 +13,34 @@
</script>
<script type="text/javascript">
function initialize() {
+ var myLatLng = new google.maps.LatLng({{ checkin.venue.location.lat }},
+ {{ checkin.venue.location.lng }});
var mapOptions = {
- center: new google.maps.LatLng({{ checkin.venue.location.lat }},
- {{ checkin.venue.location.lng }}),
+ center: myLatLng,
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
+ var marker = new google.maps.Marker({
+ position: myLatLng,
+ animation: google.maps.Animation.DROP,
+ map: map,
+ title: "{{ checkin.venue.name }}"
+ });
}
</script>
</head>
<body onload="initialize()">
- <h1>Randall is here: {{ checkin.venue.name }}</h1>
- <h3>{{ checkin.venue.location.city }}</h3>
- <h3>{{ checkin.venue.location.country }}</h3>
- <h3>{{ checkin.shout }}</h3>
+ <div id="leftpanel" style="float:left; width: 45%">
+ <h1>Randall is here: {{ checkin.venue.name }}</h1>
+ <h3>{{ checkin.venue.location.city }}</h3>
+ <h3>{{ checkin.venue.location.country }}</h3>
+ <h3>{{ checkin.shout }}</h3>
+ </div>
+ <div id="rightpanel" style="float:right; width: 45%">
+ <img src="{{ latest_photo }}" width=300 >
+ </div>
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>

0 comments on commit 19c9f37

Please sign in to comment.