0

我正在尝试使用 Deface 覆盖某些视图,但在控制台中出现此错误和警告:

Deface: 1 overrides found for 'spree/shared/_header'
Deface: 'header_background' matched 1 times with 'div#spree-header'
Deface: [WARNING] No :original defined for 'header_background', you should change its definition to include:
 :original => '870f2cc85da3717b7c721a3e99245cf65b607a19' 
Deface: [WARNING] Circular sequence dependency includes override named: 'auth_shared_login_bar' on 'spree/shared/_nav_bar'.
Deface: 2 overrides found for 'spree/shared/_nav_bar'
Deface: 'main_menu' matched 1 times with 'nav#top-nav-bar'
Deface: [WARNING] No :original defined for 'main_menu', you should change its definition to include:
 :original => 'a35cdc6247d04a90fc0aefc58f068ae2b3923eab' 
Deface: 'auth_shared_login_bar' matched 1 times with 'li#search-bar'
Deface: [ERROR] The original source for 'auth_shared_login_bar' has changed, this override should be reviewed to ensure it's still valid.
Deface: [WARNING] Circular sequence dependency includes override named: 'auth_shared_login_bar' on 'spree/shared/_nav_bar'.
Deface: [WARNING] Circular sequence dependency includes override named: 'auth_shared_login_bar' on 'spree/shared/_nav_bar'.
Deface: 1 overrides found for 'spree/shared/_main_nav_bar'
Deface: 'home-link' matched 1 times with 'li#home-link'
Deface: [WARNING] No :original defined for 'home-link', you should change its definition to include:
 :original => '79d342a6fd7281d8499d3a5ee5480f416f733e98'

这些是我的覆盖文件:

update_ordes.rb

Deface::Override.new(:virtual_path =>"spree/orders/edit",
                     :name => "continue_shopping",
                     :replace => "erb[loud]:contains('link_to t(:continue_shopping), products_path')",
                     :text => "<%= link_to t(:continue_shopping), products_path, :class => 'btn btn-primary' %>")

auth_login_bar.rb

Deface::Override.new(:virtual_path => "spree/shared/_nav_bar",
                     :name => "auth_shared_login_bar",
                     :insert_before => "li#search-bar",
                     :partial => "spree/shared/login_bar",
                     :disabled => false, 
                     :original => 'eb3fa668cd98b6a1c75c36420ef1b238a1fc55ac',
                     :sequence => {:after => "auth_shared_login_bar"})

update_header.rb

Deface::Override.new(:virtual_path => "spree/shared/_header",
                 :name => "header_background",
                 :replace => "div#spree-header",
                 :text => '<div class="container">
                 <header id="header" class="row" data-hook>

  <%= render :partial => "spree/shared/nav_bar" %>
  <%= render :partial => "spree/shared/main_nav_bar" if store_menu? %>
</header></div>')

update_menu.rb

Deface::Override.new(:virtual_path => "spree/shared/_main_nav_bar",
                 :name => "home-link",
                 :remove => "li#home-link")

Deface::Override.new(:virtual_path =>"spree/shared/_nav_bar",
                     :name => "main_menu",
                     :replace =>"nav#top-nav-bar",
                     :text => '<nav id="top-nav-bar" class="navbar navbar-inverse navbar-fixed-top" role="navigation">
  <div class="container">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <div id="logo"><%= logo %></div>
    </div>
    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav navbar-right"  data-hook>


    <li id="search-bar" data-hook>
      <%= render :partial => "spree/shared/search" %>
    </li>
      </ul>
    </div>
    <!-- /.navbar-collapse -->
  </div>
  <!-- /.container -->
</nav>'
)

我还添加了 gem 'spree_bootstrap_frontend' 我没有为 spree/orders/edit 文件完成更改

我应该如何解决这个问题?

4

1 回答 1

0

Original

没有original警告正是他们所说的。您需要将original选项添加到update_header.rb文件中。此外,您的original哈希值auth_shared_login_bar已经过时,因此您需要更新它,或者更改为您正在使用的确切原始块。

Sequence

当应用不同的覆盖并且顺序很重要时,序列选项用于了解覆盖的顺序。但是,在 中auth_shared_login_bar,您将序列引用提供给自身,从而导致循环依赖。您应该删除它或提供任何其他覆盖这取决于(例如:sequence => 'main_menu'

于 2015-03-11T06:21:43.387 回答