I'm a newbie and I can't for the life of me convert this view to haml:

<%= javascript_include_tag :defaults %>
<h1>Listing users</h1>

<table cellpadding=5 bgcolor=#FFFF66 border=.5>
  <tr>
    <th>first name</th>
    <th>last name</th>
    <th>Phone</th>
    <th>Contacts sum</th>
    <th>Comments</th>
  </tr>
  
<% for user in @users %>
  <% @user = user %>
  <tr>
    <td><%= in_place_editor_field :user, :f_name %></td>
    <td><%= in_place_editor_field :user, :l_name %></td>
    <td><%= in_place_editor_field :user, :phone %></td>
    <td align=center><%=h user.contacts_sum %></td>
    <td><%=h(truncate(user.comment,40,truncate_string="...")) %></td>
    <td><i><%= link_to 'Show', user_path(user) %></i></td>
    <td><i><%= link_to 'Edit', edit_user_path(user) %></i></td>
    <td><i><%= link_to 'Destroy', user_path(user), :confirm => 'Are you sure?',
:method => :delete %></i></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New user', new_user_path %>
-----------------------------------------------------------------------
The best I can do is:
= javascript_include_tag :defaults
%h1 Listing users

%table{:cellpadding => 5, :bgcolor => "#FFFF66", :border => 5}
  %tr
    %th first name
    %th last name
    %th Phone
    %th Contacts sum
    %th Comments
----------------------------------------------------------------------
As soon as I try to implement the for loop, it messes up and I'm lost:
  - for user in @users 
  -   @user = user
    %td={ in_place_editor_field :user, :l_name }
  - end



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to