0

So in my code I have the following on line 14:

app/views/spree/shared/_search.html.erb

<%= submit_tag Spree.t(:search), name: nil, class: "btn btn-danger" %>

and in:

app/overrides/edit_header.rb

Deface::Override.new(
  :virtual_path   => "spree/shared/_search",
  :name           => "set_button_to_green",
  :set_attributes => "erb[loud]:contains('submit_tag')",
  :attributes     => { :class => "btn btn-info" }
)

and while it sorta works, here are the results:

Before:

enter image description here

After:

enter image description here

I have spent several hours today trying to troubleshoot this issue, and I haven't found any answers that specifically address my issue. At the moment I have a work-around, but understanding this issue would really speed up my process.

Okomikeruko
  • 1,123
  • 10
  • 22

1 Answers1

0

Okay. I've got it working.

While I was using the :set_attributes and :attributes settings, the output ended up producing the following in the HTML output:

<erb loud class="btn btn-info">
  submit_tag Spree.t(:search), name: nil, class: "btn btn-danger" %&gt;
</erb>

What actually worked is the following:

Deface::Override.new(
  :virtual_path => "spree/shared/_search",
  :name => "set_button_to_green",
  :replace => "erb[loud]:contains('submit_tag')",
  :text => "<%= submit_tag Spree.t(:search), name: nil, class: 'btn btn-info' %>"
)

So using :replace and :text is what I needed rather than just setting the attributes.

Okomikeruko
  • 1,123
  • 10
  • 22