filling in the helper function bits + using "html_safe" method since I am on Rails 3
This commit is contained in:
parent
cb8e89de30
commit
066433a22d
@ -1,2 +1,9 @@
|
|||||||
|
require 'sha1'
|
||||||
|
|
||||||
|
|
||||||
module ListHelper
|
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
|
end
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<ul style="font-family:monospace;">
|
<ul style="font-family:monospace;">
|
||||||
<% @list.each_with_index do |item, i| %>
|
<% @list.each_with_index do |item, i| %>
|
||||||
<li class="<%= i % 2 == 0 ? 'even' : 'odd' %>"><%= i %>:
|
<%= create_li(item, i).html_safe %>
|
||||||
<%= SHA1.new(item.object_id.to_s) %></li>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user