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