【发布时间】:2017-10-26 17:13:21
【问题描述】:
我有这个纤细的代码:
.search-wrapper
- if content_for?(:fulltext_search)
= yield(:fulltext_search)
- else
- placeholder = nil unless defined? placeholder
= form_tag collection_path, method: :get
.input-group style='margin-bottom: 0;'
= text_field_tag :term, params[:term], placeholder: placeholder || t(:search, default: 'search'), class: 'form-control'
.btn-group
button.btn.btn-search tabindex="-1" type='submit' title=t(:search, default: 'search')
i.fa.fa-search
我想转换为 erb 代码。我已经尝试了一些第一行:
<div class="search-wrapper">
<% if content_for(:fulltext_search) %>
<%= yield(:fulltext_search) %>
<% else %>
<% placeholder = nil unless defined? placeholder %>
<%= form_tag collection_path, method: :get %>
<% end %>
</div>
我正在挣扎的想法是。我不知道如何将此代码转换为erb:
= form_tag collection_path, method: :get
.input-group style='margin-bottom: 0;'
请告诉我如何转换上面的代码。
谢谢
【问题讨论】:
标签: ruby-on-rails erb slim-lang