Reputation: 3609
Have converted devise new session from erb to Haml but doens't work, this is the code:
%div.row.show-grid
%div.span8.offset7
%h1 Sign in
- form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
%div.clearfix
= f.label :email
%div.input
= f.email_field :email, :class => 'xlarge', :id => 'admin_email'
%div.clearfix
= f.label :password
%div.input
= f.password_field :password, :class => 'xlarge', :id => 'admin_password'
- if devise_mapping.rememberable?
%div = f.check_box :remember_me
= f.label :remember_me
%div = f.submit "Sign up"
and this is the originally erb code:
<div class="row show-grid">
<div class="span8 offset7">
<div class="page-header">
<h1>Sign in</h1>
</div>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<div class="clearfix">
<%= f.label :email %>
<div class="input">
<%= f.email_field :email, :class => 'xlarge', :id => 'admin_email' %>
</div>
</div>
<div class="clearfix">
<%= f.label :password %>
<div class="input">
<%= f.password_field :password, :class => 'xlarge', :id => 'admin_password' %>
</div>
</div>
<% if devise_mapping.rememberable? -%>
<div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
<% end -%>
<div><%= f.submit "Sign up" %></div>
<% end %>
Upvotes: 4
Views: 15037
Reputation: 12235
First, you can use .class
and #id
directly, they're a shortcut for %div.class
and %div#id
Second, this error is usually triggered in a "block" of code, as in:
- if cond
=# instr
or
- form_for(options) do |f|
=# instr
Giving us the error line would help. But I'd say you messed up with indentation in one of said code blocks.
EDIT
Oh I get it. You forgot to indent line 7, = f.label :email
. Also, %tag = code
won't work, you have to either nest it, or do it with %tag= code
Upvotes: 7