1

私は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レンダリングされるようになりましたが、最後のfamilyin@fam変数しかありません。

family idモーダルのリンクから as パラメータを渡すにはどうすればよいですか?

4

1 に答える 1

0

最後に、最初の方法でそれを行いました。
のいくつかの CSS プロパティを変更しましたmodal

.modal-backdrop {background: none;z-index:-1;}  

#myModal {z-index:1;}  

これで、モーダルのすべての要素が通常のブートストラップ モーダルのようにクリック可能になりました。

于 2013-09-26T13:54:38.240 に答える