如何为局部创建地图图标?
我有一个记录列表,显示为屏幕一侧的部分内容,可以进行过滤。在另一边,我有一张手绘地图,它是一个带有背景图像的 div。如何为地图上的每条记录添加一个图标,该图标仅在显示部分记录时显示?
索引页面如下所示:
<div class="map_container">
</div>
<div class="filter_options_container">
filter form stuff is here
</div>
<div class="venue_partials_container">
<%= render :partial => 'venue', :collection => @venues %>
<div class="clearall"></div>
<%= will_paginate @venues %>
<div class="venue_partial_button">
<%= link_to 'add a new venue', new_venue_path %>
</div>
</div>
<div class="clearall"></div>
感谢您的帮助。
I have a list of records being displayed as partials down one side of the screen which can be filtered. And on the other side I have a hand drawn map which is a div with a background image. How can I have an icon for each record on the map which is only displayed when the records partial is shown?
Index page looks like this:
<div class="map_container">
</div>
<div class="filter_options_container">
filter form stuff is here
</div>
<div class="venue_partials_container">
<%= render :partial => 'venue', :collection => @venues %>
<div class="clearall"></div>
<%= will_paginate @venues %>
<div class="venue_partial_button">
<%= link_to 'add a new venue', new_venue_path %>
</div>
</div>
<div class="clearall"></div>
Thanks for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要向场地对象添加一些方法或以某种方式更改渲染方法...好吧,只需在每个场地输出一些 javascript 数据,如下所示:
然后添加一个函数,它将迭代该数据数组:
以及一些css之类的
如果你想要以更优雅的方式...我忘记了我所知道的关于Ruby的一切:-D 是你为你的问题添加了
javascript
标签;-)You need to add some method to venue object or change render method, in some way... well, just output some javascript data with each venue like next:
and after that add a function, which will iterate through that data array:
and some css like
If you want it in more elegant way... I forget everything I knew about Ruby :-D And it was you, who put
javascript
tag for your question ;-)