]> projects.mako.cc - selectricity/blob - vendor/plugins/sitealizer/lib/app/views/sitealizer/_languages.rhtml
The results page should now work for scaling embeddableelections as well.
[selectricity] / vendor / plugins / sitealizer / lib / app / views / sitealizer / _languages.rhtml
1 <% max_total = @languages.inject(0) {|m,a| a['total'].to_i > m ? a['total'].to_i : m }%>
2 <br><br>
3
4 <table align=center width=90% border=1 cellpadding=3>
5 <tr nowrap>
6 <th width=1>#</th>      
7 <th width=10>Hits</th>
8 <th>Language</th>      
9 <th width=10>Percentage</th>
10 <th width=200></th>
11 </tr>
12 <% i=1; @languages.each do |lang|width=((lang.total.to_f/max_total)*200).round; width = 1 if width < 1 %>
13 <tr nowrap>
14 <td align=center><%= i %></td>
15 <td align=center><%= lang.total %></td>
16 <td align=left><%= lang.language.nil? ? 'Unknown' : Sitealizer::Parser::Language.get_name(lang.language.downcase) %></td>    
17 <td align=center><%= sprintf("%000.2f",(lang.total.to_f/@total_hits)*100) %>%</td>
18 <td align=left><%=image_tag 'sitealizer/bar.gif', :width => width, :height => 3%></td>
19 </tr>
20 <% i+=1; end %>
21 </table>

Benjamin Mako Hill || Want to submit a patch?