filling in the helper function bits + using "html_safe" method since I am on Rails 3

cat-town
Dan Buch 13 years ago
parent cb8e89de30
commit 066433a22d

@ -1,2 +1,9 @@
require 'sha1'
module ListHelper
def create_li(item, i)
%{<li class="#{ i % 2 == 0 ? 'even' : 'odd' }">#{i}:
#{SHA1.new(item.object_id.to_s)}</li>}
end
end

@ -1,6 +1,5 @@
<ul style="font-family:monospace;">
<% @list.each_with_index do |item, i| %>
<li class="<%= i % 2 == 0 ? 'even' : 'odd' %>"><%= i %>:
<%= SHA1.new(item.object_id.to_s) %></li>
<%= create_li(item, i).html_safe %>
<% end %>
</ul>

Loading…
Cancel
Save