我如何使用污损来更改带有 erb 标签的 html
how can i use deface to change html that has tags with erb
我是 spree 的新手,我试图在结账时通过使用污损删除一些字段来更改地址表。现在我将使用哪个选择器,因为 id 值是 erb 格式。这是来自 partial
形式的代码示例
<% address_id = address_type.chars.first %>
<p class="form-group" id=<%="#{address_id}zipcode" %>>
<%= form.label :zipcode, Spree.t(:zip) %><% if address.require_zipcode? %><span class="required">*</span><br /><% end %>
<%= form.text_field :zipcode, :class => "form-control #{'required' if address.require_zipcode?}" %>
</p>
<p class="form-group" id=<%="#{address_id}phone" %>>
<%= form.label :phone, Spree.t(:phone) %><% if address.require_phone? %><span class="required">*</span><br /><% end %>
<%= form.phone_field :phone, :class => "form-control #{'required' if address.require_phone?}" %>
</p>
<% if Spree::Config[:alternative_shipping_phone] %>
<p class="form-group" id=<%="#{address_id}altphone" %>>
<%= form.label :alternative_phone, Spree.t(:alternative_phone) %><br />
<%= form.phone_field :alternative_phone, :class => 'form-control' %>
</p>
以此为例
Deface::Override.new(
:virtual_path => "spree/address/_form",
:name => "remove_phone",
:remove => "data-erb-id=<%= \"address_type.chars.firstphone\" %>",
)
但是在 运行 rake deface:get_result[spree/address/_form]
之后我得到了错误:
Nokogiri::CSS::SyntaxError: 在“[#]”之后出现意外的“=”
这是我第一次使用 spree,但是来自 spree 网站的文档似乎没有涵盖 html 带有 erb
的标签
在你的脸上试试这个
Deface::Override.new(:virtual_path => "spree/address/_form",
:remove => "p[data-erb-id='<%=\"\#{address_id}phone\" %>']",
:name => "remove_phone")
我是 spree 的新手,我试图在结账时通过使用污损删除一些字段来更改地址表。现在我将使用哪个选择器,因为 id 值是 erb 格式。这是来自 partial
形式的代码示例 <% address_id = address_type.chars.first %>
<p class="form-group" id=<%="#{address_id}zipcode" %>>
<%= form.label :zipcode, Spree.t(:zip) %><% if address.require_zipcode? %><span class="required">*</span><br /><% end %>
<%= form.text_field :zipcode, :class => "form-control #{'required' if address.require_zipcode?}" %>
</p>
<p class="form-group" id=<%="#{address_id}phone" %>>
<%= form.label :phone, Spree.t(:phone) %><% if address.require_phone? %><span class="required">*</span><br /><% end %>
<%= form.phone_field :phone, :class => "form-control #{'required' if address.require_phone?}" %>
</p>
<% if Spree::Config[:alternative_shipping_phone] %>
<p class="form-group" id=<%="#{address_id}altphone" %>>
<%= form.label :alternative_phone, Spree.t(:alternative_phone) %><br />
<%= form.phone_field :alternative_phone, :class => 'form-control' %>
</p>
以此为例
Deface::Override.new(
:virtual_path => "spree/address/_form",
:name => "remove_phone",
:remove => "data-erb-id=<%= \"address_type.chars.firstphone\" %>",
)
但是在 运行 rake deface:get_result[spree/address/_form]
之后我得到了错误:
Nokogiri::CSS::SyntaxError: 在“[#]”之后出现意外的“=”
这是我第一次使用 spree,但是来自 spree 网站的文档似乎没有涵盖 html 带有 erb
的标签在你的脸上试试这个
Deface::Override.new(:virtual_path => "spree/address/_form",
:remove => "p[data-erb-id='<%=\"\#{address_id}phone\" %>']",
:name => "remove_phone")