2016-06-13 12 views
1

アクティブAdminでエラーが定義されていません: - から全てのソースを含む
map.js Gmap4rails GMAPは、ここでのコードを定義していないエラーGMAPを取得することで、私は私のActive_adminにgmap4rails APIを統合したい

handler = Gmaps.build('Google'); 
handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){ 
    markers = handler.addMarkers([ 
    { 
     "lat": 0, 
     "lng": 0, 
     "picture": { 
     "url": "http://people.mozilla.com/~faaborg/files/shiretoko/firefoxIcon/firefox-32.png", 
     "width": 32, 
     "height": 32 
     }, 
     "infowindow": "hello!" 
    } 
    ]); 
    handler.bounds.extendWith(markers); 
    handler.fitMapToBounds(); 
    }); 

アプリケーションのレイアウトでGmaprrails application.js application.jsで資産を含む

Application.html.erb 


<!DOCTYPE html> 
<html> 
<head> 
    <title></title> 
          <script src="//maps.google.com/maps/api/js?v=3.23&key= AIzaSyDfo9bkA0O99tPFLgzv41p-nEiIa6qHOfY "></script> 
       <script src="//cdn.rawgit.com/mahnunchik/markerclustererplus/master/dist/markerclusterer.min.js"></script> 
       <script src='//cdn.rawgit.com/printercu/google-maps-utility-library-v3-read-only/master/infobox/src/infobox_packed.js' type='text/javascript'></script> 
       <!-- only if you need custom infoboxes --> 

       <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> 
         <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> 
          <%= stylesheet_link_tag 'gmaps4rails' %> 
          <%= gmaps({ 
            "map_options" => { "zoom" => 2, "auto_adjust" => false}, 
             "markers"  => { "data" => markers } })%> 
       <%= yield :javascripts %>  

    <%= csrf_meta_tags %> 
</head> 
<body> 

<%= yield %> 

</body> 
</html> 

//= require underscore 
//= require gmaps/google 
//= require jquery 
//= require jquery_ujs 
//= require turbolinks 
//= require underscore 
//= require_tree . 

_map.html.erb 

<div style='width: 800px;'> 
    <div id="map" style='width: 800px; height: 400px;'></div> 

admin /branch.rb 

    @branch = Branch.all 
     @hash = Gmaps4rails.build_markers(@branch) do |branch, marker| 
      marker.lat branch.lat 
     marker.lng branch.lng 
     end 
     render partial: 'active_admin/branches/map', locale:{hash: @hash} 
    end 
please help me out !!! 

答えて

0

私はあなたのアプリケーションのjsファイルをActive_admin.jsに置くべきだと思います。

関連する問題