Use join to construct tag strings instead of mucking around counting

position in the string.
This commit is contained in:
Tom Hughes 2009-07-07 23:05:35 +00:00
parent 9afb533280
commit 0b6f0c1d34
2 changed files with 2 additions and 6 deletions

View file

@ -27,9 +27,7 @@
<%= t'trace.trace.by' %> <%=link_to h(trace.user.display_name), {:controller => 'user', :action => 'view', :display_name => trace.user.display_name} %> <%= t'trace.trace.by' %> <%=link_to h(trace.user.display_name), {:controller => 'user', :action => 'view', :display_name => trace.user.display_name} %>
<% if !trace.tags.empty? %> <% if !trace.tags.empty? %>
<%= t'trace.trace.in' %> <%= t'trace.trace.in' %>
<% trace.tags.each_with_index do |tag, index| %> <%= trace.tags.collect { |tag| link_to_tag tag.tag }.join(", ") %>
<%= link_to_tag tag.tag %><%=', ' if index+1 < trace.tags.count %>
<% end %>
<% end %> <% end %>
</td> </td>
</tr> </tr>

View file

@ -36,9 +36,7 @@
<td><%= t'trace.view.tags' %></td> <td><%= t'trace.view.tags' %></td>
<td> <td>
<% unless @trace.tags.empty? %> <% unless @trace.tags.empty? %>
<% @trace.tags.each_with_index do |tag, index| %> <%= @trace.tags.collect { |tag| link_to tag.tag, { :controller => 'trace', :action => 'list', :tag => tag.tag, :id => nil } }.join(", ") %>
<%= link_to tag.tag, { :controller => 'trace', :action => 'list', :tag => tag.tag, :id => nil } %><%=', ' if index+1 < @trace.tags.count %>
<% end %>
<% else %> <% else %>
<i><%= t'trace.view.none' %></i> <i><%= t'trace.view.none' %></i>
<% end %> <% end %>