File tree Expand file tree Collapse file tree 2 files changed +31
-5
lines changed Expand file tree Collapse file tree 2 files changed +31
-5
lines changed Original file line number Diff line number Diff 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+ }
Original file line number Diff line number Diff line change 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 >
You can’t perform that action at this time.
0 commit comments