私はgmaps4rails
自分のアプリケーションで 申請することができました
最初の方法
次のmap
ようなアクションが あります。
def map
@family = Family.all.to_gmaps4rails do |family,marker|
marker.infowindow render_to_string(:partial => "/layouts/info", :locals => { :family => family})
end
end
私の_info.html.erbで:
<h5><%=family.location%></h5>
<%=link_to "View Details","#myModal",class: "btn btn-success",data: {toggle: "modal"} %>
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel" style="color:#9D5641;margin-top:10px;">Family Details</h3>
<h5>Family ID : <%=family.famid%></h5>
</div>
<div class="modal-body">
<%= family.persons.count %>
<table class="table table-hover">
<tr>
<th>Name</th>
<th>Mobile No.</th>
<th>Photo</th>
</tr>
<% family.persons.each do |person| %>
<tr>
<td><%=person.name%></td>
<td><%=person.mobnum%></td>
<td><%=person.photo%></td>
</tr>
<%end%>
</table>
</div>
<div class="modal-footer">
<h5><%=link_to "Veiw Full Details", {controller: :managedb ,action: :details, famid: family.famid} %></h5>
</div>
</div>
ブートストラップのモーダルは正常にレンダリングされますが、不具合があります。次のようになります。
grey
モーダルはカラーレイヤーの上にあるはずです。
パーシャルでレンダリングしているためmodal
、これが起こっていると思いinfowindow
ます。そのため、css プロパティはinfowindow
. 通常どおり動作させるにはどうすればよいですかmodal
。
background-color
以下を追加することで、モーダルがアクティブになったときに取得した を 削除できます。
.modal-backdrop {背景: なし;}
私のcssファイルに。
しかし、**モーダルはそうではありませんclickable
。その中のリンクなどをクリックできません。これを修正するにはどうすればよいですか?
私が試した別の方法
マップアクション
def map
@family = Family.all.to_gmaps4rails do |family,marker|
@fam=family
marker.infowindow render_to_string(:partial => "/layouts/map", :locals => { :family => family})
end
end
_info.html.erb
<h5><%=family.location%></h5>
<%=link_to "View Details","#myModal",class: "btn btn-success",data: {toggle: "modal"} %>
map.html.erb
<div class="container">
<div class="row">
<%= gmaps4rails(@family) %>
<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel" style="color:#9D5641;margin-top:10px;">Family Details</h3>
<h5>Family ID : <%=@fam.famid%></h5>
</div>
<div class="modal-body">
<table class="table table-hover">
<tr>
<th>Name</th>
<th>Mobile No.</th>
<th>Photo</th>
</tr>
<% @fam.persons.each do |person| %>
<tr>
<td><%=person.name%></td>
<td><%=person.mobnum%></td>
<td><%=person.photo%></td>
</tr>
<%end%>
</table>
</div>
<div class="modal-footer">
<h5><%=link_to "Veiw Full Details", {controller: :managedb ,action: :details, famid: @fam.famid} %></h5>
</div>
</div>
</div>
適切にmodal
レンダリングされるようになりましたが、最後のfamily
in@fam
変数しかありません。
family id
モーダルのリンクから as パラメータを渡すにはどうすればよいですか?