【问题标题】:Solidus / Spree Override not workingSolidus / Spree Override 不起作用
【发布时间】:2015-12-20 20:03:48
【问题描述】:

我正在尝试更改主页产品列表。 所以我试图覆盖这个路径中的文件:

https://github.com/solidusio/solidus/blob/master/frontend/app/views/spree/shared/_products.html.erb

Deface::Override.new(:virtual_path => 'spree/shared/products',
                 :replace_contents => "li#product_",
                 :name => "product_new",
                 :text => "text")

然而,这段代码在主页上的变化绝对是 0。

此覆盖所在的文件名为 product_override.rb,位于 app/overrides 中

任何帮助将不胜感激。 谢谢

【问题讨论】:

    标签: ruby-on-rails ruby spree


    【解决方案1】:

    我已经用全新安装的 Solidus 测试了这段代码,它工作正常。 请注意,我在:virtual_path => 'spree/shared/_products' 的“产品”之前添加了一个下划线。另外,我将选择器更改为“li”。

    Deface::Override.new(:virtual_path => 'spree/shared/_products',
                 :insert_after => "li",
                 :name => "product_new",
                 :text => "Override is working")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-16
      相关资源
      最近更新 更多