Skip to content

Commit e76c488

Browse files
authored
Merge pull request #5 from AGWeb18/ZacharyBrandLatest
Map + Post
2 parents 00f70b2 + 3280f6f commit e76c488

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

OddJobb/www/js/controllers/post_card.js

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@ myApp.onPageInit('post', function (page) {
44
2. Generate post data!
55
*/
66

7-
7+
myApp.params.swipePanel = false;
8+
map = new GMaps({
9+
div: '#map',
10+
lat: -12.043333,
11+
lng: -77.028333
12+
});
13+
814
const testPost = {
915
season: 'img/green.jpg',
1016
title: 'Grass Mowing Required',
1117
date: 'January 21, 2015',
12-
text: 'Guys please help my grass is growing too large'
18+
text: 'Guys please help my grass is growing too large',
19+
postalCode: 'L1G6N4'
1320
}
1421

1522
const posts = [];
@@ -25,7 +32,8 @@ myApp.onPageInit('post', function (page) {
2532
posts.push(testPost);
2633
}
2734

28-
35+
address(testPost.postalCode);
36+
2937
const myList = myApp.virtualList('.list-block.virtual-list.cardslist', {
3038
items: posts,
3139
template:
@@ -44,4 +52,21 @@ myApp.onPageInit('post', function (page) {
4452
' </div>' +
4553
'</div >'
4654
});
47-
})
55+
})
56+
57+
function address(adr){
58+
GMaps.geocode({
59+
60+
address: adr,
61+
callback: function(results, status) {
62+
if (status == 'OK') {
63+
var latlng = results[0].geometry.location;
64+
map.setCenter(latlng.lat(), latlng.lng());
65+
map.addMarker({
66+
lat: latlng.lat(),
67+
lng: latlng.lng()
68+
});
69+
}
70+
}
71+
});
72+
}

OddJobb/www/post.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
<div data-page="post" class="page">
1919
<div class="page-content">
2020
<div class="content-block-title">Posting Details</div>
21-
21+
<div id="map">
22+
</div>
2223
<div class="list-block virtual-list cardslist">
2324
<!-- keep it empty -->
2425
</div>

0 commit comments

Comments
 (0)