Skip to content

Commit

Permalink
Updated crap
Browse files Browse the repository at this point in the history
  • Loading branch information
silent1mezzo committed Apr 14, 2012
1 parent a948604 commit 82811f9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion hackto/apps/around/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from django.contrib.localflavor.ca.forms import CAPostalCodeField

class SearchForm(forms.Form):
forms.CharField(widget=forms.TextInput(attrs={'class':'input-xxlarge', 'placeholder':'Enter your address/postal code...'}))
address = forms.CharField(widget=forms.TextInput(attrs={'class':'input-xxlarge', 'placeholder':'Enter your address/postal code...'}))
2 changes: 2 additions & 0 deletions hackto/apps/around/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def search(request):
form = SearchForm(request.POST)
if form.is_valid():
address = form.cleaned_data['address']

dict['lat'],dict['lon'] = get_lat_long(address)
else:
form = SearchForm()

Expand Down
2 changes: 1 addition & 1 deletion hackto/static_media/js/around.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$(document).ready(function() {
$('#map_canvas').gmap().bind('init', function(ev, map) {
$('#map_canvas').gmap('addMarker', {'position': '57.7973333,12.0502107', 'bounds': true}).click(function() {
$('#map_canvas').gmap('addMarker', {'position': $LAT,$LON, 'bounds': true}).click(function() {
$('#map_canvas').gmap('openInfoWindow', {'content': 'Hello World!'}, this);
});
});
Expand Down
7 changes: 5 additions & 2 deletions hackto/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@
<div class="search">
<form class="form-inline" method='post' action='{% url search %}'>
{% csrf_token %}
{{ form.address }} or
{{ form.postal_code }}
{{ form.address }}
<button type="submit" class="btn btn-large btn-orange">Search</button>
</form>
</div>
Expand All @@ -85,6 +84,10 @@
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript">
$LAT = {{ lat }};
$LON = {{ lon }};
</script>
<script src="{{ STATIC_URL }}js/jquery.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap.js"></script>
<script src="http://maps.googleapis.com/maps/api/js?key={{ MAPS_API_KEY }}&sensor=false" type="text/javascript"></script>
Expand Down
3 changes: 1 addition & 2 deletions hackto/templates/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
<form class="form-inline" method='post' action='{% url search %}'>
{% csrf_token %}
{{ form.errors }}
{{ form.address }} or
{{ form.postal_code }}
{{ form.address }}
<button type="submit" class="btn btn-large btn-orange">Search</button>
</form>
</div>
Expand Down

0 comments on commit 82811f9

Please sign in to comment.