Skip to content

Instantly share code, notes, and snippets.

@jrichter
Created June 4, 2009 16:58
Show Gist options
  • Save jrichter/123707 to your computer and use it in GitHub Desktop.
Save jrichter/123707 to your computer and use it in GitHub Desktop.
This is neat. Here is my erb file.
<% content_for :sidebar do %>
<%= link_to 'New user', new_user_path %>
<% end %>
<h1>Listing users</h1>
<% @users.each do |user| %>
<% if user.sessions.size > 0 %>
<p class="logged_in">
<% else %>
<p class="logged_out">
<% end %>
Name: <%=h user.name %><br/>
Email: <%=h user.email %><br/>
Role: <%=h user.role %><br/>
LDAP? <%= user.is_ldap || "false" %><br/>
<%= link_to 'Show', user %> |
<%= link_to 'Edit', edit_user_path(user) %>
</p>
<% end %>
And here is the same file in haml.
- content_for :sidebar do
= link_to 'New user', new_user_path
%h1 Listing users
- @users.each do |user|
%div{:class => user.sessions.size > 0 ? 'logged_in' : 'logged_out' }
Name:
= user.name
%br/
Email:
= user.email
%br/
Role:
= user.role
%br/
LDAP?
= user.is_ldap || "false"
%br/
= link_to 'Show', user
= link_to 'Edit', edit_user_path(user)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment