Hi,
I have the following code in one of my partials and it''s slightly
ridiculous so I was wondering whether anyone could give me some hints
as to the best way to tidy it up. The formatting performed here gets
performed in a number of places throughout the views.
I''m not sure whether to add methods to the model to deal with this
formatting or to use helpers or what.
I''d also be able to go the other way when it comes to the data fields,
i.e., be able to enter ''1.8 M'' in a form field and have that
converted
to bytes.
<tr class="<%= cycle(''even_row'',
''odd_row'') %>">
<td class="centre"><%= top_talker_row.rank %></td>
<td><%= h top_talker_row.ip_address %></td>
<td><%= h top_talker_row.date_first_seen.to_s(:db) %></td>
<td><%= h
top_talker_row.data_date.date.strftime("%Y-%m-%d")%></td>
<td><%= h number_to_time(top_talker_row.duration) %></td>
<td><%= h top_talker_row.protocol.humanize %></td>
<td><%= h
number_with_delimiter(number_with_precision(top_talker_row.flows, 0))
%></td>
<td><%= h
number_with_delimiter(number_with_precision(top_talker_row.packets,
0)) %></td>
<td><%= h number_to_human_size(top_talker_row.bytes) %></td>
<td><%= h
number_with_delimiter(number_with_precision(top_talker_row.packets_per_second,
0)) %></td>
<td><%= h
number_with_delimiter(number_with_precision(top_talker_row.bits_per_second,
0)) %></td>
<td><%= h number_to_human_size(top_talker_row.bytes_per_packet)
%></
td>
<td><%= h top_talker_row.network.name.humanize %></td>
<td><%= h top_talker_row.top_talker_type.name.titlecase
%></td>
<td class="left-separator action-cell center">
<%= link_to(
image_tag(''icons/application_form_magnify.png'', :alt =>
''Show''),
top_talker_row,
:title => ''Show''
)
%>
</td>
</tr>
Any help would be appreciated,
Thanks,
Toby
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---