【问题标题】:View overriding using Deface使用 Deface 覆盖视图
【发布时间】:2012-08-10 03:21:36
【问题描述】:

我正在尝试在 Spree 产品页面的展示页面上插入文本。

我的 app/overrides/show_new.html.erb 如下:

Deface::Override.new(:virtual_path  => "spree/products/show",
                 :insert_after => "[data-hook='product_show']",
                 :text          => "<p>This is overriding......</p>",
                 :name          => "show_new",
                 :disabled      => false) 

但是,视图没有被覆盖。我错过了什么吗?

【问题讨论】:

    标签: spree


    【解决方案1】:

    您必须重新启动应用才能首先注册覆盖。

    否则,这似乎是正确的(假设您的代码在 app/overrides/something.rb 中)

    如果您不是最新版本,请注意,某些视图 HTML 已损坏并且损坏。

    https://github.com/spree/spree/issues/1056(我上周遇到了这个问题)

    【讨论】:

    • 您不必为最新版本的 Deface 执行此操作,并且损坏的视图现在已在最新版本的 Spree 中得到修复,该最新版本正在通过候选发布状态。
    • 感谢 j15e!但就我而言,这是文件类型的问题。我使用 .erb 模板而不是 .rb 文件进行覆盖。
    猜你喜欢
    • 2015-02-04
    • 1970-01-01
    • 2013-12-31
    • 2017-04-18
    • 1970-01-01
    • 2013-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多