aerison / TIL

TodayILearned
HomePage
0 stars 0 forks source link

map api #2

Open aerison opened 6 years ago

aerison commented 6 years ago

var data = [ {name: "아리차이", address: "서울특별시 관악구 신림동길 4", link: "https://store.naver.com/restaurants/detail?id=11704746", x: 126.9282765, y: 37.4876462}, {name: "한우등촌골", address: "서울특별시 강서구 등촌로 201", link: "https://store.naver.com/restaurants/detail?id=35966485", x:126.86273, y: 37.5476847}, {name: "수유부추곱창", address: "서울특별시 강북구 도봉로87길 26-21", link: "https://store.naver.com/restaurants/detail?id=37111836", x: 127.0247721, y: 37.6393168}, {name: "강천민물장어", address:"서울특별시 강동구 올림픽로 834 한강시티라이프", link: "https://store.naver.com/restaurants/detail?id=18905396", x: 127.1297937, y: 37.5553916 } ];

/*

이부분 채워서 코드 완성하기!

var contentString = [ '

', '

'+restaurant.name+'

', '

'+restaurant.address+'

', '알아보기' ].join('')

*/

function getClickHandler(seq) { return function(e) { var marker = markers[seq], infoWindow = infoWindows[seq];

    if (infoWindow.getMap()) { //정보가 맵에 표시되어 있는지
        infoWindow.close();
    } else {
        infoWindow.open(map, marker);
    }
}

}

for (var i=0, ii=markers.length; i<ii; i++) { N.Event.addListener(markers[i], 'click', getClickHandler(i)); }

aerison commented 6 years ago

rails g model School name:string address:string lng:float lat:float 후 seeds.rb 파일수정

require 'csv' CSV.foreach(Rails.root.join('school.csv'),headers:true) do |row| School.create! row.to_hash end

rake db:migrate rake db:seed

aerison commented 6 years ago

이거 ajax_practice에 연결된 것들임