我正在使用Ruby on Rails 5和Material-Kit(Material Kit是一个Bootstrap UI工具包,其新设计灵感来自Google的材料设计)。当我重新加载登录页面时,它完美运行: Photo sign in page: realoading the page
但是当我到达那里导航而不是对网页进行编码时,它就是这样的: Photo sign in page: not realoding the page
复选框消失不是唯一的区别。如果没有重新加载页面,浮动标签将无法正常工作。
这是“app / views / devise / sessions / new.haml”中的代码:
.row.top-padding.center-content.height-100.width-100
.col-xs-10.col-sm-6.col-lg-4.no-padding
.box.center-xs
%h1 Log in
= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
= devise_error_messages!
.form-group.label-floating.text-left
= f.label :email, class:"control-label"
= f.email_field :email, autofocus: true, class:"form-control"
.form-group.label-floating.text-left
= f.label :password, class:"control-label"
= f.password_field :password, autofocus: true, class:"form-control"
-if devise_mapping.rememberable?
.checkbox.text-left
%label
= f.check_box :remember_me
= "Remember me"
.top-space.width-100
.row.text-left.middle-xs.center-xs.width-100
.col-xs-12.col-md-6
=f.submit "Log in", class:"btn btn-primary"
.width-100
.row.text-left.middle-xs.center-xs.width-100
.col-xs-12.col-md-6.top-space
=link_to "Sign in with Google", user_google_oauth2_omniauth_authorize_path, class: "btn-oauth-google btn no-margin"
.col-xs-12.col-md-6.top-space
=link_to "Sign in with Facebook", user_facebook_omniauth_authorize_path, class: "btn-oauth-facebook btn no-margin"
.top-space
=render "devise/shared/links"
.footer-margin-bottom
我在互联网上搜索过,我所看到的只是使用Material Design lite(不是我的情况)的人来包含这种代码的和平(我已经尝试过,以防万一它也适用于我的情况,但它没有):
document.addEventListener('turbolinks:load', function() {
componentHandler.upgradeDom();
});
谢谢! :)