-
Notifications
You must be signed in to change notification settings - Fork 0
/
group_search.html
101 lines (62 loc) · 2.9 KB
/
group_search.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.6/handlebars.min.js"></script>
<script type="text/javascript" src="vendor/swag/lib/swag.js"></script>
<script type="text/javascript" src="js/data.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="css/user.css" rel="stylesheet">
<script>
$(document).ready(function(){
var template = Handlebars.compile($("#groups-search-template").html());
$("#content").append(template(data));
var input = document.getElementById('searchTextField');
var options = {
types: ['(cities)'],
componentRestrictions: {country: "us"}
};
autocomplete = new google.maps.places.Autocomplete(input,options);
google.maps.event.addListener(autocomplete, 'place_changed', function () {
var place = autocomplete.getPlace();
document.getElementById('state').value = place.address_components[2].short_name;
document.getElementById('city').value = place.name;
document.getElementById('latitude').value = place.geometry.location.lat();
document.getElementById('longitude').value = place.geometry.location.lng();
});
});
</script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCjDTJc7RFsQQAf7D3z_FhJ51HjdiR77y0&libraries=places"></script>
<script type="text/javascript" src="js/public.js"></script>
</head>
<body>
<div class="container">
<a href="./"><h2> <img src="img/logo.png" height="50">Affinity</h2></a>
<hr>
<h2>Find a local group</h2>
<div class="row">
<form class="form form-inline">
<div class="form-group col-md-6 col-md-offset-4">
<input id="searchTextField" placeholder="Enter a city" type="text" class="form-control text-center" />
<input id="city" name="city" type="hidden">
<input id="state" name="state" type="hidden">
<input id="latitude" name="latitude" type="hidden">
<input id="longitude" name="longitude" type="hidden">
<button class="btn btn-primary text-center">Find a Group</button>
</div>
</form>
</div>
<hr>
<div id="content"></div>
<script id="groups-search-template" type="text/x-handlebars-template">
<h3>Groups near you</h3>
{{#each groups.0.nearby_groups}}
<h4><a href="{{url}}">{{name}}</a></h4>
{{distance}} miles away ({{city}})
{{/each}}
</script>
</div>
</body>
</html>