我正在尝试自定义此视图文件:https ://github.com/spree/spree/blob/v2.1.0/frontend/app/views/spree/checkout/registration.html.erb
这是代码:
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @user } %>
<h1><%= Spree.t(:registration) %></h1>
<div id="registration" data-hook>
<div id="account" class="columns alpha eight">
<!-- TODO: add partial with registration form -->
</div>
<% if Spree::Config[:allow_guest_checkout] %>
<div id="guest_checkout" data-hook class="columns omega eight">
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @order } %>
<h6><%= Spree.t(:guest_user_account) %></h6>
<%= form_for @order, :url => update_checkout_registration_path, :method => :put, :html => { :id => 'checkout_form_registration' } do |f| %>
<p>
<%= f.label :email, Spree.t(:email) %><br />
<%= f.email_field :email, :class => 'title' %>
</p>
<p><%= f.submit Spree.t(:continue), :class => 'button primary' %></p>
<% end %>
</div>
<% end %>
</div>
现有用户的登录表单最终(在浏览器中)代替了此评论:
<!-- TODO: add partial with registration form -->
当您关闭 javascript 时,情况仍然如此。我试图弄清楚它是如何到达那里的,以及如何自定义它。
更新:为了清楚起见,我知道如何修改视图,或者完全覆盖它们。事实上,一个表单出现在我遇到问题的 TODO 注释的位置。