0

defaceを使用してログインページを上書きしようとしていますが、次のコードを使用してログイン部分にアクセスできません

Deface::Override.new(
:virtual_path => 'spree/shared/_login',
:name => 'override login',
:replace=> "body",
:text=> "<body><h1>loin<h1></body>",
:disabled => false
)

これは何らかの理由で機能しないようですが、サーバー出力で次のように表示されます: Deface: 1 overrides found for 'spree/shared/_login' Deface: 'override login' Matched 0 times with 'body' .rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spree_auth_devise-3.1.0/lib/views/frontend/spree/shared/_login.html.erb (50.3ms) レンダリング /home/ user/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spree_auth_devise-3.1.0/lib/views/frontend/spree/user_sessions/new.html.erb 内 spree/layouts/spree_application (77.4ms)

ページで css の複数のセレクターを試してみましたが、結果はありませんでした。ログイン部分が「spree_auth_devise-3.1.0」サブディレクトリにあることに気付きました。ログインページをまくるか、その部分の正しいパスを参照する方法は?

4

1 に答える 1

0

すべてのボディを置き換えたい場合は、パーシャルをオーバーライドし、Deface を使用しないことをお勧めします。それは素晴らしいツールですが、大きな変化をしたいときはそうではありません. エラーは、部分的にボディが見つからなかったことを意味し、ボディがないため、それは真です。のみ使用できます

<%= form_for Spree::User.new, :as => :spree_user, :url => spree.create_new_session_path do |f| %>
  <div id="password-credentials">
    <p>
      <%= f.label :email, Spree.t(:email) %>
      <%= f.email_field :email, :class => 'form-control', :tabindex => 1, autofocus: true %>
    </p>
    <p>
      <%= f.label :password, Spree.t(:password) %>
      <%= f.password_field :password, :class => 'form-control', :tabindex => 2 %>
    </p>
  </div>
  <p>
    <%= f.check_box :remember_me, :tabindex => 3 %>
    <%= f.label :remember_me, Spree.t(:remember_me) %>
  </p>

  <p><%= f.submit Spree.t(:login), :class => 'btn btn-lg btn-success btn-block', :tabindex => 4 %></p>
<% end %>
于 2016-12-07T10:50:05.753 に答える