lucasmartins/igs_pie_chart

View on GitHub
templates/_labels.html.erb

Summary

Maintainability
Test Coverage
<ul class="labels">
<% @labels.each_with_index do |l,i| %>
<% l = l.gsub('_',' ') %>
  <li>
    <span id="<%=@target_element%>_color_<%=i%>">
      &nbsp;<%= @data[i] %>&nbsp;
    </span>
    <%= l.to_s.capitalize %>
    <script type="text/javascript">
        document.getElementById('<%=@target_element%>_color_<%=i%>').setAttribute('style','background-color:'+color(<%=i%>)+';');
    </script>
  </li>
<% end %>
</ul>