0
我定製的東西默認設計new.html.erb在會話視圖,因此產生像添加HTML屬性導軌形式幫手
<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>
我添加了這行HTML代碼:HTML =>{:class => 'form-signin', :role => 'form'}
的代碼下面。
<%= 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" %>
我不知道接下來做什麼修改
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
所以產生這樣的:<input type="text" class="form-control" placeholder="Email address" required autofocus>
? 謝謝!