使用deface渲染部分并添加对象,变量或本地

时间:2022-11-25 20:14:29

I am using Deface to override a spree view and I need to render a variable.

我使用Deface来覆盖spree视图,我需要渲染一个变量。

Like this: <%= render 'image_tab_partial', :type => 'vintage'%>

像这样:<%= render'image_tab_partial',:type =>'vintage'%>

Using Deface:

Deface::Override.new(:virtual_path => "spree/admin/products/index", 
                     :name => "example-3",
                     :insert_after => "div#pdf_file_name", 
                     :partial => "image_tab_partial")

I am able to render this partial but how to render :type => 'vintage' with Deface?

我能够呈现这个局部但是如何呈现:使用Deface的type =>'vintage'?

1 个解决方案

#1


3  

You can do the following:

您可以执行以下操作:

Deface::Override.new(:virtual_path => "spree/admin/products/index", 
                     :name => "example-3",
                     :insert_after => "div#pdf_file_name", 
                     :text => "<%= render 'image_tab_partial', :type => 'vinatge'%>")

You could also render a partial which renders your image tab partial with the type specified.

您还可以渲染部分,使用指定的类型渲染图像选项卡。

#1


3  

You can do the following:

您可以执行以下操作:

Deface::Override.new(:virtual_path => "spree/admin/products/index", 
                     :name => "example-3",
                     :insert_after => "div#pdf_file_name", 
                     :text => "<%= render 'image_tab_partial', :type => 'vinatge'%>")

You could also render a partial which renders your image tab partial with the type specified.

您还可以渲染部分,使用指定的类型渲染图像选项卡。