我正在使用Ransack构建其中包含一些过滤器的Rails应用程序,但我不希望用户能够使用下图所示的卡来搜索属性。当他们在我的数据库中选择一张将返回的卡时。
我当前的购物袋表格
<%= search_form_for @q, html: {autocomplete: 'off'} do |f| %>
<div class="container">
<div class="row">
<!--APARTMENT CARD-->
<div class="col l6 s6">
<div class="card-panel hoverable b-radius5px">
<img style="width:60px;" class="center" src="https://res.cloudinary.com/craftwebs/image/upload/v1584137944/condominium_pltgkr.svg" alt="">
<span class="center blue-grey-text text-lighten-2" style="margin-left: -15px;">Apartment</span>
</div>
</div>
<!--HOUSE CARD-->
<div class="col l6 s6">
<div class="card-panel hoverable z-depth-1 b-radius5px">
<img style="width:60px;" class="center" src="https://res.cloudinary.com/craftwebs/image/upload/v1584138119/real-estate_mugxx7.svg" alt="">
<span class="center blue-grey-text text-lighten-2">House</span>
</div>
</div>
<div class="center">
<%= f.submit "Search", class:" waves-effect blue-kafasa-bn waves-light btn b-radius15px" %>
</div>
现在,我无法搜索这些属性的唯一方法是通过选择:
<div class="col l6 m6 s12">
<%= f.select(:propertytype_eq, options_for_select(['Apartment', 'Office', 'House' ]), {:include_blank => 'Pick a property'} ) %>
</div>
这是当我使用select在应用中搜索特定属性时它在日志中的显示方式
Parameters: {"utf8"=>"✓", "q"=>{"price_gteq"=>"", "price_lteq"=>"", "propertytype_eq"=>"Apartment"}, "commit"=>"Search"}
[如何使用户使用卡片而不是选择卡片来搜索财产?我需要修改实现复选框吗?
我正在使用Ransack构建其中包含一些过滤器的Rails应用程序,但我不希望用户能够使用下图所示的卡来搜索属性。当他们在我的数据库中选择一张卡片时,......>
您是否尝试过为卡片使用onclick功能?您可以添加一个onclick事件,该事件可以启动导航或为所需选项设置标志/变量。