-
-
Save bronson/205644 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="list"> | |
<ul> | |
<% @items.each do |item| %> | |
<li class="<%= item_classes_for_user(item, @current_user) %>"> | |
<%= image_tag "/icons/#{item.state}.png" %> | |
<span class="name"> | |
<%= item.name %> | |
</span> | |
</li> | |
<% end %> | |
</ul> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.list | |
%ul | |
- @items.each do |item| | |
%li{ :class => item_classes_for_user(item, @current_user) } | |
= image_tag "/icons/#{item.state}.png" | |
%span.name= item.name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Erector | |
div :class => "list" do | |
ul do | |
@items.each do |item| | |
li :class => item_classes_for_user(item, @current_user) do | |
img :src => "/icons/#{item.state}.png" | |
span item.name, :class => "name" | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def item_classes_for_user(item, user) | |
classes = ["item", item.state] | |
classes << "interesting" if item.interesting_to?(user) | |
classes | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment