1

<div>aを使用して a の後にテキストを挿入できましたDeface::Overrideが、テキストの代わりに QR コードの画像を追加したいと考えています。このコードを画像で機能するように変更するにはどうすればよいでしょうか? テキストを正常に追加した元のコードが最初のブロックで、画像を追加しようとする 2 番目のコードが 2 番目のブロックです。どうもありがとうございました!

動作する最初のものは次のとおりです。

Deface::Override.new(:virtual_path  => "spree/home/index",
                 :replace => "[data-hook='homepage_products']",
                 :name          => "homepage_contents",
                 :text          => "La registration, c'est le futur!")

そして、これが機能しない2番目です:

Deface::Override.new(:virtual_path  => "spree/checkout/_address",
                 :insert_after => "[data-hook = 'shipping_fieldset_wrapper']",
                 :name          => "add_qr_code",
                 :text          => image_tag("assets/images/qr_code.png"))
4

1 に答える 1

1

動作させるにはerbタグ<%= ... %>を提供する必要があると思います。そうしないと、生のHTMLが追加されます。

試す:

Deface::Override.new(:virtual_path  => "spree/checkout/_address",
                 :insert_after => "[data-hook = 'shipping_fieldset_wrapper']",
                 :name          => "add_qr_code",
                 :text          => "<%= image_tag('assets/images/qr_code.png') %>")

例についてはhttps://github.com/spree/deface

于 2016-06-07T01:12:50.600 に答える