我正在使用Ruby on Rails和bootstrap开发一个应用程序.我正在使用Devise gem进行身份验证系统.我生成了设计视图,但我不喜欢使用页面/视图进行登录/注册.相反,我得到了一个我正在使用的弹出模式/形式.现在我的登录表单如下所示:
<div class="form loginBox">
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<%= f.email_field :email, :class => "form-control", :placeholder => "Email" %>
<%= f.password_field :password, :class => "form-control", :placeholder => "Password", autocomplete: "off" %>
<% if devise_mapping.rememberable? -%>
<%= f.check_box :remember_me, :style => "margin-top:20px;margin-bottom:20px;" %>
<%= f.label :remember_me, :style => "margin-top:20px;margin-bottom:20px;" %>
<% end -%>
<%= f.submit "Sign In", :class => "btn btn-default btn-login" %>
<% end %>
</div>
Run Code Online (Sandbox Code Playgroud)
我把它放在应用程序帮助器中:
module ApplicationHelper
def …Run Code Online (Sandbox Code Playgroud)