I am customize thing default Devise new.html.erb in Session View so it generate Html code like
<form class="form-signin" role="form">
<h2 class="form-signin-heading">Please sign in</h2>
<input type="text" class="form-control" placeholder="Email address" required autofocus>
<input type="password" class="form-control" placeholder="Password" required>
<label class="checkbox">
<input type="checkbox" value="remember-me"> Remember me
</label>
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
</form>
I have added the line :html => {:class => 'form-signin', :role => 'form'}
to the code below.
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name),
:html => {:class => 'form-signin', :role => 'form'}) do |f| %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.label :password %><br />
<%= f.password_field :password %></div>
<% if devise_mapping.rememberable? -%>
<div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
<% end -%>
<div><%= f.submit "Sign in" %></div>
<% end %>
<%= render "devise/shared/links" %>
I am not sure what to do next to modify
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
so it generates this: <input type="text" class="form-control" placeholder="Email address" required autofocus>
?? Thank you!
<%= f.text_field :email, placeholder: "Email address",
required: true, autofocus: true %>
Should work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.