Skip to content

Commit 8ec816c

Browse files
committed
merged
2 parents 7878f2d + e76c488 commit 8ec816c

File tree

3 files changed

+110
-16
lines changed

3 files changed

+110
-16
lines changed

OddJobb/www/js/controllers/jobpost.js

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
myApp.onPageInit('post', function (page) {
2-
/*
3-
1. Do AJAX call to get post based on postID
4-
2. Generate post data!
5-
*/
2+
console.log('posted!');
63

74
const testPost = {
85
season: 'img/green.jpg',
96
title: 'Grass Mowing Required',
107
date: 'January 21, 2015',
118
text: 'Guys please help my grass is growing too large',
9+
postalCode: 'l1n4e5'
1210
}
13-
14-
const posts = [];
15-
posts.push(testPost);
1611

17-
console.log(posts);
12+
const posts = [];
1813

14+
posts.push(testPost);
1915

20-
const myList = myApp.virtualList('.virtual-list.cardslist', {
16+
const myList = myApp.virtualList('.single-card', {
2117
items: posts,
2218
template:
2319
'<div class="card" >' +
@@ -31,10 +27,20 @@ myApp.onPageInit('post', function (page) {
3127
' </div>' +
3228
' <div class="card-footer">' +
3329
' <a href="#" class="button button-big">Contact</a>' +
34-
' <a href="#" class="button button-big">Map</a>' +
30+
' <a href="post.html?postID=5" class="button button-big">Map</a>' +
3531
' </div>' +
3632
'</div >'
3733
});
34+
35+
36+
myApp.params.swipePanel = false;
37+
map = new GMaps({
38+
div: '#map',
39+
lat: -12.043333,
40+
lng: -77.028333
41+
});
42+
43+
address(testPost.postalCode);
3844
})
3945

4046
myApp.onPageInit('postList', function (page) {
@@ -105,8 +111,25 @@ myApp.onPageInit('postList', function (page) {
105111
' </div>' +
106112
' <div class="card-footer">' +
107113
' <a href="#" class="button button-big">Contact</a>' +
108-
' <a href="#" class="button button-big">Map</a>' +
114+
' <a href="post.html?postID=5" class="button button-big">Map</a>' +
109115
' </div>' +
110116
'</div >'
111117
});
112-
})
118+
})
119+
120+
121+
function address(adr) {
122+
GMaps.geocode({
123+
address: adr,
124+
callback: function (results, status) {
125+
if (status == 'OK') {
126+
var latlng = results[0].geometry.location;
127+
map.setCenter(latlng.lat(), latlng.lng());
128+
map.addMarker({
129+
lat: latlng.lat(),
130+
lng: latlng.lng()
131+
});
132+
}
133+
}
134+
});
135+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
myApp.onPageInit('post', function (page) {
2+
/*
3+
1. Do AJAX call to get post based on postID
4+
2. Generate post data!
5+
*/
6+
7+
myApp.params.swipePanel = false;
8+
map = new GMaps({
9+
div: '#map',
10+
lat: -12.043333,
11+
lng: -77.028333
12+
});
13+
14+
const testPost = {
15+
season: 'img/green.jpg',
16+
title: 'Grass Mowing Required',
17+
date: 'January 21, 2015',
18+
text: 'Guys please help my grass is growing too large',
19+
postalCode: 'L1G6N4'
20+
}
21+
22+
const posts = [];
23+
24+
if (page.query) {
25+
console.log(page.query);
26+
posts.push(testPost);
27+
28+
29+
} else {
30+
posts.push(testPost);
31+
posts.push(testPost);
32+
posts.push(testPost);
33+
}
34+
35+
address(testPost.postalCode);
36+
37+
const myList = myApp.virtualList('.list-block.virtual-list.cardslist', {
38+
items: posts,
39+
template:
40+
'<div class="card demo-card-header-pic" >' +
41+
' <div style="background-image:url(img/green.jpg)" valign="bottom" class="card-header color-white no-border"></div>' +
42+
' <div class="card-content">' +
43+
' <div class="card-content-inner">' +
44+
' <h1>Grass Mowing Required</h1>' +
45+
' <p class="color-gray">Posted on January 21, 2015</p>' +
46+
' <p>Quisque eget vestibulum nulla...</p>' +
47+
' </div>' +
48+
' </div>' +
49+
' <div class="card-footer">' +
50+
' <a href="#" class="button button-big">Contact</a>' +
51+
' <a href="#" class="button button-big">Map</a>' +
52+
' </div>' +
53+
'</div >'
54+
});
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: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
<div class="pages">
1818
<div data-page="post" class="page">
1919
<div class="page-content">
20-
<div class="content-block-title">Posting Details</div>
21-
22-
<div class="virtual-list cardslist">
23-
<!-- keep it empty -->
20+
<div class="content-block-title">Post Details</div>
21+
<div id="map"></div>
22+
<div class="single-card">
2423
</div>
2524
</div>
2625
</div>

0 commit comments

Comments
 (0)