私は Spree コマースを学習しており、Deface を使用してランディング ページをオーバーライドしようとしています。オーバーライドする必要があるファイルは次のとおりです: spree/frontend/app/views/spree/home/index.html.erb
<% content_for :sidebar do %>
<div data-hook="homepage_sidebar_navigation">
<%= render :partial => 'spree/shared/taxonomies' %>
</div>
<% end %>
<div data-hook="homepage_products">
<% cache(cache_key_for_products) do %>
<%= render :partial => 'spree/shared/products', :locals => { :products => @products } %>
<% end %>
</div>
パーシャルを作成しました: app/views/home/_landing.html.erb
そして、以下に示すようにapp/override/landing.rbから呼び出しています。
Deface::Override.new(virtual_path: 'spree/home/index',
replace: '[data-hook="homepage_products"]',
name: 'landing-products',
partial: 'home/landing')
Deface::Override.new(virtual_path: 'spree/home/index',
name: 'landing-sidebar',
remove: '[data-hook="homepage_sidebar_navigation"]')
問題は、それがspree/frontend/app/views/spree/layouts/spree_application.html.erb 内の container>row>col-md-12 に挿入され、navbar の直後でコンテナの外側にあることです。Spree のベスト プラクティスを使用して (他のすべてのビューを変更することなく) 着陸を完全にオーバーライドするにはどうすればよいですか?
<!--[if lt IE 7 ]> <html class="ie ie6" lang="<%= I18n.locale %>"> <![endif]-->
<!--[if IE 7 ]> <html class="ie ie7" lang="<%= I18n.locale %>"> <![endif]-->
<!--[if IE 8 ]> <html class="ie ie8" lang="<%= I18n.locale %>"> <![endif]-->
<!--[if IE 9 ]> <html class="ie ie9" lang="<%= I18n.locale %>"> <![endif]-->
<!--[if gt IE 9]><!--><html lang="<%= I18n.locale %>"><!--<![endif]-->
<head data-hook="inside_head">
<%= render partial: 'spree/shared/head' %>
</head>
<body class="<%= body_class %>" id="<%= @body_id || 'default' %>" data-hook="body">
<%= render partial: 'spree/shared/google_analytics.js' %>
<%= render partial: 'spree/shared/header' %>
<div class="container">
<div class="row" data-hook>
<%= breadcrumbs(@taxon) %>
<%= render partial: 'spree/shared/sidebar' if content_for? :sidebar %>
<div id="content" class="<%= !content_for?(:sidebar) ? "col-sm-12" : "col-sm-8 col-md-9" %>" data-hook>
<%= flash_messages %>
<%= yield %>
</div>
<%= yield :templates %>
</div>
</div>
</body>
</html>