small fix for deleted tags

This commit is contained in:
Harry Bomrah 2015-09-16 14:03:33 +08:00
parent e21bbac441
commit dc4496fedd
1 changed files with 22 additions and 11 deletions

View File

@ -14,19 +14,30 @@
<div class="tags"> <div class="tags">
<div id="tags-list"> <div id="tags-list">
<ul class="tags-groups checkbox-card module-tags"> <ul class="tags-groups checkbox-card module-tags">
<% tags_to_remove = [] %>
<% feed.tag_ids.each do |t| %> <% feed.tag_ids.each do |t| %>
<% tag = Tag.find(t) %> <% tag = Tag.find(t) rescue nil %>
<li class="filter-item module"> <% if !tag.nil? %>
<a href="#" onclick="return false;"> <li class="filter-item module">
<% @site_in_use_locales.each_with_index do |locale,index| %> <a href="#" onclick="return false;">
<span class="tag"><%= tag.name_translations[locale] %></span> <% @site_in_use_locales.each_with_index do |locale,index| %>
<% if index < (@site_in_use_locales.count - 1) %> <span class="tag"><%= tag.name_translations[locale] %></span>
/ <% if index < (@site_in_use_locales.count - 1) %>
<% end %> /
<% end %> <% end %>
</a> <% end %>
</li> </a>
</li>
<% else %>
<% tags_to_remove << t %>
<% end %>
<% end %> <% end %>
<% if !tags_to_remove.blank?
tags_to_remove.each do |t|
feed.tag_ids.delete(t)
end
feed.save
end %>
</ul> </ul>
</div> </div>
</div> </div>